mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Merge branch 'menu-update' into 'main'
Menu update Closes #25 See merge request soapbox-pub/act2!12
This commit is contained in:
commit
47b2f2bb12
8 files changed
+413
-47
No files matched your search
@@ -4,7 +4,7 @@ import { type Project } from '@/lib/ProjectsManager';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { ProjectSidebar } from '@/components/ProjectSidebar';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Menu, Columns2 } from 'lucide-react';
|
||||
import { Menu } from 'lucide-react';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
|
||||
interface AppLayoutProps {
|
||||
@@ -129,6 +129,7 @@ export function AppLayout({
|
||||
selectedProject={selectedProject}
|
||||
onSelectProject={handleProjectSelect}
|
||||
className="h-screen sticky top-0"
|
||||
onToggleSidebar={() => setIsSidebarVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -136,16 +137,16 @@ export function AppLayout({
|
||||
{/* Main Content Area */}
|
||||
<div className="flex-1 flex flex-col bg-background">
|
||||
<div className="min-h-screen bg-gradient-to-br from-primary/5 to-accent/5 relative">
|
||||
{/* Toggle Button - positioned absolutely in top-left corner */}
|
||||
{showSidebar && (
|
||||
{/* Show open button when sidebar is collapsed */}
|
||||
{showSidebar && !isSidebarVisible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
|
||||
onClick={() => setIsSidebarVisible(true)}
|
||||
className="absolute top-2 left-4 h-8 w-8 p-0 z-10 bg-transparent backdrop-blur-sm hover:bg-transparent text-foreground/70 hover:text-foreground"
|
||||
aria-label="Toggle sidebar"
|
||||
aria-label="Open sidebar"
|
||||
>
|
||||
{isSidebarVisible ? <Columns2 className="h-4 w-4" /> : <Menu className="h-4 w-4" />}
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { ProjectSidebar } from './ProjectSidebar';
|
||||
import { useProjects } from '@/hooks/useProjects';
|
||||
import { useLocalStorage } from '@/hooks/useLocalStorage';
|
||||
|
||||
// Mock the hooks
|
||||
vi.mock('@/hooks/useProjects');
|
||||
vi.mock('@/hooks/useLocalStorage');
|
||||
vi.mock('@/hooks/useProjectSessionStatus', () => ({
|
||||
useProjectSessionStatus: () => ({ hasRunningSessions: false })
|
||||
}));
|
||||
vi.mock('react-router-dom', () => ({
|
||||
useNavigate: () => vi.fn()
|
||||
}));
|
||||
vi.mock('@tanstack/react-query', () => ({
|
||||
useQueryClient: () => ({
|
||||
invalidateQueries: vi.fn()
|
||||
})
|
||||
}));
|
||||
|
||||
// Mock the LoginArea component
|
||||
vi.mock('@/components/auth/LoginArea', () => ({
|
||||
LoginArea: ({ className }: { className?: string }) => (
|
||||
<div data-testid="login-area" className={className}>Login Area</div>
|
||||
)
|
||||
}));
|
||||
|
||||
const mockUseProjects = vi.mocked(useProjects);
|
||||
const mockUseLocalStorage = vi.mocked(useLocalStorage);
|
||||
|
||||
describe('ProjectSidebar', () => {
|
||||
beforeEach(() => {
|
||||
mockUseProjects.mockReturnValue({
|
||||
data: [],
|
||||
isLoading: false,
|
||||
error: null
|
||||
} as unknown as ReturnType<typeof useProjects>);
|
||||
|
||||
mockUseLocalStorage.mockReturnValue([[], vi.fn()]);
|
||||
});
|
||||
|
||||
it('renders sidebar header with logo', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('🎭')).toBeInTheDocument();
|
||||
expect(screen.getByText('Shakespeare')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows collapse button when onToggleSidebar is provided', () => {
|
||||
const mockToggle = vi.fn();
|
||||
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
onToggleSidebar={mockToggle}
|
||||
/>
|
||||
);
|
||||
|
||||
const collapseButton = screen.getByLabelText('Collapse sidebar');
|
||||
expect(collapseButton).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(collapseButton);
|
||||
expect(mockToggle).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('does not show collapse button when onToggleSidebar is not provided', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByLabelText('Collapse sidebar')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders login area at the bottom', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('login-area')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows new project button', () => {
|
||||
render(
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={vi.fn()}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('New Project')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Plus, Folder, GitBranch, Settings, Loader2, ChevronDown, Star } from 'lucide-react';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, Star, Columns2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
@@ -76,12 +76,14 @@ interface ProjectSidebarProps {
|
||||
selectedProject: Project | null;
|
||||
onSelectProject: (project: Project | null) => void;
|
||||
className?: string;
|
||||
onToggleSidebar?: () => void;
|
||||
}
|
||||
|
||||
export function ProjectSidebar({
|
||||
selectedProject,
|
||||
onSelectProject,
|
||||
className
|
||||
className,
|
||||
onToggleSidebar
|
||||
}: ProjectSidebarProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const { data: projects = [], isLoading, error } = useProjects();
|
||||
@@ -116,16 +118,19 @@ export function ProjectSidebar({
|
||||
Shakespeare
|
||||
</h1>
|
||||
</button>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0 hover:bg-primary/10 -mr-2"
|
||||
onClick={() => navigate('/settings')}
|
||||
>
|
||||
<Settings className="h-4 w-4 text-primary/60 hover:text-primary" />
|
||||
</Button>
|
||||
</div>
|
||||
{onToggleSidebar && (
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-8 w-8 p-0 hover:bg-primary/10 -mr-2"
|
||||
onClick={onToggleSidebar}
|
||||
aria-label="Collapse sidebar"
|
||||
>
|
||||
<Columns2 className="h-4 w-4 text-primary/60 hover:text-primary" />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
||||
import { useNavigate, useLocation, Outlet } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { Menu, Columns2, Bot, GitBranch, Database } from 'lucide-react';
|
||||
import { Menu, Bot, GitBranch, Database } from 'lucide-react';
|
||||
import { ProjectSidebar } from '@/components/ProjectSidebar';
|
||||
import { useProjectsManager } from '@/hooks/useProjectsManager';
|
||||
import { useIsMobile } from '@/hooks/useIsMobile';
|
||||
@@ -145,6 +145,7 @@ export function SettingsLayout() {
|
||||
selectedProject={null}
|
||||
onSelectProject={handleProjectSelect}
|
||||
className="h-full"
|
||||
onToggleSidebar={() => setIsSidebarVisible(false)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -154,15 +155,17 @@ export function SettingsLayout() {
|
||||
{/* Header with toggle button */}
|
||||
<div className="h-12 px-4 py-2 border-b flex-shrink-0">
|
||||
<div className="flex items-center gap-3">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(!isSidebarVisible)}
|
||||
className="h-8 w-8 p-0"
|
||||
aria-label="Toggle sidebar"
|
||||
>
|
||||
{isSidebarVisible ? <Columns2 className="h-4 w-4" /> : <Menu className="h-4 w-4" />}
|
||||
</Button>
|
||||
{!isSidebarVisible && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsSidebarVisible(true)}
|
||||
className="h-8 w-8 p-0"
|
||||
aria-label="Open sidebar"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
<h1 className="text-xl font-bold flex items-center gap-2">
|
||||
Settings
|
||||
</h1>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { AccountSwitcher } from './AccountSwitcher';
|
||||
import { useLoggedInAccounts } from '@/hooks/useLoggedInAccounts';
|
||||
|
||||
// Mock the hooks
|
||||
vi.mock('@/hooks/useLoggedInAccounts');
|
||||
vi.mock('react-router-dom', () => ({
|
||||
useNavigate: () => vi.fn()
|
||||
}));
|
||||
|
||||
// Mock the RelaySelector component
|
||||
vi.mock('@/components/RelaySelector', () => ({
|
||||
RelaySelector: ({ className }: { className?: string }) => (
|
||||
<div data-testid="relay-selector" className={className}>Relay Selector</div>
|
||||
)
|
||||
}));
|
||||
|
||||
const mockUseLoggedInAccounts = vi.mocked(useLoggedInAccounts);
|
||||
|
||||
describe('AccountSwitcher', () => {
|
||||
it('renders account switcher with dropdown trigger', () => {
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [{
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
}],
|
||||
currentUser: {
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
},
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
render(<AccountSwitcher onAddAccountClick={vi.fn()} />);
|
||||
|
||||
// Should show the user's name
|
||||
expect(screen.getByText('Test User')).toBeInTheDocument();
|
||||
|
||||
// Should show dropdown trigger button
|
||||
expect(screen.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
|
||||
it('returns null when no current user', () => {
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [],
|
||||
currentUser: undefined,
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
const { container } = render(<AccountSwitcher onAddAccountClick={vi.fn()} />);
|
||||
|
||||
expect(container.firstChild).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
// NOTE: This file is stable and usually should not be modified.
|
||||
// It is important that all functionality in this file is preserved, and should only be modified if explicitly requested.
|
||||
|
||||
import { ChevronDown, LogOut, UserIcon, UserPlus } from 'lucide-react';
|
||||
import { ChevronDown, LogOut, UserIcon, UserPlus, Settings, HelpCircle } from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
@@ -13,6 +13,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar.tsx'
|
||||
import { RelaySelector } from '@/components/RelaySelector';
|
||||
import { useLoggedInAccounts, type Account } from '@/hooks/useLoggedInAccounts';
|
||||
import { genUserName } from '@/lib/genUserName';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
interface AccountSwitcherProps {
|
||||
onAddAccountClick: () => void;
|
||||
@@ -20,6 +21,7 @@ interface AccountSwitcherProps {
|
||||
|
||||
export function AccountSwitcher({ onAddAccountClick }: AccountSwitcherProps) {
|
||||
const { currentUser, otherUsers, setLogin, removeLogin } = useLoggedInAccounts();
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (!currentUser) return null;
|
||||
|
||||
@@ -63,6 +65,20 @@ export function AccountSwitcher({ onAddAccountClick }: AccountSwitcherProps) {
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => navigate('/settings')}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<Settings className='w-4 h-4' />
|
||||
<span>Settings</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => window.open('https://soapbox.pub/shakespeare-resources/', '_blank')}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<HelpCircle className='w-4 h-4' />
|
||||
<span>Help</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={onAddAccountClick}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { LoginArea } from './LoginArea';
|
||||
import { useLoggedInAccounts } from '@/hooks/useLoggedInAccounts';
|
||||
|
||||
// Mock the hooks
|
||||
vi.mock('@/hooks/useLoggedInAccounts');
|
||||
vi.mock('@/hooks/useAppContext', () => ({
|
||||
useAppContext: () => ({
|
||||
config: { relayUrl: 'wss://relay.damus.io' },
|
||||
updateConfig: vi.fn(),
|
||||
presetRelays: [
|
||||
{ name: 'Damus', url: 'wss://relay.damus.io' }
|
||||
]
|
||||
})
|
||||
}));
|
||||
|
||||
// Mock the components
|
||||
vi.mock('./AccountSwitcher', () => ({
|
||||
AccountSwitcher: ({ onAddAccountClick }: { onAddAccountClick: () => void }) => (
|
||||
<div data-testid="account-switcher">
|
||||
<button onClick={onAddAccountClick}>Add Account</button>
|
||||
</div>
|
||||
)
|
||||
}));
|
||||
|
||||
// Mock react-router-dom
|
||||
vi.mock('react-router-dom', () => ({
|
||||
useNavigate: () => vi.fn()
|
||||
}));
|
||||
|
||||
vi.mock('@/components/RelaySelector', () => ({
|
||||
RelaySelector: ({ className }: { className?: string }) => (
|
||||
<div data-testid="relay-selector" className={className}>Relay Selector</div>
|
||||
)
|
||||
}));
|
||||
|
||||
vi.mock('./LoginDialog', () => ({
|
||||
default: ({ isOpen }: { isOpen: boolean; onClose: () => void }) =>
|
||||
isOpen ? <div data-testid="login-dialog">Login Dialog</div> : null
|
||||
}));
|
||||
|
||||
vi.mock('./SignupDialog', () => ({
|
||||
default: ({ isOpen }: { isOpen: boolean; onClose: () => void }) =>
|
||||
isOpen ? <div data-testid="signup-dialog">Signup Dialog</div> : null
|
||||
}));
|
||||
|
||||
const mockUseLoggedInAccounts = vi.mocked(useLoggedInAccounts);
|
||||
|
||||
describe('LoginArea', () => {
|
||||
it('shows AccountSwitcher when user is logged in', () => {
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [{
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
}],
|
||||
currentUser: {
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
},
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
render(<LoginArea />);
|
||||
|
||||
expect(screen.getByTestId('account-switcher')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows anonymous user menu when user is not logged in', () => {
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [],
|
||||
currentUser: undefined,
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
render(<LoginArea />);
|
||||
|
||||
// Should show anonymous user display
|
||||
expect(screen.getByText('Anonymous')).toBeInTheDocument();
|
||||
|
||||
// Should show the dropdown trigger button
|
||||
expect(screen.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
|
||||
it('maintains consistent layout structure whether logged in or not', () => {
|
||||
// Test logged out state
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [],
|
||||
currentUser: undefined,
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
const { rerender } = render(<LoginArea />);
|
||||
|
||||
const loggedOutContainer = screen.getByRole('button');
|
||||
expect(loggedOutContainer).toHaveClass('flex', 'items-center', 'gap-3', 'p-3', 'rounded-full');
|
||||
|
||||
// Test logged in state
|
||||
mockUseLoggedInAccounts.mockReturnValue({
|
||||
authors: [{
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
}],
|
||||
currentUser: {
|
||||
id: 'user1',
|
||||
pubkey: 'pubkey1',
|
||||
metadata: { name: 'Test User' }
|
||||
},
|
||||
otherUsers: [],
|
||||
setLogin: vi.fn(),
|
||||
removeLogin: vi.fn()
|
||||
});
|
||||
|
||||
rerender(<LoginArea />);
|
||||
|
||||
// Both states should maintain similar structure
|
||||
expect(screen.getByTestId('account-switcher')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -2,13 +2,22 @@
|
||||
// It is important that all functionality in this file is preserved, and should only be modified if explicitly requested.
|
||||
|
||||
import { useState } from 'react';
|
||||
import { User, UserPlus } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button.tsx';
|
||||
import { User, UserPlus, ChevronDown, Settings, HelpCircle } from 'lucide-react';
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu.tsx';
|
||||
import { Avatar, AvatarFallback } from '@/components/ui/avatar.tsx';
|
||||
import { RelaySelector } from '@/components/RelaySelector';
|
||||
import LoginDialog from './LoginDialog';
|
||||
import SignupDialog from './SignupDialog';
|
||||
import { useLoggedInAccounts } from '@/hooks/useLoggedInAccounts';
|
||||
import { AccountSwitcher } from './AccountSwitcher';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
export interface LoginAreaProps {
|
||||
className?: string;
|
||||
@@ -16,6 +25,7 @@ export interface LoginAreaProps {
|
||||
|
||||
export function LoginArea({ className }: LoginAreaProps) {
|
||||
const { currentUser } = useLoggedInAccounts();
|
||||
const navigate = useNavigate();
|
||||
const [loginDialogOpen, setLoginDialogOpen] = useState(false);
|
||||
const [signupDialogOpen, setSignupDialogOpen] = useState(false);
|
||||
|
||||
@@ -29,22 +39,55 @@ export function LoginArea({ className }: LoginAreaProps) {
|
||||
{currentUser ? (
|
||||
<AccountSwitcher onAddAccountClick={() => setLoginDialogOpen(true)} />
|
||||
) : (
|
||||
<div className="flex gap-3 justify-center">
|
||||
<Button
|
||||
onClick={() => setLoginDialogOpen(true)}
|
||||
className='flex items-center gap-2 px-4 py-2 rounded-full bg-primary text-primary-foreground w-full font-medium transition-all hover:bg-primary/90 animate-scale-in'
|
||||
>
|
||||
<User className='w-4 h-4' />
|
||||
<span className='truncate'>Log in</span>
|
||||
</Button><Button
|
||||
onClick={() => setSignupDialogOpen(true)}
|
||||
variant="outline"
|
||||
className="flex items-center gap-2 px-4 py-2 rounded-full font-medium transition-all"
|
||||
>
|
||||
<UserPlus className="w-4 h-4" />
|
||||
<span>Sign Up</span>
|
||||
</Button>
|
||||
</div>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className='flex items-center gap-3 p-3 rounded-full hover:bg-accent transition-all w-full text-foreground'>
|
||||
<Avatar className='w-10 h-10'>
|
||||
<AvatarFallback>
|
||||
<User className='w-5 h-5 text-muted-foreground' />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className='flex-1 text-left truncate'>
|
||||
<p className='font-medium text-sm truncate'>Anonymous</p>
|
||||
</div>
|
||||
<ChevronDown className='w-4 h-4 text-muted-foreground' />
|
||||
</button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className='w-56 p-2 animate-scale-in'>
|
||||
<div className='font-medium text-sm px-2 py-1.5'>Switch Relay</div>
|
||||
<RelaySelector className="w-full" />
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => navigate('/settings')}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<Settings className='w-4 h-4' />
|
||||
<span>Settings</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => window.open('https://soapbox.pub/shakespeare-resources/', '_blank')}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<HelpCircle className='w-4 h-4' />
|
||||
<span>Help</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem
|
||||
onClick={() => setLoginDialogOpen(true)}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<User className='w-4 h-4' />
|
||||
<span>Log in</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => setSignupDialogOpen(true)}
|
||||
className='flex items-center gap-2 cursor-pointer p-2 rounded-md'
|
||||
>
|
||||
<UserPlus className='w-4 h-4' />
|
||||
<span>Sign up</span>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)}
|
||||
|
||||
<LoginDialog
|
||||
|
||||
Reference in new issue
Block a user