mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:11:13 -05:00
Visual edit in Lovable
This commit is contained in:
@@ -2,68 +2,51 @@ import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import { User, Settings, LogOut, Trophy } from 'lucide-react';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
export function AuthButtons() {
|
||||
const { user, profile, signOut } = useAuth();
|
||||
const {
|
||||
user,
|
||||
profile,
|
||||
signOut
|
||||
} = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const {
|
||||
toast
|
||||
} = useToast();
|
||||
const [loggingOut, setLoggingOut] = useState(false);
|
||||
|
||||
const handleSignOut = async () => {
|
||||
setLoggingOut(true);
|
||||
try {
|
||||
await signOut();
|
||||
toast({
|
||||
title: "Signed out",
|
||||
description: "You've been signed out successfully.",
|
||||
description: "You've been signed out successfully."
|
||||
});
|
||||
navigate('/');
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
variant: "destructive",
|
||||
title: "Error signing out",
|
||||
description: error.message,
|
||||
description: error.message
|
||||
});
|
||||
} finally {
|
||||
setLoggingOut(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="hidden sm:flex"
|
||||
onClick={() => navigate('/auth?tab=signin')}
|
||||
>
|
||||
return <>
|
||||
<Button variant="ghost" size="sm" className="hidden sm:flex" onClick={() => navigate('/auth?tab=signin')}>
|
||||
Sign In
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90"
|
||||
onClick={() => navigate('/auth?tab=signup')}
|
||||
>
|
||||
<Button size="sm" className="bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90" onClick={() => navigate('/auth?tab=signup')}>
|
||||
Join ThrillWiki
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
return <DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
|
||||
<Avatar className="h-8 w-8">
|
||||
@@ -90,10 +73,7 @@ export function AuthButtons() {
|
||||
<User className="mr-2 h-4 w-4" />
|
||||
<span>Profile</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => navigate('/profile#lists')}>
|
||||
<Trophy className="mr-2 h-4 w-4" />
|
||||
<span>My Lists</span>
|
||||
</DropdownMenuItem>
|
||||
|
||||
<DropdownMenuItem onClick={() => navigate('/settings')}>
|
||||
<Settings className="mr-2 h-4 w-4" />
|
||||
<span>Settings</span>
|
||||
@@ -104,6 +84,5 @@ export function AuthButtons() {
|
||||
<span>{loggingOut ? 'Signing out...' : 'Sign out'}</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
</DropdownMenu>;
|
||||
}
|
||||
Reference in New Issue
Block a user