Display user's name instead of email in profile button

- Add name field to auth login/register responses
- Update User interface in AuthContext to include name
- Show name (or email as fallback) in navbar dropdown

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-21 22:17:36 -05:00
parent 5a048aefd6
commit 2ecb02677e
3 changed files with 5 additions and 2 deletions

View file

@ -69,6 +69,7 @@ router.post('/register', async (req: Request, res: Response) => {
user: { user: {
id: user.id, id: user.id,
email: user.email, email: user.email,
name: user.name || null,
}, },
}); });
} catch (error) { } catch (error) {
@ -107,6 +108,7 @@ router.post('/login', async (req: Request, res: Response) => {
user: { user: {
id: user.id, id: user.id,
email: user.email, email: user.email,
name: user.name || null,
}, },
}); });
} catch (error) { } catch (error) {

View file

@ -262,9 +262,9 @@ export default function Layout({ children }: LayoutProps) {
onClick={() => setIsDropdownOpen(!isDropdownOpen)} onClick={() => setIsDropdownOpen(!isDropdownOpen)}
> >
<span className="user-dropdown-avatar"> <span className="user-dropdown-avatar">
{user.email.charAt(0).toUpperCase()} {(user.name || user.email).charAt(0).toUpperCase()}
</span> </span>
<span className="user-dropdown-email">{user.email}</span> <span className="user-dropdown-email">{user.name || user.email}</span>
<svg <svg
className="user-dropdown-arrow" className="user-dropdown-arrow"
width="12" width="12"

View file

@ -10,6 +10,7 @@ import { authApi } from '../api/client';
interface User { interface User {
id: number; id: number;
email: string; email: string;
name: string | null;
} }
interface AuthContextType { interface AuthContextType {