'use client'; import { useRouter } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { useTransition } from 'react'; import { Button } from '@sport/ui'; import { LanguageSwitcher } from '@/components/language-switcher'; import { useSession } from './session-provider'; export function SessionBar() { const t = useTranslations('common'); const { user, signOut } = useSession(); const router = useRouter(); const [isPending, startTransition] = useTransition(); function handleSignOut() { startTransition(async () => { await signOut(); router.replace('/login'); }); } return (
{user ? ( <> {t('session.signedInAs', { name: user.displayName })} ) : ( {t('signedOut')} )}
); }