Merge pull request #139 from shumaiOne/feat/avatar-menu-version

feat(webui): show app version in avatar menu
This commit is contained in:
Yiling-J
2026-06-19 23:02:09 +08:00
committed by GitHub
3 changed files with 47 additions and 11 deletions
+40 -11
View File
@@ -1,24 +1,43 @@
import { client } from '@/ui/api/client'
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/components/ui/avatar'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
DropdownMenuPortal,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from '@/ui/components/ui/dropdown-menu'
import { useTeamId } from '@/ui/hooks/use-team-id'
import { signOut } from '@/ui/lib/auth-client'
import { useAuthStore } from '@/ui/stores/auth'
import { useQuery } from '@tanstack/react-query'
import { useNavigate } from '@tanstack/react-router'
import { useTheme } from './theme-provider'
import { Check } from 'lucide-react'
import { APP_VERSION } from '../version'
import { useTheme } from './theme-provider'
const Github = (props: React.SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<path d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4" />
<path d="M9 18c-4.51 2-5-2-7-2" />
</svg>
)
export function UserMenu() {
const { clearAuth } = useAuthStore()
@@ -125,6 +144,16 @@ export function UserMenu() {
<DropdownMenuItem className="text-red-500 focus:text-red-500" onClick={handleLogout}>
Log out
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="text-xs text-muted-foreground flex items-center gap-2 cursor-pointer focus:bg-accent focus:text-accent-foreground justify-center bg-accent border"
onClick={() =>
window.open('https://github.com/shumaiOne/shumai', '_blank', 'noopener,noreferrer')
}
>
<Github className="size-3.5" />
<span>Version {APP_VERSION}</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
+1
View File
@@ -0,0 +1 @@
export const APP_VERSION = '0.0.8'
+6
View File
@@ -91,6 +91,12 @@ function updateVersions(newVersion: string) {
writeFileSync(file, JSON.stringify(content, null, 2) + '\n', 'utf-8')
console.log(` Updated version in ${file}`)
}
const versionFile = 'packages/webui/version.ts'
if (existsSync(versionFile)) {
writeFileSync(versionFile, `export const APP_VERSION = '${newVersion}'\n`, 'utf-8')
console.log(` Updated version in ${versionFile}`)
}
}
function shellQuote(value: string) {