修改為使用者只有登出功能
This commit is contained in:
@@ -63,19 +63,21 @@ export default function HomePage() {
|
|||||||
<div className="hidden md:flex items-center gap-6">
|
<div className="hidden md:flex items-center gap-6">
|
||||||
{/* Navigation Links */}
|
{/* Navigation Links */}
|
||||||
<div className="flex items-center gap-12">
|
<div className="flex items-center gap-12">
|
||||||
<Link
|
|
||||||
href={user?.role === "admin" ? "/admin/results" : "/results"}
|
|
||||||
className="text-muted-foreground hover:text-foreground transition-colors"
|
|
||||||
>
|
|
||||||
{user?.role === "admin" ? "所有測試結果" : "我的測試結果"}
|
|
||||||
</Link>
|
|
||||||
{user?.role === "admin" && (
|
{user?.role === "admin" && (
|
||||||
<Link
|
<>
|
||||||
href="/admin/analytics"
|
<Link
|
||||||
className="text-muted-foreground hover:text-foreground transition-colors"
|
href="/admin/results"
|
||||||
>
|
className="text-muted-foreground hover:text-foreground transition-colors"
|
||||||
部門分析
|
>
|
||||||
</Link>
|
所有測試結果
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href="/admin/analytics"
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors"
|
||||||
|
>
|
||||||
|
部門分析
|
||||||
|
</Link>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -96,17 +98,16 @@ export default function HomePage() {
|
|||||||
{isDropdownOpen && (
|
{isDropdownOpen && (
|
||||||
<div className="absolute right-0 top-full mt-1 w-56 bg-background border border-border rounded-md shadow-lg z-50">
|
<div className="absolute right-0 top-full mt-1 w-56 bg-background border border-border rounded-md shadow-lg z-50">
|
||||||
<div className="py-1">
|
<div className="py-1">
|
||||||
<Link
|
|
||||||
href="/settings"
|
|
||||||
className="flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground"
|
|
||||||
onClick={() => setIsDropdownOpen(false)}
|
|
||||||
>
|
|
||||||
<Settings className="w-4 h-4" />
|
|
||||||
帳戶設定
|
|
||||||
</Link>
|
|
||||||
{user?.role === "admin" && (
|
{user?.role === "admin" && (
|
||||||
<>
|
<>
|
||||||
<div className="border-t border-border my-1"></div>
|
<Link
|
||||||
|
href="/settings"
|
||||||
|
className="flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground"
|
||||||
|
onClick={() => setIsDropdownOpen(false)}
|
||||||
|
>
|
||||||
|
<Settings className="w-4 h-4" />
|
||||||
|
帳戶設定
|
||||||
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href="/admin/users"
|
href="/admin/users"
|
||||||
className="flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground"
|
className="flex items-center gap-2 px-4 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground"
|
||||||
@@ -131,9 +132,9 @@ export default function HomePage() {
|
|||||||
<LinkIcon className="w-4 h-4" />
|
<LinkIcon className="w-4 h-4" />
|
||||||
測驗連結
|
測驗連結
|
||||||
</Link>
|
</Link>
|
||||||
|
<div className="border-t border-border my-1"></div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div className="border-t border-border my-1"></div>
|
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleLogout()
|
handleLogout()
|
||||||
@@ -167,29 +168,31 @@ export default function HomePage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Navigation Links */}
|
{/* Navigation Links */}
|
||||||
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
|
||||||
<Link href={user?.role === "admin" ? "/admin/results" : "/results"} className="flex items-center gap-2">
|
|
||||||
<BarChart3 className="w-4 h-4" />
|
|
||||||
{user?.role === "admin" ? "所有測試結果" : "我的測試結果"}
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
{user?.role === "admin" && (
|
|
||||||
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
|
||||||
<Link href="/admin/analytics" className="flex items-center gap-2">
|
|
||||||
<BarChart3 className="w-4 h-4" />
|
|
||||||
部門分析
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
|
||||||
<Link href="/settings" className="flex items-center gap-2">
|
|
||||||
<Settings className="w-4 h-4" />
|
|
||||||
帳戶設定
|
|
||||||
</Link>
|
|
||||||
</Button>
|
|
||||||
{user?.role === "admin" && (
|
{user?.role === "admin" && (
|
||||||
<>
|
<>
|
||||||
|
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
||||||
|
<Link href="/admin/results" className="flex items-center gap-2">
|
||||||
|
<BarChart3 className="w-4 h-4" />
|
||||||
|
所有測試結果
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
||||||
|
<Link href="/admin/analytics" className="flex items-center gap-2">
|
||||||
|
<BarChart3 className="w-4 h-4" />
|
||||||
|
部門分析
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{user?.role === "admin" && (
|
||||||
|
<>
|
||||||
|
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
||||||
|
<Link href="/settings" className="flex items-center gap-2">
|
||||||
|
<Settings className="w-4 h-4" />
|
||||||
|
帳戶設定
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
||||||
<Link href="/admin/users" className="flex items-center gap-2">
|
<Link href="/admin/users" className="flex items-center gap-2">
|
||||||
<Users className="w-4 h-4" />
|
<Users className="w-4 h-4" />
|
||||||
@@ -202,6 +205,12 @@ export default function HomePage() {
|
|||||||
題目管理
|
題目管理
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button asChild variant="ghost" className="w-full justify-start px-4">
|
||||||
|
<Link href="/admin/test-links" className="flex items-center gap-2">
|
||||||
|
<LinkIcon className="w-4 h-4" />
|
||||||
|
測驗連結
|
||||||
|
</Link>
|
||||||
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button onClick={handleLogout} variant="ghost" className="w-full justify-start text-red-600 px-4">
|
<Button onClick={handleLogout} variant="ghost" className="w-full justify-start text-red-600 px-4">
|
||||||
|
Reference in New Issue
Block a user