mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
LoginArea display and context improvements
This commit is contained in:
2 files changed
+13
-6
No files matched your search
@@ -1,15 +1,20 @@
|
||||
// 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 React, { useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { User } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button.tsx';
|
||||
import LoginDialog from './LoginDialog';
|
||||
import SignupDialog from './SignupDialog';
|
||||
import { useLoggedInAccounts } from '@/hooks/useLoggedInAccounts';
|
||||
import { AccountSwitcher } from './AccountSwitcher';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export function LoginArea() {
|
||||
export interface LoginAreaProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function LoginArea({ className }: LoginAreaProps) {
|
||||
const { currentUser } = useLoggedInAccounts();
|
||||
const [loginDialogOpen, setLoginDialogOpen] = useState(false);
|
||||
const [signupDialogOpen, setSignupDialogOpen] = useState(false);
|
||||
@@ -20,7 +25,7 @@ export function LoginArea() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center max-w-60">
|
||||
<div className={cn("inline-flex items-center justify-center", className)}>
|
||||
{currentUser ? (
|
||||
<AccountSwitcher onAddAccountClick={() => setLoginDialogOpen(true)} />
|
||||
) : (
|
||||
@@ -29,7 +34,7 @@ export function LoginArea() {
|
||||
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>Log in</span>
|
||||
<span className='truncate'>Log in</span>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user