- Convert getRouter, OrderingPage, and OrderStatusRoute from function declarations to arrow functions - Migrate header-user.tsx off raw Tailwind classes onto a co-located SCSS module, and remove Tailwind entirely (deps, Vite plugin, styles.css) since it was the only consumer and duplicated the documented SCSS Modules system - Fix CLAUDE.md's stale ~/ alias example and structure diagram to match the project's actual #/ and @/ aliases and directories Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
38 lines
912 B
TypeScript
38 lines
912 B
TypeScript
import { authClient } from '#/lib/auth-client'
|
|
|
|
import styles from './header-user.module.scss'
|
|
|
|
const BetterAuthHeader = () => {
|
|
const { data: session, isPending } = authClient.useSession()
|
|
|
|
if (isPending) {
|
|
return <div className={`${styles.avatar} ${styles.avatarPulse}`} />
|
|
}
|
|
|
|
if (session?.user) {
|
|
return (
|
|
<div className={styles.session}>
|
|
{session.user.image ? (
|
|
<img src={session.user.image} alt="" className={styles.avatar} />
|
|
) : (
|
|
<div className={`${styles.avatar} ${styles.avatarInitial}`}>
|
|
<span>{session.user.name.charAt(0).toUpperCase() || 'U'}</span>
|
|
</div>
|
|
)}
|
|
<button
|
|
onClick={() => {
|
|
void authClient.signOut()
|
|
}}
|
|
className={styles.signOut}
|
|
>
|
|
Sign out
|
|
</button>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
export default BetterAuthHeader
|