import { Link, useNavigate } from 'react-router-dom'
import { useAuthStore } from '../stores/auth.ts'
import { useThemeStore } from '../stores/theme.ts'
import { StoreIcon } from '../components/StoreIcon.tsx'
export function Settings() {
const user = useAuthStore((s) => s.user)
const logout = useAuthStore((s) => s.logout)
const navigate = useNavigate()
const { theme, setTheme } = useThemeStore()
const connectedStores = user?.connectedStores ?? []
function handleSignOut() {
logout()
navigate('/login')
}
return (
Settings
{/* Profile section */}
Profile
{user?.name?.charAt(0) ?? '?'}
{user?.name ?? 'Guest'}
{user?.email ?? ''}
{/* Connected stores */}
Connected Stores
{connectedStores.length > 0 ? (
{connectedStores.map((storeId) => (
{storeId}
Connected
))}
) : (
)}
{connectedStores.length > 0 ? 'Manage Stores' : 'Connect a Store'}
{/* Notifications */}
{/* Appearance */}
Appearance
{(['light', 'dark', 'system'] as const).map((t) => (
))}
{/* Account actions */}
)
}
function SettingsToggle({
label,
defaultChecked = false,
}: {
label: string
defaultChecked?: boolean
}) {
return (
)
}