Make the version number a badge, rather than an independent item in the nav dropdown
Some checks are pending
dockerize / Publish Khoj Docker Images (push) Waiting to run
build and deploy github pages for documentation / deploy (push) Waiting to run
pypi / Publish Python Package to PyPI (push) Waiting to run

This commit is contained in:
sabaimran 2024-12-09 14:45:26 -08:00
parent eb36492ba5
commit 4b4e0e20d4

View file

@ -37,6 +37,15 @@ function SubscriptionBadge({ is_active }: { is_active: boolean }) {
); );
} }
function VersionBadge({ version }: { version: string }) {
return (
<div className="flex flex-row items-center">
<div className="w-3 h-3 rounded-full bg-green-500 mr-1"></div>
<p className="text-xs">{version}</p>
</div>
);
}
export default function NavMenu() { export default function NavMenu() {
const userData = useAuthenticatedData(); const userData = useAuthenticatedData();
const [darkMode, setDarkMode] = useState(false); const [darkMode, setDarkMode] = useState(false);
@ -99,6 +108,9 @@ export default function NavMenu() {
<div className="flex flex-col"> <div className="flex flex-col">
<p className="font-semibold">{userData?.email}</p> <p className="font-semibold">{userData?.email}</p>
<SubscriptionBadge is_active={userData?.is_active ?? false} /> <SubscriptionBadge is_active={userData?.is_active ?? false} />
{userData?.khoj_version && (
<VersionBadge version={userData?.khoj_version} />
)}
</div> </div>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
@ -170,9 +182,7 @@ export default function NavMenu() {
> >
<div className="flex flex-rows"> <div className="flex flex-rows">
<Code className="w-6 h-6" /> <Code className="w-6 h-6" />
<p className="ml-3 font-semibold"> <p className="ml-3 font-semibold">Releases</p>
{userData ? userData.khoj_version : "Releases"}
</p>
</div> </div>
</Link> </Link>
</DropdownMenuItem> </DropdownMenuItem>
@ -220,6 +230,9 @@ export default function NavMenu() {
<div className="flex flex-col"> <div className="flex flex-col">
<p className="font-semibold">{userData?.email}</p> <p className="font-semibold">{userData?.email}</p>
<SubscriptionBadge is_active={userData?.is_active ?? false} /> <SubscriptionBadge is_active={userData?.is_active ?? false} />
{userData?.khoj_version && (
<VersionBadge version={userData?.khoj_version} />
)}
</div> </div>
</MenubarItem> </MenubarItem>
<MenubarSeparator className="dark:bg-white height-[2px] bg-black" /> <MenubarSeparator className="dark:bg-white height-[2px] bg-black" />
@ -295,9 +308,7 @@ export default function NavMenu() {
> >
<div className="flex flex-rows"> <div className="flex flex-rows">
<Code className="w-6 h-6" /> <Code className="w-6 h-6" />
<p className="ml-3 font-semibold"> <p className="ml-3 font-semibold">Releases</p>
{userData ? userData.khoj_version : "Releases"}
</p>
</div> </div>
</Link> </Link>
</MenubarItem> </MenubarItem>