From 0b87c13f8d090a492855f16d76cf60523a651e8f Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sun, 8 Dec 2024 17:55:56 -0800 Subject: [PATCH] Add khoj_version to the settings menu --- src/interface/web/app/common/auth.ts | 1 + .../web/app/components/navMenu/navMenu.tsx | 69 +++++++++++++------ src/khoj/routers/api.py | 1 + 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/interface/web/app/common/auth.ts b/src/interface/web/app/common/auth.ts index 1c634184..17a90fc8 100644 --- a/src/interface/web/app/common/auth.ts +++ b/src/interface/web/app/common/auth.ts @@ -9,6 +9,7 @@ export interface UserProfile { is_active: boolean; has_documents: boolean; detail: string; + khoj_version: string; } const fetcher = (url: string) => diff --git a/src/interface/web/app/components/navMenu/navMenu.tsx b/src/interface/web/app/components/navMenu/navMenu.tsx index 256c7d77..f9af7ff1 100644 --- a/src/interface/web/app/components/navMenu/navMenu.tsx +++ b/src/interface/web/app/components/navMenu/navMenu.tsx @@ -22,7 +22,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { Moon, Sun, UserCircle, Question, GearFine, ArrowRight } from "@phosphor-icons/react"; +import { Moon, Sun, UserCircle, Question, GearFine, ArrowRight, Code } from "@phosphor-icons/react"; import { KhojAgentLogo, KhojAutomationLogo, KhojSearchLogo } from "../logo/khojLogo"; import { useIsMobileWidth } from "@/app/common/utils"; @@ -143,18 +143,18 @@ export default function NavMenu() { )} + {userData && ( + + +
+ +

Settings

+
+ +
+ )} <> - {userData && ( - - -
- -

Settings

-
- -
- )}
@@ -163,6 +163,19 @@ export default function NavMenu() {
+ + +
+ +

+ {userData ? userData.khoj_version : "Releases"} +

+
+ +
{userData ? ( @@ -251,6 +264,16 @@ export default function NavMenu() { )} + {userData && ( + + +
+ +

Settings

+
+ +
+ )} <> @@ -264,16 +287,20 @@ export default function NavMenu() { - {userData && ( - - -
- -

Settings

-
- -
- )} + + + +
+ +

+ {userData ? userData.khoj_version : "Releases"} +

+
+ +
{userData ? ( diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index 4516745a..4c86d1c4 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -537,6 +537,7 @@ def user_info(request: Request) -> Response: "photo": user_picture, "is_active": is_active, "has_documents": has_documents, + "khoj_version": state.khoj_version, } # Return user information as a JSON response