import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Link, NavLink } from 'react-router'
import { useSession } from '../../features/auth/session'
import { LanguageSwitch } from '../i18n/LanguageSwitch'
import type { Me } from '../types'
import { ButtonLink } from '../ui/Button'
export function TopBar() {
const { t } = useTranslation(['common', 'download'])
const [open, setOpen] = useState(false)
const nav = [
{ to: '/showcase', label: t('nav.showcase') },
{ to: '/configs', label: t('nav.myConfigs') },
{ to: '/link', label: t('nav.linkGame') },
]
return (
LoVisual
{t('download:nav')}
)
}
function AccountButton() {
const { t } = useTranslation('common')
const { status, me } = useSession()
if (status === 'loading') return null
if (!me) {
return (
{t('nav.login')}
)
}
return (
{me.display_nick}
)
}
function Avatar({ me }: { me: Me }) {
if (me.avatar_url) {
return
}
return (
{me.display_nick.charAt(0).toUpperCase()}
)
}