'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useState } from 'react';
import { client, useMe } from '@/lib/api';
import { ActivityBell } from './ActivityBell';
/** Top bar: logo and the four main places. On phones those move to a bottom tab bar; wide screens use Shell's sidebar. */
export function Nav() {
const { me } = useMe();
const path = usePathname();
const tabs = me
? [
{ href: '/', label: 'Feed', icon: , active: path === '/' },
{ href: '/friends', label: 'Friends', icon: , active: path.startsWith('/friends') },
{ href: `/u/${me.username}`, label: 'Profile', icon: , active: path.startsWith(`/u/${me.username}`) },
{ href: '/settings', label: 'Settings', icon: , active: path.startsWith('/settings') || path === '/admin' },
]
: [];
return (
<>
{me && (
)}
{me && !me.emailVerified && }
>
);
}
/** Until they confirm, a forgotten password can't be reset; nudge them. */
function VerifyBanner({ email }: { email: string }) {
const [sent, setSent] = useState(false);
const resend = async () => {
try {
await client.resendVerification();
setSent(true);
} catch (err) {
alert((err as Error).message);
}
};
return (
Confirm your email: we sent a link to {email}.{' '}
{sent ? (
Sent again.
) : (
)}
);
}
const icon = { width: 22, height: 22, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round' } as const;
export const FeedIcon = () => (
);
export const FriendsIcon = () => (
);
export const ProfileIcon = () => (
);
export const SettingsIcon = () => (
);