Add khoj_version to the settings menu

This commit is contained in:
sabaimran 2024-12-08 17:55:56 -08:00
parent 47a087c73b
commit 0b87c13f8d
3 changed files with 50 additions and 21 deletions

View file

@ -9,6 +9,7 @@ export interface UserProfile {
is_active: boolean; is_active: boolean;
has_documents: boolean; has_documents: boolean;
detail: string; detail: string;
khoj_version: string;
} }
const fetcher = (url: string) => const fetcher = (url: string) =>

View file

@ -22,7 +22,7 @@ import {
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"; } 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 { KhojAgentLogo, KhojAutomationLogo, KhojSearchLogo } from "../logo/khojLogo";
import { useIsMobileWidth } from "@/app/common/utils"; import { useIsMobileWidth } from "@/app/common/utils";
@ -143,18 +143,18 @@ export default function NavMenu() {
</Link> </Link>
</DropdownMenuItem> </DropdownMenuItem>
)} )}
{userData && (
<DropdownMenuItem>
<Link href="/settings" className="no-underline w-full">
<div className="flex flex-rows">
<GearFine className="w-6 h-6" />
<p className="ml-3 font-semibold">Settings</p>
</div>
</Link>
</DropdownMenuItem>
)}
<> <>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
{userData && (
<DropdownMenuItem>
<Link href="/settings" className="no-underline w-full">
<div className="flex flex-rows">
<GearFine className="w-6 h-6" />
<p className="ml-3 font-semibold">Settings</p>
</div>
</Link>
</DropdownMenuItem>
)}
<DropdownMenuItem> <DropdownMenuItem>
<Link href="https://docs.khoj.dev" className="no-underline w-full"> <Link href="https://docs.khoj.dev" className="no-underline w-full">
<div className="flex flex-rows"> <div className="flex flex-rows">
@ -163,6 +163,19 @@ export default function NavMenu() {
</div> </div>
</Link> </Link>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem>
<Link
href="https://github.com/khoj-ai/khoj/releases"
className="no-underline w-full"
>
<div className="flex flex-rows">
<Code className="w-6 h-6" />
<p className="ml-3 font-semibold">
{userData ? userData.khoj_version : "Releases"}
</p>
</div>
</Link>
</DropdownMenuItem>
{userData ? ( {userData ? (
<DropdownMenuItem> <DropdownMenuItem>
<Link href="/auth/logout" className="no-underline w-full"> <Link href="/auth/logout" className="no-underline w-full">
@ -251,6 +264,16 @@ export default function NavMenu() {
</Link> </Link>
</MenubarItem> </MenubarItem>
)} )}
{userData && (
<MenubarItem>
<Link href="/settings" className="no-underline w-full">
<div className="flex flex-rows">
<GearFine className="w-6 h-6" />
<p className="ml-3 font-semibold">Settings</p>
</div>
</Link>
</MenubarItem>
)}
<> <>
<MenubarSeparator className="dark:bg-white height-[2px] bg-black" /> <MenubarSeparator className="dark:bg-white height-[2px] bg-black" />
<MenubarItem> <MenubarItem>
@ -264,16 +287,20 @@ export default function NavMenu() {
</div> </div>
</Link> </Link>
</MenubarItem> </MenubarItem>
{userData && (
<MenubarItem> <MenubarItem>
<Link href="/settings" className="no-underline w-full"> <Link
<div className="flex flex-rows"> href="https://github.com/khoj-ai/khoj/releases"
<GearFine className="w-6 h-6" /> className="no-underline w-full"
<p className="ml-3 font-semibold">Settings</p> >
</div> <div className="flex flex-rows">
</Link> <Code className="w-6 h-6" />
</MenubarItem> <p className="ml-3 font-semibold">
)} {userData ? userData.khoj_version : "Releases"}
</p>
</div>
</Link>
</MenubarItem>
{userData ? ( {userData ? (
<MenubarItem> <MenubarItem>
<Link href="/auth/logout" className="no-underline w-full"> <Link href="/auth/logout" className="no-underline w-full">

View file

@ -537,6 +537,7 @@ def user_info(request: Request) -> Response:
"photo": user_picture, "photo": user_picture,
"is_active": is_active, "is_active": is_active,
"has_documents": has_documents, "has_documents": has_documents,
"khoj_version": state.khoj_version,
} }
# Return user information as a JSON response # Return user information as a JSON response