Backend: add autoSignup field to OidcConfig, ClickHouse schema, repository, and admin controller. Gate OIDC login when auto-signup is disabled and user is not pre-created (returns 403). Frontend: add OIDC admin page with full CRUD (save/test/delete), role-gated Admin nav link parsed from JWT, and matching design system styles. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { NavLink } from 'react-router';
|
|
import { useThemeStore } from '../../theme/theme-store';
|
|
import { useAuthStore } from '../../auth/auth-store';
|
|
import styles from './TopNav.module.css';
|
|
|
|
export function TopNav() {
|
|
const { theme, toggle } = useThemeStore();
|
|
const { username, roles, logout } = useAuthStore();
|
|
|
|
return (
|
|
<nav className={styles.topnav}>
|
|
<NavLink to="/" className={styles.logo}>
|
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2" />
|
|
<path d="M12 6v6l4 2" />
|
|
</svg>
|
|
cameleer3
|
|
</NavLink>
|
|
|
|
<ul className={styles.navLinks}>
|
|
<li>
|
|
<NavLink to="/executions" className={({ isActive }) => isActive ? styles.navLinkActive : styles.navLink}>
|
|
Transactions
|
|
</NavLink>
|
|
</li>
|
|
{roles.includes('ADMIN') && (
|
|
<li>
|
|
<NavLink to="/admin/oidc" className={({ isActive }) => isActive ? styles.navLinkActive : styles.navLink}>
|
|
Admin
|
|
</NavLink>
|
|
</li>
|
|
)}
|
|
</ul>
|
|
|
|
<div className={styles.navRight}>
|
|
<span className={styles.envBadge}>{import.meta.env.VITE_ENV_NAME || 'DEV'}</span>
|
|
<button className={styles.themeToggle} onClick={toggle} title="Toggle theme">
|
|
{theme === 'dark' ? '\u2600\uFE0F' : '\uD83C\uDF19'}
|
|
</button>
|
|
{username && (
|
|
<span className={styles.userInfo}>
|
|
{username}
|
|
<button className={styles.logoutBtn} onClick={logout} title="Sign out">
|
|
✕
|
|
</button>
|
|
</span>
|
|
)}
|
|
</div>
|
|
</nav>
|
|
);
|
|
}
|