mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Add close button to Admin Settings
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
import { Shield, ArrowLeft, Settings, RefreshCw } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { ThemeToggle } from '@/components/theme/ThemeToggle';
|
||||
import { AuthButtons } from '@/components/auth/AuthButtons';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
|
||||
export function AdminHeader({ onRefresh }: { onRefresh?: () => void }) {
|
||||
const { permissions } = useUserRole();
|
||||
const location = useLocation();
|
||||
|
||||
const isSettingsPage = location.pathname === '/admin/settings';
|
||||
const backLink = isSettingsPage ? '/admin' : '/';
|
||||
const backText = isSettingsPage ? 'Back to Admin' : 'Back to ThrillWiki';
|
||||
const pageTitle = isSettingsPage ? 'Admin Settings' : 'Admin Dashboard';
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
||||
<div className="container flex h-16 items-center justify-between px-4">
|
||||
{/* Left Section - Back to main site */}
|
||||
{/* Left Section - Navigation */}
|
||||
<div className="flex items-center gap-4">
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link to="/" className="flex items-center gap-2">
|
||||
<Link to={backLink} className="flex items-center gap-2">
|
||||
<ArrowLeft className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Back to ThrillWiki</span>
|
||||
<span className="hidden sm:inline">{backText}</span>
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -24,7 +30,7 @@ export function AdminHeader({ onRefresh }: { onRefresh?: () => void }) {
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Shield className="w-6 h-6 text-primary" />
|
||||
<h1 className="text-lg font-semibold">Admin Dashboard</h1>
|
||||
<h1 className="text-lg font-semibold">{pageTitle}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +45,7 @@ export function AdminHeader({ onRefresh }: { onRefresh?: () => void }) {
|
||||
<RefreshCw className="w-4 h-4" />
|
||||
<span className="hidden sm:ml-2 sm:inline">Refresh</span>
|
||||
</Button>
|
||||
{permissions?.role_level === 'superuser' && (
|
||||
{permissions?.role_level === 'superuser' && !isSettingsPage && (
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link to="/admin/settings">
|
||||
<Settings className="w-4 h-4" />
|
||||
|
||||
Reference in New Issue
Block a user