allauth/ (44 files) is a django-allauth React UI — a separate concern from the Mizan protocol. Moved to legacy/ pending extraction into a standalone mizan-django-allauth package. Also moved to legacy/: - client/AuthContext.tsx — generic auth state from /me endpoint - client/RouterContext.tsx — framework-agnostic router adapter - client/routing.tsx — UserRoute/StaffRoute/AnonymousRoute guards - client/nextjs.tsx — Next.js router adapter for auth These are auth UI infrastructure, not Mizan protocol. The Mizan core only needs JWT for auth header selection (jwt/ stays — MizanProvider depends on useJWT() to decide between Bearer and session auth). Cleaned up re-exports in client/react.ts and vitest aliases. 33 React tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
'use client'
|
|
|
|
import { useStyles, cx } from '../../contexts/StylesContext'
|
|
|
|
interface SettingsSectionProps {
|
|
title: string
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export function SettingsSection({ title, children }: SettingsSectionProps) {
|
|
const styles = useStyles()
|
|
return (
|
|
<section className={styles.settingsCard}>
|
|
<h2 className={styles.settingsSectionTitle}>{title}</h2>
|
|
{children}
|
|
</section>
|
|
)
|
|
}
|
|
|
|
interface SettingsItemProps {
|
|
label: React.ReactNode
|
|
meta?: React.ReactNode
|
|
actions?: React.ReactNode
|
|
}
|
|
|
|
export function SettingsItem({ label, meta, actions }: SettingsItemProps) {
|
|
const styles = useStyles()
|
|
return (
|
|
<div className={styles.settingsItem}>
|
|
<div className={styles.settingsItemInfo}>
|
|
<span className={styles.settingsItemLabel}>{label}</span>
|
|
{meta && <span className={styles.settingsItemMeta}>{meta}</span>}
|
|
</div>
|
|
{actions && <div className={styles.settingsItemActions}>{actions}</div>}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function SettingsList({ children }: { children: React.ReactNode }) {
|
|
const styles = useStyles()
|
|
return <div className={styles.settingsList}>{children}</div>
|
|
}
|
|
|
|
type BadgeVariant = 'primary' | 'success' | 'warning' | 'danger'
|
|
|
|
export function Badge({ variant, children }: { variant: BadgeVariant, children: React.ReactNode }) {
|
|
const styles = useStyles()
|
|
const variantClass = {
|
|
primary: styles.badgePrimary,
|
|
success: styles.badgeSuccess,
|
|
warning: styles.badgeUnverified,
|
|
danger: styles.badgeDanger,
|
|
}[variant]
|
|
|
|
return <span className={cx(styles.badge, variantClass)}>{children}</span>
|
|
}
|
|
|
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
variant?: 'primary' | 'secondary' | 'danger'
|
|
size?: 'small' | 'normal'
|
|
}
|
|
|
|
export function Button({ variant = 'primary', size = 'small', className, children, ...props }: ButtonProps) {
|
|
const styles = useStyles()
|
|
const variantClass = {
|
|
primary: styles.smallButtonPrimary,
|
|
secondary: styles.smallButtonSecondary,
|
|
danger: styles.smallButtonDanger,
|
|
}[variant]
|
|
|
|
return (
|
|
<button className={cx(styles.smallButton, variantClass, className)} {...props}>
|
|
{children}
|
|
</button>
|
|
)
|
|
}
|