feat(ui): implement design tokens and mobile-first adaptive navigation shell
This commit is contained in:
parent
8e7efcc1d1
commit
029c32e022
@ -1,3 +1,5 @@
|
||||
import { COMMON_CSS } from "./CommonStyles.ts";
|
||||
|
||||
export const AdminLayout = ({
|
||||
children,
|
||||
title,
|
||||
@ -7,8 +9,7 @@ export const AdminLayout = ({
|
||||
title: string;
|
||||
currentPath: string;
|
||||
}) => {
|
||||
const navItems = [
|
||||
{ label: "← User Dashboard", href: "/dashboard" },
|
||||
const adminNavItems = [
|
||||
{ label: "Users", href: "/admin/users" },
|
||||
{ label: "Applications", href: "/admin/apps" },
|
||||
{ label: "Roles", href: "/admin/roles" },
|
||||
@ -21,167 +22,200 @@ export const AdminLayout = ({
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#0f172a" />
|
||||
<title>{title} - Auth-Yes Admin</title>
|
||||
<style>
|
||||
{`
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background: #f4f6f8;
|
||||
margin: 0;
|
||||
${COMMON_CSS}
|
||||
|
||||
.admin-shell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.header {
|
||||
background: #343a40;
|
||||
color: white;
|
||||
border-bottom: 1px solid #23272b;
|
||||
padding: 1rem 2rem;
|
||||
|
||||
/* Admin Top Header */
|
||||
.admin-header {
|
||||
background-color: var(--surface-card);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
padding: 0.75rem 1.25rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
color: #ffffff;
|
||||
}
|
||||
.nav {
|
||||
|
||||
.admin-brand {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
.nav a {
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
text-decoration: none;
|
||||
color: #adb5bd;
|
||||
font-weight: 500;
|
||||
padding: 0.5rem 0;
|
||||
color: var(--text-primary);
|
||||
font-weight: 700;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.nav a:hover {
|
||||
color: #ffffff;
|
||||
|
||||
.admin-badge {
|
||||
background-color: #0f172a;
|
||||
color: #38bdf8;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.nav a.active {
|
||||
color: #ffffff;
|
||||
border-bottom: 2px solid #ffffff;
|
||||
|
||||
/* Sub-Navigation Pill Strip */
|
||||
.admin-nav-bar {
|
||||
background-color: var(--surface-card);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
padding: 0.5rem 1.25rem;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.main-content {
|
||||
|
||||
.admin-nav-bar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.admin-nav-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.4rem 0.85rem;
|
||||
border-radius: var(--radius-full);
|
||||
text-decoration: none;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
border: 1px solid transparent;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.admin-nav-item:hover {
|
||||
background-color: var(--surface-muted);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.admin-nav-item.active {
|
||||
background-color: var(--primary-light);
|
||||
color: var(--primary);
|
||||
border-color: var(--primary-ring);
|
||||
}
|
||||
|
||||
/* Admin Main Container */
|
||||
.admin-main-content {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
padding: 1.5rem 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.card {
|
||||
background: white;
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||
margin-bottom: 1.5rem;
|
||||
border: 1px solid #e9ecef;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.admin-header {
|
||||
padding: 0.75rem 2rem;
|
||||
}
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
color: #343a40;
|
||||
font-size: 1.25rem;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding-bottom: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
.admin-nav-bar {
|
||||
padding: 0.5rem 2rem;
|
||||
}
|
||||
.admin-main-content {
|
||||
padding: 2.5rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Table Styles */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 0.75rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.85rem 1rem;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
th {
|
||||
background: #f8f9fa;
|
||||
background-color: var(--surface-muted);
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
}
|
||||
.btn-action {
|
||||
background: #e9ecef;
|
||||
color: #495057;
|
||||
border: 1px solid #ced4da;
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
margin-right: 0.5rem;
|
||||
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
.btn-action:hover {
|
||||
background: #dee2e6;
|
||||
}
|
||||
.btn-success {
|
||||
background: #28a745;
|
||||
color: white;
|
||||
border: 1px solid #28a745;
|
||||
}
|
||||
.btn-success:hover { background: #218838; }
|
||||
.btn-warning {
|
||||
background: #ffc107;
|
||||
color: #212529;
|
||||
border: 1px solid #ffc107;
|
||||
}
|
||||
.btn-warning:hover { background: #e0a800; }
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 0.25em 0.4em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.badge-active { background-color: #28a745; color: white; }
|
||||
.badge-pending { background-color: #ffc107; color: #212529; }
|
||||
.badge-suspended { background-color: #dc3545; color: white; }
|
||||
pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; font-size: 0.8rem; }
|
||||
`}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<div style="display: flex; align-items: center; gap: 2rem;">
|
||||
<h1>Auth-Yes Admin Console</h1>
|
||||
<nav class="nav">
|
||||
{navItems.map((item) => {
|
||||
const isActive = currentPath === item.href;
|
||||
return (
|
||||
<a
|
||||
href={item.href}
|
||||
class={isActive ? "active" : ""}
|
||||
>
|
||||
{item.label}
|
||||
<div class="admin-shell">
|
||||
{/* Top Header */}
|
||||
<header class="admin-header">
|
||||
<div style="display: flex; align-items: center; gap: 0.75rem;">
|
||||
<a href="/dashboard" class="admin-brand">
|
||||
<span>Auth-Yes</span>
|
||||
<span class="admin-badge">Admin</span>
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
<div style="display: flex; align-items: center; gap: 1rem;">
|
||||
|
||||
<div style="display: flex; align-items: center; gap: 0.75rem;">
|
||||
<a
|
||||
href="/dashboard"
|
||||
class="btn-outline"
|
||||
style="padding: 0.35rem 0.75rem; font-size: 0.85rem; min-height: 36px; text-decoration: none;"
|
||||
>
|
||||
← User Hub
|
||||
</a>
|
||||
<a
|
||||
href="/logout"
|
||||
class="btn-action btn-warning"
|
||||
style="text-decoration: none; padding: 0.35rem 0.8rem; font-size: 0.85rem; border-radius: 4px;"
|
||||
class="btn-danger"
|
||||
style="padding: 0.35rem 0.75rem; font-size: 0.85rem; min-height: 36px; text-decoration: none;"
|
||||
>
|
||||
Logout
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="main-content">
|
||||
{/* Sub-Nav Scroller */}
|
||||
<nav class="admin-nav-bar">
|
||||
{adminNavItems.map((item) => {
|
||||
const isActive = currentPath === item.href ||
|
||||
currentPath.startsWith(item.href + "/");
|
||||
|
||||
return (
|
||||
<a
|
||||
href={item.href}
|
||||
class={`admin-nav-item ${isActive ? "active" : ""}`}
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
{/* Main Content */}
|
||||
<main class="admin-main-content">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { COMMON_CSS } from "./CommonStyles.ts";
|
||||
|
||||
export const AuthenticatedLayout = ({
|
||||
children,
|
||||
title,
|
||||
@ -10,151 +12,243 @@ export const AuthenticatedLayout = ({
|
||||
isAdmin?: boolean;
|
||||
}) => {
|
||||
const navItems = [
|
||||
{ label: "Launchpad", href: "/dashboard" },
|
||||
{ label: "Sessions", href: "/dashboard/sessions" },
|
||||
{ label: "Passkeys", href: "/dashboard/passkeys" },
|
||||
...(isAdmin ? [{ label: "Admin Console", href: "/admin/users" }] : []),
|
||||
{
|
||||
label: "Launchpad",
|
||||
href: "/dashboard",
|
||||
icon:
|
||||
`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"></path><path d="m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"></path><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"></path><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"></path></svg>`,
|
||||
},
|
||||
{
|
||||
label: "Sessions",
|
||||
href: "/dashboard/sessions",
|
||||
icon:
|
||||
`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="14" x="2" y="3" rx="2"></rect><line x1="8" x2="16" y1="21" y2="21"></line><line x1="12" x2="12" y1="17" y2="21"></line></svg>`,
|
||||
},
|
||||
{
|
||||
label: "Passkeys",
|
||||
href: "/dashboard/passkeys",
|
||||
icon:
|
||||
`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="7.5" cy="15.5" r="5.5"></circle><path d="m21 2-9.6 9.6"></path><path d="m15.5 7.5 3 3L22 7l-3-3"></path></svg>`,
|
||||
},
|
||||
...(isAdmin
|
||||
? [{
|
||||
label: "Admin",
|
||||
href: "/admin/users",
|
||||
icon:
|
||||
`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path></svg>`,
|
||||
}]
|
||||
: []),
|
||||
];
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#0066cc" />
|
||||
<title>{title} - Auth-Yes</title>
|
||||
<style>
|
||||
{`
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background: #f8f9fa;
|
||||
margin: 0;
|
||||
${COMMON_CSS}
|
||||
|
||||
/* Layout Shell */
|
||||
.app-shell {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.header {
|
||||
background: #ffffff;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding: 1rem 2rem;
|
||||
|
||||
/* Top App Bar */
|
||||
.top-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 40;
|
||||
background-color: var(--surface-card);
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
padding: 0.75rem 1.25rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
color: #212529;
|
||||
}
|
||||
.nav {
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
.nav a {
|
||||
align-items: center;
|
||||
gap: 0.65rem;
|
||||
text-decoration: none;
|
||||
color: #495057;
|
||||
color: var(--text-primary);
|
||||
font-weight: 700;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.brand-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: var(--primary);
|
||||
color: #ffffff;
|
||||
border-radius: var(--radius-sm);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
/* Desktop Navigation */
|
||||
.desktop-nav {
|
||||
display: none;
|
||||
gap: 0.5rem;
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
.desktop-nav a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.5rem 0.9rem;
|
||||
border-radius: var(--radius-md);
|
||||
text-decoration: none;
|
||||
color: var(--text-secondary);
|
||||
font-weight: 500;
|
||||
padding: 0.5rem 0;
|
||||
font-size: 0.9rem;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
.nav a:hover {
|
||||
color: #007bff;
|
||||
|
||||
.desktop-nav a:hover {
|
||||
background-color: var(--surface-muted);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.nav a.active {
|
||||
color: #007bff;
|
||||
border-bottom: 2px solid #007bff;
|
||||
|
||||
.desktop-nav a.active {
|
||||
background-color: var(--primary-light);
|
||||
color: var(--primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
.logout-btn {
|
||||
background: none;
|
||||
border: 1px solid #dc3545;
|
||||
color: #dc3545;
|
||||
padding: 0.4rem 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.logout-btn:hover {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
|
||||
.logout-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.45rem 0.85rem;
|
||||
border-radius: var(--radius-md);
|
||||
text-decoration: none;
|
||||
color: var(--danger);
|
||||
font-weight: 600;
|
||||
font-size: 0.85rem;
|
||||
border: 1px solid var(--danger-border);
|
||||
background: var(--danger-bg);
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.logout-link:hover {
|
||||
background: var(--danger);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Main Content Container */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
padding: 1.5rem 1rem calc(5.5rem + env(safe-area-inset-bottom)) 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.card {
|
||||
background: white;
|
||||
padding: 1.5rem;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||
margin-bottom: 1.5rem;
|
||||
border: 1px solid #e9ecef;
|
||||
|
||||
/* Mobile Bottom Navigation Bar */
|
||||
.mobile-bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 50;
|
||||
background-color: var(--surface-card);
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom)) 0;
|
||||
box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
color: #343a40;
|
||||
font-size: 1.25rem;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
padding-bottom: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
.mobile-bottom-nav a {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.2rem;
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
padding: 0.35rem 0.75rem;
|
||||
border-radius: var(--radius-md);
|
||||
transition: all 0.15s ease;
|
||||
min-width: 64px;
|
||||
}
|
||||
|
||||
.mobile-bottom-nav a.active {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.mobile-bottom-nav a.active svg {
|
||||
stroke: var(--primary);
|
||||
}
|
||||
|
||||
/* Desktop Responsive Rules */
|
||||
@media (min-width: 768px) {
|
||||
.desktop-nav {
|
||||
display: flex;
|
||||
}
|
||||
.mobile-bottom-nav {
|
||||
display: none;
|
||||
}
|
||||
.main-content {
|
||||
padding: 2.5rem 2rem;
|
||||
}
|
||||
.top-bar {
|
||||
padding: 0.75rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tables Responsive Scroller */
|
||||
.table-container {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 0.75rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
th {
|
||||
background: #f8f9fa;
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #c82333;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
th, td {
|
||||
padding: 0.85rem 1rem;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #0069d9;
|
||||
|
||||
th {
|
||||
background-color: var(--surface-muted);
|
||||
color: var(--text-secondary);
|
||||
font-weight: 600;
|
||||
}
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 0.25em 0.4em;
|
||||
font-size: 75%;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
border-radius: 0.25rem;
|
||||
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
.badge-success { background-color: #28a745; color: white; }
|
||||
.badge-info { background-color: #17a2b8; color: white; }
|
||||
.badge-secondary { background-color: #6c757d; color: white; }
|
||||
`}
|
||||
</style>
|
||||
<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.umd.min.js">
|
||||
@ -162,9 +256,17 @@ export const AuthenticatedLayout = ({
|
||||
<script src="/public/auth-client.js?v=5"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<h1>Identity Provider</h1>
|
||||
<nav class="nav">
|
||||
<div class="app-shell">
|
||||
{/* Top Header */}
|
||||
<header class="top-bar">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<a href="/dashboard" class="brand">
|
||||
<span class="brand-badge">AY</span>
|
||||
<span>Auth-Yes</span>
|
||||
</a>
|
||||
|
||||
{/* Desktop Nav Links */}
|
||||
<nav class="desktop-nav">
|
||||
{navItems.map((item) => {
|
||||
const isActive = item.href === "/dashboard"
|
||||
? currentPath === "/dashboard"
|
||||
@ -176,45 +278,73 @@ export const AuthenticatedLayout = ({
|
||||
href={item.href}
|
||||
class={isActive ? "active" : ""}
|
||||
>
|
||||
{item.label}
|
||||
<span dangerouslySetInnerHTML={{ __html: item.icon }} />
|
||||
<span>{item.label}</span>
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<div
|
||||
style={{
|
||||
marginLeft: "auto",
|
||||
marginRight: "1rem",
|
||||
display: "flex",
|
||||
gap: "1rem",
|
||||
}}
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="header-actions">
|
||||
{isAdmin && (
|
||||
<a
|
||||
href="/admin"
|
||||
href="/admin/users"
|
||||
class="btn-primary"
|
||||
style={{ textDecoration: "none" }}
|
||||
style="padding: 0.4rem 0.85rem; font-size: 0.85rem; min-height: 36px; text-decoration: none;"
|
||||
>
|
||||
Admin Console
|
||||
</a>
|
||||
)}
|
||||
<a
|
||||
href="/logout"
|
||||
class="logout-btn"
|
||||
style={{
|
||||
textDecoration: "none",
|
||||
display: "inline-block",
|
||||
textAlign: "center",
|
||||
}}
|
||||
class="logout-link"
|
||||
title="Sign out of your session"
|
||||
>
|
||||
Logout
|
||||
<svg
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
|
||||
<polyline points="16 17 21 12 16 7"></polyline>
|
||||
<line x1="21" x2="9" y1="12" y2="12"></line>
|
||||
</svg>
|
||||
<span>Logout</span>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* Main Body */}
|
||||
<main class="main-content">
|
||||
{children}
|
||||
</main>
|
||||
|
||||
{/* Mobile Bottom Navigation Bar */}
|
||||
<nav class="mobile-bottom-nav">
|
||||
{navItems.map((item) => {
|
||||
const isActive = item.href === "/dashboard"
|
||||
? currentPath === "/dashboard"
|
||||
: currentPath.startsWith(item.href) &&
|
||||
item.href !== "/dashboard";
|
||||
|
||||
return (
|
||||
<a
|
||||
href={item.href}
|
||||
class={isActive ? "active" : ""}
|
||||
>
|
||||
<span dangerouslySetInnerHTML={{ __html: item.icon }} />
|
||||
<span>{item.label}</span>
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
186
ui/components/CommonStyles.ts
Normal file
186
ui/components/CommonStyles.ts
Normal file
@ -0,0 +1,186 @@
|
||||
export const COMMON_CSS = `
|
||||
:root {
|
||||
/* Brand & Accents */
|
||||
--primary: #0066cc;
|
||||
--primary-hover: #0052a3;
|
||||
--primary-active: #003d7a;
|
||||
--primary-light: #e6f0fa;
|
||||
--primary-ring: rgba(0, 102, 204, 0.25);
|
||||
|
||||
/* Neutrals & Surfaces */
|
||||
--surface-canvas: #f8fafc;
|
||||
--surface-card: #ffffff;
|
||||
--surface-muted: #f1f5f9;
|
||||
--border-subtle: #e2e8f0;
|
||||
--border-strong: #cbd5e1;
|
||||
|
||||
/* Typography */
|
||||
--text-primary: #0f172a;
|
||||
--text-secondary: #475569;
|
||||
--text-muted: #94a3b8;
|
||||
|
||||
/* Semantic Feedback */
|
||||
--success: #10b981;
|
||||
--success-bg: #ecfdf5;
|
||||
--success-border: #a7f3d0;
|
||||
--success-text: #065f46;
|
||||
--warning: #f59e0b;
|
||||
--warning-bg: #fffbeb;
|
||||
--warning-border: #fde68a;
|
||||
--warning-text: #92400e;
|
||||
--danger: #ef4444;
|
||||
--danger-bg: #fef2f2;
|
||||
--danger-border: #fecaca;
|
||||
--danger-text: #991b1b;
|
||||
--info: #0284c7;
|
||||
--info-bg: #f0f9ff;
|
||||
--info-border: #bae6fd;
|
||||
--info-text: #0369a1;
|
||||
|
||||
/* Geometry & Spacing */
|
||||
--radius-sm: 6px;
|
||||
--radius-md: 10px;
|
||||
--radius-lg: 16px;
|
||||
--radius-full: 9999px;
|
||||
--touch-target-min: 48px;
|
||||
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
||||
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
||||
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--surface-canvas: #0b0f19;
|
||||
--surface-card: #111827;
|
||||
--surface-muted: #1e293b;
|
||||
--border-subtle: #1f2937;
|
||||
--border-strong: #374151;
|
||||
|
||||
--text-primary: #f8fafc;
|
||||
--text-secondary: #cbd5e1;
|
||||
--text-muted: #64748b;
|
||||
|
||||
--primary-light: #172554;
|
||||
--success-bg: #064e3b;
|
||||
--success-border: #065f46;
|
||||
--success-text: #6ee7b7;
|
||||
--warning-bg: #451a03;
|
||||
--warning-border: #78350f;
|
||||
--warning-text: #fcd34d;
|
||||
--danger-bg: #450a0a;
|
||||
--danger-border: #7f1d1d;
|
||||
--danger-text: #fca5a5;
|
||||
--info-bg: #082f49;
|
||||
--info-border: #075985;
|
||||
--info-text: #7dd3fc;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background-color: var(--surface-canvas);
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Common interactive components */
|
||||
button, .btn {
|
||||
font-family: inherit;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
min-height: 44px;
|
||||
padding: 0.6rem 1.2rem;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
transition: all 0.15s ease-in-out;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
button:active, .btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--primary);
|
||||
color: #ffffff;
|
||||
border-color: var(--primary);
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background-color: var(--primary-hover);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--danger);
|
||||
color: #ffffff;
|
||||
border-color: var(--danger);
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background-color: #dc2626;
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background-color: transparent;
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-strong);
|
||||
}
|
||||
.btn-outline:hover {
|
||||
background-color: var(--surface-muted);
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
font-family: inherit;
|
||||
font-size: 1rem;
|
||||
min-height: 48px;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-subtle);
|
||||
background-color: var(--surface-card);
|
||||
color: var(--text-primary);
|
||||
width: 100%;
|
||||
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px var(--primary-ring);
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: var(--surface-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 1.5rem;
|
||||
box-shadow: var(--shadow-sm);
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.25rem 0.65rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
border-radius: var(--radius-full);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.badge-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
|
||||
.badge-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
|
||||
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
|
||||
.badge-info { background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-border); }
|
||||
.badge-secondary { background: var(--surface-muted); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
|
||||
`;
|
||||
@ -1,3 +1,5 @@
|
||||
import { COMMON_CSS } from "./CommonStyles.ts";
|
||||
|
||||
export const Layout = ({
|
||||
children,
|
||||
title,
|
||||
@ -9,28 +11,117 @@ export const Layout = ({
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{title}</title>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<meta name="theme-color" content="#0066cc" />
|
||||
<title>{title} - Auth-Yes</title>
|
||||
<style>
|
||||
{`
|
||||
body { font-family: sans-serif; background: #f4f4f9; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
|
||||
.container { background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
|
||||
h1 { font-size: 1.5rem; margin-bottom: 1rem; color: #333; text-align: center; }
|
||||
input { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
|
||||
button { width: 100%; padding: 0.75rem; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }
|
||||
button:hover { background: #0056b3; }
|
||||
.error { color: red; font-size: 0.875rem; margin-top: 0.5rem; text-align: center; }
|
||||
.success { color: green; font-size: 0.875rem; margin-top: 0.5rem; text-align: center; }
|
||||
.links { margin-top: 1rem; text-align: center; font-size: 0.875rem; }
|
||||
.links a { color: #007bff; text-decoration: none; }
|
||||
.links a:hover { text-decoration: underline; }
|
||||
${COMMON_CSS}
|
||||
|
||||
.auth-layout-wrapper {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 1.5rem 1rem;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
background-color: var(--surface-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 2.25rem 1.75rem;
|
||||
box-shadow: var(--shadow-md);
|
||||
width: 100%;
|
||||
max-width: 440px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.brand-header {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.brand-logo {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: var(--primary-light);
|
||||
color: var(--primary);
|
||||
border-radius: var(--radius-md);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 0.5rem 0;
|
||||
color: var(--text-primary);
|
||||
letter-spacing: -0.025em;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.95rem;
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--danger);
|
||||
background-color: var(--danger-bg);
|
||||
border: 1px solid var(--danger-border);
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
margin-top: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: var(--success-text);
|
||||
background-color: var(--success-bg);
|
||||
border: 1px solid var(--success-border);
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
margin-top: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.links {
|
||||
margin-top: 1.75rem;
|
||||
text-align: center;
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.links a {
|
||||
color: var(--primary);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<script src="https://unpkg.com/@simplewebauthn/browser/dist/bundle/index.umd.min.js">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">{children}</div>
|
||||
<div class="auth-layout-wrapper">
|
||||
<div class="auth-card">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user