diff --git a/package-lock.json b/package-lock.json index a3195012..e83da684 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,6 +96,7 @@ "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", "globals": "^16.3.0", + "prettier": "^3.6.2", "ts-node": "^10.9.2", "tw-animate-css": "^1.3.5", "typescript": "~5.9.2", @@ -7558,6 +7559,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", diff --git a/package.json b/package.json index 81530bff..6e8b4c90 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.20", "globals": "^16.3.0", + "prettier": "^3.6.2", "ts-node": "^10.9.2", "tw-animate-css": "^1.3.5", "typescript": "~5.9.2", diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index d1d55c02..ccdd4d3a 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -72,6 +72,7 @@ "register": "Register", "username": "Username", "password": "Password", + "version" : "Version", "confirmPassword": "Confirm Password", "back": "Back", "email": "Email", diff --git a/src/components/ui/sidebar.tsx b/src/components/ui/sidebar.tsx index 291c11b2..350c8400 100644 --- a/src/components/ui/sidebar.tsx +++ b/src/components/ui/sidebar.tsx @@ -1,6 +1,6 @@ import * as React from "react" import { Slot } from "@radix-ui/react-slot" -import { cva, VariantProps } from "class-variance-authority" +import { cva, type VariantProps } from "class-variance-authority" import { PanelLeftIcon } from "lucide-react" import { useIsMobile } from "@/hooks/use-mobile" diff --git a/src/ui/User/UserProfile.tsx b/src/ui/User/UserProfile.tsx index 2f165472..9031620c 100644 --- a/src/ui/User/UserProfile.tsx +++ b/src/ui/User/UserProfile.tsx @@ -8,11 +8,13 @@ import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs.tsx import {User, Shield, Key, AlertCircle} from "lucide-react"; import {TOTPSetup} from "@/ui/User/TOTPSetup.tsx"; import {getUserInfo} from "@/ui/main-axios.ts"; +import { getVersionInfo } from "@/ui/main-axios.ts"; import {toast} from "sonner"; import {PasswordReset} from "@/ui/User/PasswordReset.tsx"; import {useTranslation} from "react-i18next"; import {LanguageSwitcher} from "@/components/LanguageSwitcher"; + interface UserProfileProps { isTopbarOpen?: boolean; } @@ -27,11 +29,23 @@ export function UserProfile({isTopbarOpen = true}: UserProfileProps) { } | null>(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); + const [versionInfo, setVersionInfo] = useState<{ version: string } | null>(null); + useEffect(() => { fetchUserInfo(); + fetchVersion(); }, []); + const fetchVersion = async () => { + try { + const info = await getVersionInfo(); + setVersionInfo({ version: info.version }); + } catch (err) { + console.error("Failed to load version info", err); + } + }; + const fetchUserInfo = async () => { setLoading(true); setError(null); @@ -146,6 +160,13 @@ export function UserProfile({isTopbarOpen = true}: UserProfileProps) { )}

+
+ +

+ {versionInfo?.version || t('common.loading')} +

+
+
diff --git a/src/ui/main-axios.ts b/src/ui/main-axios.ts index 6fa29322..e9a2d97a 100644 --- a/src/ui/main-axios.ts +++ b/src/ui/main-axios.ts @@ -140,6 +140,7 @@ interface AuthResponse { } interface UserInfo { + totp_enabled: boolean; id: string; username: string; is_admin: boolean;