Redesign admin sidebar, profile and settings pages
This commit is contained in:
parent
3668967ac4
commit
b33b05c711
53
src/components/profile/profile.css
Normal file
53
src/components/profile/profile.css
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
.profile-page { --profile-accent: #6744b5; --profile-tint: #f0ecf8; color: #303346; padding-bottom: 12px; }
|
||||
.admin-app .profile-page .profile-hero, .admin-app .profile-page .profile-card { border: 1px solid #e5e3e8; border-radius: 8px; background: #fff; box-shadow: 0 2px 8px #24203603; }
|
||||
.profile-hero-main { display: flex; align-items: flex-start; gap: 22px; padding: 26px; }
|
||||
.profile-hero-main button[aria-label="Upload profile picture"] { width: 104px; height: 104px; border: 0; border-radius: 9px; box-shadow: none; }
|
||||
.profile-hero-main button[aria-label="Upload profile picture"] > span { border-radius: 9px; }
|
||||
.admin-app .profile-page .profile-name { font-family: inherit; font-size: 20px; font-weight: 700; line-height: 1.4; letter-spacing: -.035em; }
|
||||
.profile-role { padding: 4px 8px; border-radius: 4px; background: var(--profile-tint); color: var(--profile-accent); font-size: 10px; font-weight: 600; }
|
||||
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: #858594; font-size: 11px; }
|
||||
.profile-meta > span { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
|
||||
.profile-meta svg { width: 12px; height: 12px; flex-shrink: 0; }
|
||||
.profile-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
|
||||
.profile-facts > div { display: flex; gap: 9px; align-items: center; padding: 9px 12px; border: 1px solid #e9e6ee; border-radius: 5px; }
|
||||
.profile-facts svg { width: 18px; height: 18px; color: var(--profile-accent); }
|
||||
.profile-facts strong { display: block; font-size: 11px; font-weight: 600; }
|
||||
.profile-facts small { display: block; margin-top: 2px; font-size: 10px; color: #93909b; }
|
||||
.admin-app .profile-page .profile-edit { height: 34px; flex-shrink: 0; gap: 7px; background: var(--profile-accent); color: #fff; border: 0; border-radius: 5px; font-size: 11px; box-shadow: none; }
|
||||
.admin-app .profile-page .profile-edit:hover { background: #55359c; }
|
||||
.profile-tabs { display: flex; gap: 24px; overflow-x: auto; padding: 0 26px; border-top: 1px solid #eeecf1; }
|
||||
.admin-app .profile-page .profile-tabs button { position: relative; white-space: nowrap; padding: 15px 0; border: 0; background: transparent; color: #858190; font-size: 11px; border-radius: 0; font-weight: 500; }
|
||||
.admin-app .profile-page .profile-tabs button[aria-pressed="true"] { color: #43336a; font-weight: 600; }
|
||||
.profile-tabs button[aria-pressed="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--profile-accent); }
|
||||
.profile-content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
|
||||
.profile-detail-rail { display: grid; gap: 20px; }
|
||||
.admin-app .profile-page .profile-card > div:first-child { padding: 20px 22px 14px; border: 0; }
|
||||
.admin-app .profile-page .profile-card > div:last-child { padding: 0 22px 22px; }
|
||||
.admin-app .profile-page .profile-card h3 { font-family: inherit; font-size: 13px; letter-spacing: 0; font-weight: 600; }
|
||||
.profile-section-description { margin-bottom: 22px; color: #95919e; font-size: 11px; line-height: 1.8; }
|
||||
.profile-field-value { overflow-wrap: anywhere; }
|
||||
.profile-bio { border-top: 1px solid #efedf2; padding-top: 20px; }
|
||||
.profile-activity-list > div { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 13px 0; border-top: 1px solid #efedf2; }
|
||||
.profile-activity-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: var(--profile-accent); background: var(--profile-tint); }
|
||||
.profile-completion-value { font-size: 32px; font-weight: 600; letter-spacing: -.05em; margin: 0 0 12px; }
|
||||
.profile-completion-value > span { font-size: 17px; color: #aaa2bc; margin-left: 3px; }
|
||||
.profile-completion-track { height: 6px; background: #eeeaf5; border-radius: 20px; overflow: hidden; }
|
||||
.profile-completion-track > span { display: block; height: 100%; background: var(--profile-accent); border-radius: inherit; }
|
||||
.profile-checklist { display: grid; gap: 12px; margin: 18px 0; font-size: 11px; color: #7c7788; }
|
||||
.profile-checklist li { display: flex; gap: 9px; align-items: center; }
|
||||
.profile-checklist li > span { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: #f2f0f5; color: #aaa4b5; }
|
||||
.profile-checklist li > .is-complete { background: #e1f4ee; color: #359887; }
|
||||
.admin-app .profile-page .profile-text-action { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; border-radius: 5px; background: var(--profile-tint); padding: 10px 12px; font-size: 11px; font-weight: 600; color: var(--profile-accent); }
|
||||
.profile-security-symbol { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: var(--profile-tint); color: var(--profile-accent); margin: 6px 0 18px; }
|
||||
.profile-security-status { display: flex; align-items: center; gap: 7px; border-top: 1px solid #efedf2; padding-top: 15px; color: #827b8b; font-size: 11px; }
|
||||
.profile-security-status > span { width: 6px; height: 6px; border-radius: 50%; background: #e6b54e; }
|
||||
.profile-security-status > .verified { background: #3ba591; }
|
||||
.profile-page button:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
|
||||
html.dark .profile-page { color: #e5e3ee; --profile-tint: #30283e; --profile-accent: #b69aea; }
|
||||
html.dark .admin-app .profile-page :is(.profile-card,.profile-hero) { background: #211f28; border-color: #38333f; }
|
||||
html.dark .profile-page :is(.profile-tabs,.profile-facts > div,.profile-bio,.profile-activity-list > div,.profile-security-status) { border-color: #38333f; }
|
||||
html.dark .admin-app .profile-page .profile-tabs button[aria-pressed="true"] { color: #c4afea; }
|
||||
html.dark .admin-app .profile-page .profile-edit { background: #7855b8; }
|
||||
@media (max-width: 1200px) { .profile-content-grid { grid-template-columns: minmax(0,1fr) 250px; } .profile-hero-main { gap: 16px; flex-wrap: wrap; } }
|
||||
@media (max-width: 767px) { .profile-content-grid { grid-template-columns: minmax(0,1fr); } .profile-hero-main { padding: 20px; } .profile-hero-main > .min-w-0 { flex-basis: calc(100% - 110px); } .profile-hero-main button[aria-label="Upload profile picture"] { width: 80px; height: 80px; } .profile-facts { margin-top: 14px; } .profile-facts > div { flex: 1; min-width: 110px; } .profile-tabs { padding: 0 20px; gap: 22px; } .profile-detail-rail { grid-template-columns: repeat(2,minmax(0,1fr)); } }
|
||||
@media (max-width: 480px) { .profile-detail-rail { grid-template-columns: minmax(0,1fr); } .profile-facts { flex-direction: column; } .profile-hero-main > .min-w-0 { flex-basis: 100%; } }
|
||||
|
|
@ -138,7 +138,7 @@ type SidebarProps = {
|
|||
|
||||
export function Sidebar({
|
||||
isOpen,
|
||||
isCollapsed,
|
||||
isCollapsed: desktopCollapsed,
|
||||
onToggleCollapse,
|
||||
onClose,
|
||||
}: SidebarProps) {
|
||||
|
|
@ -148,6 +148,15 @@ export function Sidebar({
|
|||
loading: permissionsLoading,
|
||||
} = useTeamPermissions();
|
||||
const [unreadCount, setUnreadCount] = useState(0);
|
||||
const [isDesktop, setIsDesktop] = useState(() => window.matchMedia("(min-width: 1024px)").matches);
|
||||
const isCollapsed = desktopCollapsed && isDesktop;
|
||||
|
||||
useEffect(() => {
|
||||
const media = window.matchMedia("(min-width: 1024px)");
|
||||
const update = () => setIsDesktop(media.matches);
|
||||
media.addEventListener("change", update);
|
||||
return () => media.removeEventListener("change", update);
|
||||
}, []);
|
||||
const { teamRole: sessionTeamRole } = useAdminAccess();
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -167,6 +176,15 @@ export function Sidebar({
|
|||
window.removeEventListener("notifications-updated", fetchUnread);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen || isDesktop) return;
|
||||
const closeOnEscape = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") onClose();
|
||||
};
|
||||
window.addEventListener("keydown", closeOnEscape);
|
||||
return () => window.removeEventListener("keydown", closeOnEscape);
|
||||
}, [isOpen, isDesktop, onClose]);
|
||||
|
||||
const unreadBadge = unreadCount > 0 && (
|
||||
<span className="ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-destructive px-1.5 text-[10px] font-bold text-white">
|
||||
{unreadCount > 99 ? "99+" : unreadCount}
|
||||
|
|
@ -189,11 +207,14 @@ export function Sidebar({
|
|||
/>
|
||||
|
||||
<aside
|
||||
aria-label="Admin sidebar"
|
||||
inert={!isDesktop && !isOpen}
|
||||
data-collapsed={isCollapsed}
|
||||
className={cn(
|
||||
"sidebar-shell group fixed left-0 top-0 z-50 flex h-screen flex-col border-r border-grayScale-200 py-5 transition-all duration-300 dark:border-grayScale-200/20",
|
||||
"w-[264px] px-4 lg:translate-x-0",
|
||||
isCollapsed && "lg:w-[88px] lg:px-2",
|
||||
isOpen ? "translate-x-0" : "-translate-x-full",
|
||||
isOpen ? "translate-x-0" : "-translate-x-[calc(100%+16px)]",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
|
|
@ -250,7 +271,7 @@ export function Sidebar({
|
|||
)}
|
||||
</div>
|
||||
|
||||
<nav className="mt-6 flex-1 space-y-0.5 overflow-y-auto scrollbar-none">
|
||||
<nav aria-label="Main navigation" className="mt-6 flex-1 space-y-0.5 overflow-y-auto scrollbar-none">
|
||||
{navEntries.map((entry, index) => {
|
||||
if (
|
||||
!isNavEntryAllowedForTeamRole(
|
||||
|
|
@ -278,7 +299,7 @@ export function Sidebar({
|
|||
return index > 0 ? (
|
||||
<div
|
||||
key={`section-gap-${entry.label}`}
|
||||
className="mx-auto my-2 h-px w-8 bg-grayScale-200 dark:bg-grayScale-200/20"
|
||||
className="sidebar-section-divider mx-auto my-2 h-px w-8 bg-grayScale-200 dark:bg-grayScale-200/20"
|
||||
aria-hidden
|
||||
/>
|
||||
) : null;
|
||||
|
|
@ -287,7 +308,7 @@ export function Sidebar({
|
|||
<p
|
||||
key={`section-${entry.label}`}
|
||||
className={cn(
|
||||
"mb-1 flex items-center gap-2 px-3 pt-4 text-[10px] font-bold uppercase tracking-[0.12em] text-grayScale-400 after:h-px after:flex-1 after:bg-grayScale-200 after:content-[''] dark:text-grayScale-400/70 dark:after:bg-grayScale-200/30",
|
||||
"sidebar-section mb-1 flex items-center gap-2 px-3 pt-4 text-[10px] font-bold uppercase tracking-[0.12em] text-grayScale-400 after:h-px after:flex-1 after:bg-grayScale-200 after:content-[''] dark:text-grayScale-400/70 dark:after:bg-grayScale-200/30",
|
||||
index === 0 && "pt-0",
|
||||
)}
|
||||
>
|
||||
|
|
@ -413,7 +434,7 @@ export function Sidebar({
|
|||
|
||||
<div
|
||||
className={cn(
|
||||
"border-t border-grayScale-200 px-2 pt-4 mt-4 dark:border-grayScale-200/20",
|
||||
"sidebar-footer border-t border-grayScale-200 px-2 pt-4 mt-4 dark:border-grayScale-200/20",
|
||||
isCollapsed && "border-t-0 px-0 mt-0 pt-2",
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
import { useTheme } from "../../contexts/ThemeContext.shared"
|
||||
import { BrandLogo } from "../brand/BrandLogo"
|
||||
import { Sparkles } from "lucide-react";
|
||||
import { BrandLogo } from "../brand/BrandLogo";
|
||||
|
||||
|
||||
type SidebarLogoProps = {
|
||||
collapsed: boolean
|
||||
}
|
||||
type SidebarLogoProps = { collapsed: boolean };
|
||||
|
||||
export function SidebarLogo({ collapsed }: SidebarLogoProps) {
|
||||
const { resolvedTheme } = useTheme()
|
||||
|
||||
if (collapsed) {
|
||||
return (
|
||||
<span className="flex h-10 w-10 items-center justify-center overflow-hidden rounded-full bg-brand-500">
|
||||
<BrandLogo variant="light" className="h-3" />
|
||||
return (
|
||||
<span className="sidebar-logo flex items-center gap-2.5" aria-label="Academy admin">
|
||||
<span className="sidebar-logo-mark grid h-9 w-9 shrink-0 place-items-center rounded-xl">
|
||||
<Sparkles className="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
return <BrandLogo variant={resolvedTheme === "dark" ? "light" : "dark"} />
|
||||
{!collapsed && <BrandLogo variant="light" className="h-7" />}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,21 +57,22 @@ export function SidebarNavGroup({
|
|||
<NavLink
|
||||
to={children[0]?.to ?? basePath}
|
||||
onClick={onNavigate}
|
||||
className={({ isActive }) =>
|
||||
data-accent={basePath === "/notifications" ? "cyan" : "mint"}
|
||||
className={() =>
|
||||
cn(
|
||||
"sidebar-nav-item relative group flex items-center justify-center rounded-xl p-2 text-sm font-medium text-grayScale-600 transition",
|
||||
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
|
||||
isActive &&
|
||||
isSectionActive &&
|
||||
"sidebar-nav-item-active bg-brand-500/10 text-brand-600 hover:bg-brand-500/10 hover:text-brand-600 dark:bg-brand-500/15 dark:text-brand-400 dark:hover:bg-brand-500/15 dark:hover:text-brand-400",
|
||||
)
|
||||
}
|
||||
title={label}
|
||||
>
|
||||
{({ isActive }) => (
|
||||
{() => (
|
||||
<span
|
||||
className={cn(
|
||||
"sidebar-nav-icon relative flex h-9 w-9 items-center justify-center rounded-lg bg-grayScale-50 text-grayScale-500 transition dark:bg-grayScale-200/10 dark:text-grayScale-400",
|
||||
isActive &&
|
||||
isSectionActive &&
|
||||
"sidebar-nav-icon-active bg-brand-500 text-white dark:bg-brand-500 dark:text-white",
|
||||
)}
|
||||
>
|
||||
|
|
@ -84,7 +85,7 @@ export function SidebarNavGroup({
|
|||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-0.5">
|
||||
<div className="space-y-0.5" data-accent={basePath === "/notifications" ? "cyan" : "mint"}>
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded={expanded}
|
||||
|
|
@ -128,13 +129,14 @@ export function SidebarNavGroup({
|
|||
|
||||
<div
|
||||
id={panelId}
|
||||
inert={!expanded}
|
||||
className={cn(
|
||||
"grid transition-[grid-template-rows] duration-250 ease-[cubic-bezier(0.4,0,0.2,1)]",
|
||||
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
|
||||
)}
|
||||
>
|
||||
<div className="overflow-hidden">
|
||||
<div className="ml-3 space-y-0.5 border-l-2 border-grayScale-100 pl-3 pt-0.5 pb-0.5 dark:border-grayScale-200/20">
|
||||
<div className="sidebar-subnav ml-3 space-y-0.5 border-l-2 border-grayScale-100 pl-3 pt-0.5 pb-0.5 dark:border-grayScale-200/20">
|
||||
{children.map((child) => (
|
||||
<NavLink
|
||||
key={child.to}
|
||||
|
|
|
|||
109
src/components/sidebar/sidebar.css
Normal file
109
src/components/sidebar/sidebar.css
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/* Floating navigation inspired by the compact navy, mint and cyan reference. */
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell {
|
||||
left: 12px;
|
||||
top: 12px;
|
||||
height: calc(100dvh - 24px);
|
||||
width: 256px;
|
||||
padding: 20px 12px 12px;
|
||||
border: 1px solid #ffffff12;
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(165deg, #142438 0%, #0d1829 75%);
|
||||
color: #a4b2c4;
|
||||
box-shadow: 0 16px 38px #0b142733, inset 1px 0 #ffffff05;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-brand-header {
|
||||
padding: 0 4px 16px;
|
||||
border: 0;
|
||||
border-bottom: 1px solid #ffffff0b;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logo { min-width: 0; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logo img { max-width: 116px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logo-mark {
|
||||
color: #7ce5c1;
|
||||
background: #71ddb811;
|
||||
border: 1px solid #71ddb81a;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-control {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border: 1px solid #ffffff12;
|
||||
background: transparent;
|
||||
color: #8194ac;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-control:hover { background: #ffffff0c; color: #7ce5c1; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-workspace-label {
|
||||
padding: 4px 0 0 46px;
|
||||
margin-top: 8px;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-workspace-label p:first-child { color: #70849c; font-size: 8px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-workspace-label p:last-child { color: #b2bfd0; font-size: 10px; font-weight: 400; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-workspace-label > span { display: none; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell nav { margin-top: 16px; min-height: 0; padding: 0 2px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-section {
|
||||
padding: 16px 10px 4px;
|
||||
margin-bottom: 2px;
|
||||
color: #72859e;
|
||||
font-size: 9px;
|
||||
font-weight: 500;
|
||||
letter-spacing: .1em;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-section:first-child { padding-top: 0; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-section::after { display: none; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item {
|
||||
min-height: 40px;
|
||||
padding: 4px 8px;
|
||||
gap: 10px;
|
||||
border: 0;
|
||||
border-radius: 9px;
|
||||
background: transparent;
|
||||
color: #a4b2c4;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item:hover { background: #ffffff08; color: #eef7ff; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: #8095ae;
|
||||
box-shadow: none;
|
||||
}
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-icon svg { width: 16px; height: 16px; stroke-width: 1.5; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item-active,
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item-active:hover { background: #233f50; color: #dffbf2; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item-active > span { color: inherit; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-icon-active { color: #7ce5c1; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell [data-accent="mint"] .sidebar-nav-item-active,
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell a[data-accent="mint"].sidebar-nav-item-active { background: #77dfb8; color: #102f2c; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell [data-accent="cyan"] .sidebar-nav-item-active,
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell a[data-accent="cyan"].sidebar-nav-item-active { background: #48c9e9; color: #102e3e; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell [data-accent] .sidebar-nav-item-active .sidebar-nav-icon { background: #ffffff24; color: inherit; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-nav-item-active > svg { color: inherit; opacity: .65; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-subnav { margin: 7px 0 7px 23px; padding: 0 0 0 14px; border-left: 1px solid #324255; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-subnav .sidebar-nav-item { min-height: 32px; padding: 7px 10px; font-size: 11px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-subnav-item-active { background: #77dfb810; color: #8de9c8; box-shadow: inset 2px 0 #77dfb8; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-active-indicator { display: none; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-footer { flex-shrink: 0; margin-top: 12px; padding: 10px 2px 0; border-color: #ffffff0d; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logout { border: 0; min-height: 40px; padding: 4px 8px; gap: 10px; color: #91a3bb; font-size: 12px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logout > span { width: 30px; height: 30px; background: #ffffff05; color: #91a3bb; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-logout:hover { background: #ffffff08; color: #f3b3b3; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell .sidebar-section-divider { width: 20px; background: #ffffff12; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell :is(a, button):focus-visible { outline: 2px solid #7ce5c1; outline-offset: -2px; }
|
||||
@media (min-width: 1024px) {
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell[data-collapsed="true"] { width: 76px; padding: 18px 9px 12px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell[data-collapsed="true"] .sidebar-brand-header { padding: 0 0 14px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell[data-collapsed="true"] .sidebar-nav-item { padding: 4px; }
|
||||
:is(.admin-app, html.dark .admin-app) .sidebar-shell[data-collapsed="true"] .sidebar-logout { justify-content: center; padding: 4px; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sidebar-shell, .sidebar-shell * { transition-duration: 0ms !important; }
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ export function AppLayout() {
|
|||
/>
|
||||
<div
|
||||
className={`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-[margin] duration-300 ${
|
||||
sidebarCollapsed ? "lg:ml-[88px]" : "lg:ml-[264px]"
|
||||
sidebarCollapsed ? "lg:ml-[100px]" : "lg:ml-[280px]"
|
||||
}`}
|
||||
>
|
||||
<Topbar onSidebarToggle={handleSidebarToggle} />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { StrictMode } from 'react'
|
|||
import { createRoot } from 'react-dom/client'
|
||||
import { BrowserRouter } from 'react-router-dom'
|
||||
import './index.css'
|
||||
import './components/sidebar/sidebar.css'
|
||||
import App from './App.tsx'
|
||||
import { ThemeProvider } from './contexts/ThemeContext.tsx'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { Pencil, User } from "lucide-react";
|
||||
import { ArrowUpRight, BriefcaseBusiness, CalendarDays, Check, Clock3, Mail, Pencil, ShieldCheck, User } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { getTeamMe, updateTeamMe } from "../api/team.api";
|
||||
import { ProfileAvatarUpload } from "../components/profile/ProfileAvatarUpload";
|
||||
import { Badge } from "../components/ui/badge";
|
||||
import "../components/profile/profile.css";
|
||||
import { Button } from "../components/ui/button";
|
||||
import {
|
||||
Card,
|
||||
|
|
@ -60,7 +60,7 @@ function FieldGroup({
|
|||
<p className="text-xs font-medium text-grayScale-400">{label}</p>
|
||||
<p
|
||||
className={cn(
|
||||
"text-sm font-medium text-grayScale-900",
|
||||
"profile-field-value text-sm font-medium text-grayScale-900",
|
||||
mono && "font-mono text-xs",
|
||||
)}
|
||||
>
|
||||
|
|
@ -82,7 +82,7 @@ function SectionCard({
|
|||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Card className="border border-grayScale-100 shadow-none">
|
||||
<Card className="profile-card border border-grayScale-100 shadow-none">
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-[15px] font-semibold text-grayScale-900">
|
||||
{title}
|
||||
|
|
@ -132,6 +132,7 @@ export function ProfilePage() {
|
|||
const [profile, setProfile] = useState<TeamMeProfile | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [activeSection, setActiveSection] = useState("overview");
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [uploadingPicture, setUploadingPicture] = useState(false);
|
||||
|
|
@ -213,7 +214,7 @@ export function ProfilePage() {
|
|||
if (error || !profile) {
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-7xl py-16">
|
||||
<Card className="border border-grayScale-100 shadow-none">
|
||||
<Card className="profile-card border border-grayScale-100 shadow-none">
|
||||
<CardContent className="flex flex-col items-center gap-5 p-12">
|
||||
<div className="flex h-20 w-20 items-center justify-center rounded-full bg-grayScale-50">
|
||||
<User className="h-10 w-10 text-grayScale-300" />
|
||||
|
|
@ -247,124 +248,93 @@ export function ProfilePage() {
|
|||
}));
|
||||
};
|
||||
|
||||
const completionFields = [
|
||||
["Personal details", profile.first_name && profile.last_name && profile.phone_number],
|
||||
["Profile picture", profile.profile_picture_url],
|
||||
["Work information", profile.department && profile.job_title],
|
||||
["About me", profile.bio],
|
||||
] as const;
|
||||
const completionPercent = Math.round(completionFields.filter(([, value]) => value?.trim()).length / completionFields.length * 100);
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-7xl space-y-6">
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold tracking-tight text-grayScale-900">
|
||||
My Profile
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-grayScale-500">
|
||||
Your personal details, work information, and account activity.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Hero */}
|
||||
<Card className="border border-grayScale-100 shadow-none">
|
||||
<CardContent className="flex items-center justify-between px-6 py-6">
|
||||
<div className="flex items-center gap-5">
|
||||
<ProfileAvatarUpload
|
||||
avatarUrl={profile.profile_picture_url}
|
||||
initials={initials}
|
||||
onProfileUpdate={handleProfileUpdate}
|
||||
/>
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-lg font-semibold text-grayScale-900">
|
||||
{fullName}
|
||||
</h2>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="rounded-full border-grayScale-200 px-3 py-0.5 text-[11px] font-medium text-grayScale-600"
|
||||
>
|
||||
{formatRoleLabel(profile.team_role)}
|
||||
</Badge>
|
||||
{profile.job_title?.trim() && (
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="rounded-full border-grayScale-200 px-3 py-0.5 text-[11px] font-medium text-grayScale-600"
|
||||
>
|
||||
{profile.job_title}
|
||||
</Badge>
|
||||
)}
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={cn(
|
||||
"rounded-full px-3 py-0.5 text-[11px] font-medium",
|
||||
profile.email_verified
|
||||
? "border-green-200 text-green-600"
|
||||
: "border-grayScale-200 text-grayScale-500",
|
||||
)}
|
||||
>
|
||||
{profile.email_verified ? "Verified" : "Unverified"}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="profile-page mx-auto w-full max-w-7xl space-y-5">
|
||||
<section className="profile-hero" aria-label="Profile summary">
|
||||
<div className="profile-hero-main">
|
||||
<ProfileAvatarUpload avatarUrl={profile.profile_picture_url} initials={initials} onProfileUpdate={handleProfileUpdate} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<h1 className="profile-name">{fullName || "Your profile"}</h1>
|
||||
{profile.email_verified && <ShieldCheck className="h-4 w-4 text-violet-600" aria-label="Email verified" />}
|
||||
<span className="profile-role">{formatRoleLabel(profile.team_role)}</span>
|
||||
</div>
|
||||
<div className="profile-meta">
|
||||
<span><BriefcaseBusiness />{profile.job_title?.trim() || "Academy team member"}</span>
|
||||
<span><Mail />{profile.email}</span>
|
||||
</div>
|
||||
<div className="profile-facts">
|
||||
<div><CalendarDays /><span><strong>{formatDate(profile.created_at)}</strong><small>Member since</small></span></div>
|
||||
<div><BriefcaseBusiness /><span><strong>{profile.department?.trim() || "Not assigned"}</strong><small>Department</small></span></div>
|
||||
<div><ShieldCheck /><span><strong>{profile.email_verified ? "Verified" : "Unverified"}</strong><small>Email status</small></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-8 gap-1.5 rounded-[6px] text-xs font-medium text-grayScale-500"
|
||||
onClick={startEditing}
|
||||
>
|
||||
<Pencil className="h-3.5 w-3.5" />
|
||||
Edit
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className="grid items-stretch gap-6 lg:grid-cols-2">
|
||||
{/* Personal Information */}
|
||||
<SectionCard title="Personal Information">
|
||||
<div className="grid gap-x-10 gap-y-6 sm:grid-cols-2">
|
||||
<FieldGroup label="First Name" value={profile.first_name} />
|
||||
<FieldGroup label="Last Name" value={profile.last_name} />
|
||||
<FieldGroup label="Email address" value={profile.email} />
|
||||
<FieldGroup label="Phone" value={profile.phone_number} />
|
||||
<div className="sm:col-span-2">
|
||||
<FieldGroup label="Bio" value={<DisplayValue value={profile.bio} />} />
|
||||
</div>
|
||||
</div>
|
||||
</SectionCard>
|
||||
|
||||
{/* Work Details */}
|
||||
<SectionCard title="Work Details">
|
||||
<div className="grid gap-x-8 gap-y-5 sm:grid-cols-2">
|
||||
<FieldGroup
|
||||
label="Department"
|
||||
value={<DisplayValue value={profile.department} />}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Job Title"
|
||||
value={<DisplayValue value={profile.job_title} />}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Work Phone"
|
||||
value={<DisplayValue value={profile.work_phone} />}
|
||||
/>
|
||||
<FieldGroup label="Member ID" value={String(profile.id)} mono />
|
||||
</div>
|
||||
</SectionCard>
|
||||
</div>
|
||||
|
||||
{/* Account Activity */}
|
||||
<SectionCard title="Account Activity">
|
||||
<div className="grid gap-x-8 gap-y-5 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<FieldGroup label="Joined" value={formatDate(profile.created_at)} />
|
||||
<FieldGroup
|
||||
label="Last Login"
|
||||
value={formatDateTime(profile.last_login)}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Email Verified"
|
||||
value={profile.email_verified ? "Yes" : "No"}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Last Updated"
|
||||
value={formatDate(profile.updated_at)}
|
||||
/>
|
||||
<Button className="profile-edit" onClick={startEditing}><Pencil className="h-3.5 w-3.5" />Edit profile</Button>
|
||||
</div>
|
||||
</SectionCard>
|
||||
<nav className="profile-tabs" aria-label="Profile sections">
|
||||
{[
|
||||
["overview", "Overview"], ["personal", "Personal details"],
|
||||
["work", "Work details"], ["activity", "Account activity"],
|
||||
].map(([key, label]) => <button key={key} type="button" aria-pressed={activeSection === key} onClick={() => setActiveSection(key)}>{label}</button>)}
|
||||
</nav>
|
||||
</section>
|
||||
|
||||
<div className="profile-content-grid">
|
||||
<div className="min-w-0 space-y-5" aria-live="polite">
|
||||
{(activeSection === "overview" || activeSection === "personal") && <SectionCard title="Personal information">
|
||||
<p className="profile-section-description">The details behind your academy profile.</p>
|
||||
<div className="grid gap-x-8 gap-y-6 sm:grid-cols-2">
|
||||
<FieldGroup label="First name" value={profile.first_name} />
|
||||
<FieldGroup label="Last name" value={profile.last_name} />
|
||||
<FieldGroup label="Email address" value={profile.email} />
|
||||
<FieldGroup label="Phone number" value={profile.phone_number} />
|
||||
<div className="profile-bio sm:col-span-2"><FieldGroup label="About me" value={<DisplayValue value={profile.bio} />} /></div>
|
||||
</div>
|
||||
</SectionCard>}
|
||||
{(activeSection === "overview" || activeSection === "work") && <SectionCard title="Work details">
|
||||
<p className="profile-section-description">Your role and contact information at the academy.</p>
|
||||
<div className="grid gap-x-8 gap-y-6 sm:grid-cols-2">
|
||||
<FieldGroup label="Department" value={<DisplayValue value={profile.department} />} />
|
||||
<FieldGroup label="Job title" value={<DisplayValue value={profile.job_title} />} />
|
||||
<FieldGroup label="Work phone" value={<DisplayValue value={profile.work_phone} />} />
|
||||
<FieldGroup label="Member ID" value={String(profile.id)} mono />
|
||||
</div>
|
||||
</SectionCard>}
|
||||
{(activeSection === "overview" || activeSection === "activity") && <SectionCard title="Account activity">
|
||||
<p className="profile-section-description">The latest information recorded for your account.</p>
|
||||
<div className="profile-activity-list">
|
||||
{[
|
||||
{label: "Last sign-in", value: formatDateTime(profile.last_login), icon: Clock3},
|
||||
{label: "Profile updated", value: formatDateTime(profile.updated_at), icon: Pencil},
|
||||
{label: "Account created", value: formatDateTime(profile.created_at), icon: CalendarDays},
|
||||
].map(({label,value,icon: Icon}) => <div key={label}><span className="profile-activity-icon"><Icon className="h-4 w-4" /></span><span className="flex-1 text-xs font-medium">{label}</span><span className="text-xs text-grayScale-500"><DisplayValue value={value} /></span></div>)}
|
||||
</div>
|
||||
</SectionCard>}
|
||||
</div>
|
||||
<aside className="profile-detail-rail" aria-label="Account summary">
|
||||
<SectionCard title="Profile completeness">
|
||||
<div className="profile-completion-value">{completionPercent}<span>%</span></div>
|
||||
<div className="profile-completion-track" role="progressbar" aria-label="Profile completeness" aria-valuenow={completionPercent} aria-valuemin={0} aria-valuemax={100}><span style={{width: `${completionPercent}%`}} /></div>
|
||||
<p className="profile-section-description mt-3">Keep your details up to date so your team can get to know you.</p>
|
||||
<ul className="profile-checklist">{completionFields.map(([label, value]) => <li key={label}><span className={value?.trim() ? "is-complete" : ""}>{value?.trim() ? <Check className="h-3 w-3" /> : <span className="h-1 w-1 rounded-full bg-current" />}</span>{label}</li>)}</ul>
|
||||
<button type="button" className="profile-text-action" onClick={startEditing}>Update your details<ArrowUpRight className="h-3.5 w-3.5" /></button>
|
||||
</SectionCard>
|
||||
<SectionCard title="Account security">
|
||||
<div className="profile-security-symbol"><ShieldCheck className="h-7 w-7" /></div>
|
||||
<h3 className="text-sm font-semibold">{profile.email_verified ? "Your email is verified" : "Email verification pending"}</h3>
|
||||
<p className="profile-section-description mt-2">{profile.email_verified ? "Your academy account has a verified email address." : "Contact your administrator for help verifying your account email."}</p>
|
||||
<div className="profile-security-status"><span className={profile.email_verified ? "verified" : ""} />{profile.email_verified ? "Verified email" : "Unverified email"}</div>
|
||||
</SectionCard>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
{/* Edit dialog */}
|
||||
<Dialog open={editing} onOpenChange={(open) => !busy && setEditing(open)}>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import {
|
||||
CreditCard,
|
||||
Gift,
|
||||
ChevronRight,
|
||||
Eye,
|
||||
EyeOff,
|
||||
Globe,
|
||||
|
|
@ -37,6 +39,8 @@ import { ReferralsTab } from "./settings/ReferralsTab";
|
|||
import { SubscriptionPlansTab } from "./settings/SubscriptionPlansTab";
|
||||
import { ThemeModePreview } from "./settings/components/ThemeModePreview";
|
||||
|
||||
import "./settings/settings.css";
|
||||
|
||||
type SettingsTab =
|
||||
| "referrals"
|
||||
| "subscription"
|
||||
|
|
@ -56,12 +60,12 @@ function isSettingsTab(value: string | null): value is SettingsTab {
|
|||
return value != null && (SETTINGS_TABS as string[]).includes(value)
|
||||
}
|
||||
|
||||
const tabs: { id: SettingsTab; label: string; icon: typeof Shield }[] = [
|
||||
{ id: "referrals", label: "Referrals", icon: CreditCard },
|
||||
{ id: "subscription", label: "Subscription packages", icon: CreditCard },
|
||||
{ id: "app-versions", label: "App versions", icon: Smartphone },
|
||||
{ id: "security", label: "Security", icon: Shield },
|
||||
{ id: "appearance", label: "Appearance", icon: Palette },
|
||||
const tabs: { id: SettingsTab; label: string; description: string; icon: typeof Shield }[] = [
|
||||
{ id: "referrals", label: "Affiliate program", description: "Referral commissions and rewards", icon: Gift },
|
||||
{ id: "subscription", label: "Subscription packages", description: "Manage existing plan packages", icon: CreditCard },
|
||||
{ id: "app-versions", label: "App versions", description: "Mobile releases and updates", icon: Smartphone },
|
||||
{ id: "security", label: "Security", description: "Password and team permissions", icon: Shield },
|
||||
{ id: "appearance", label: "Appearance", description: "Make this workspace your own", icon: Palette },
|
||||
];
|
||||
|
||||
function SecurityTab({ memberId }: { memberId: number }) {
|
||||
|
|
@ -117,11 +121,12 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
</CardHeader>
|
||||
<CardContent className="space-y-5 pb-6">
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
<label htmlFor="settings-current-password" className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
Current Password
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="settings-current-password"
|
||||
type={showCurrent ? "text" : "password"}
|
||||
placeholder="Enter current password"
|
||||
className="rounded-[6px] pr-10"
|
||||
|
|
@ -132,6 +137,7 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
/>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={showCurrent ? "Hide current password" : "Show current password"}
|
||||
onClick={() => setShowCurrent(!showCurrent)}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-grayScale-400 hover:text-grayScale-600"
|
||||
>
|
||||
|
|
@ -145,11 +151,12 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
</div>
|
||||
<div className="grid gap-5 sm:grid-cols-2">
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
<label htmlFor="settings-new-password" className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
New Password
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="settings-new-password"
|
||||
type={showNew ? "text" : "password"}
|
||||
placeholder="Enter new password"
|
||||
className="rounded-[6px] pr-10"
|
||||
|
|
@ -160,7 +167,8 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowNew(!showNew)}
|
||||
aria-label={showNew ? "Hide new password" : "Show new password"}
|
||||
onClick={() => setShowNew(!showNew)}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-grayScale-400 hover:text-grayScale-600"
|
||||
>
|
||||
{showNew ? (
|
||||
|
|
@ -172,11 +180,12 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
</div>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
<label htmlFor="settings-confirm-password" className="text-[11px] font-bold uppercase tracking-wider text-grayScale-400">
|
||||
Confirm New Password
|
||||
</label>
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="settings-confirm-password"
|
||||
type={showConfirm ? "text" : "password"}
|
||||
placeholder="Confirm new password"
|
||||
className="rounded-[6px] pr-10"
|
||||
|
|
@ -187,7 +196,8 @@ function SecurityTab({ memberId }: { memberId: number }) {
|
|||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowConfirm(!showConfirm)}
|
||||
aria-label={showConfirm ? "Hide confirm password" : "Show confirm password"}
|
||||
onClick={() => setShowConfirm(!showConfirm)}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 text-grayScale-400 hover:text-grayScale-600"
|
||||
>
|
||||
{showConfirm ? (
|
||||
|
|
@ -386,49 +396,41 @@ export function SettingsPage() {
|
|||
);
|
||||
}
|
||||
|
||||
const selectedCategory = tabs.find(tab => tab.id === activeTab)!;
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-7xl px-4 py-8 sm:px-6">
|
||||
<div className="mb-10 ">
|
||||
<h1 className="text-2xl font-black tracking-tight text-grayScale-700">
|
||||
Settings
|
||||
</h1>
|
||||
<p className="mt-2 text-sm text-grayScale-500 ">
|
||||
Manage your account preferences, subscriptions, and system
|
||||
configurations with ease
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-6">
|
||||
<nav className="flex gap-1 overflow-x-auto border-b border-grayScale-100 pb-px">
|
||||
{tabs.filter(tab => tab.id !== "referrals" || ["ADMIN", "SUPER_ADMIN"].includes(profile.team_role)).map((tab) => {
|
||||
const Icon = tab.icon;
|
||||
const active = activeTab === tab.id;
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
onClick={() => selectTab(tab.id)}
|
||||
className={cn(
|
||||
"flex shrink-0 items-center gap-2 whitespace-nowrap border-b-2 px-4 py-3 text-sm font-medium transition-colors",
|
||||
active
|
||||
? "border-brand-500 text-brand-600"
|
||||
: "border-transparent text-grayScale-500 hover:border-grayScale-200 hover:text-grayScale-700",
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4 shrink-0" />
|
||||
{tab.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
<main className="min-h-[400px] min-w-0 w-full">
|
||||
{activeTab === "referrals" && (["ADMIN", "SUPER_ADMIN"].includes(profile.team_role) ? <ReferralsTab /> : <p>Administrator access is required to manage referral commissions.</p>)}
|
||||
{activeTab === "subscription" && <SubscriptionPlansTab />}
|
||||
{activeTab === "app-versions" && <AppVersionsTab />}
|
||||
{activeTab === "security" && <SecurityTab memberId={profile.id} />}
|
||||
{activeTab === "appearance" && <AppearanceTab />}
|
||||
</main>
|
||||
<div className="settings-page mx-auto w-full max-w-7xl">
|
||||
<header className="settings-page-heading">
|
||||
<div><p className="settings-eyebrow">WORKSPACE PREFERENCES</p><h1>Settings</h1><p>Manage your academy, account security, and workspace preferences.</p></div>
|
||||
<span className="settings-workspace-badge"><Shield className="h-3.5 w-3.5" />Academy workspace</span>
|
||||
</header>
|
||||
<div className="settings-workspace">
|
||||
<aside className="settings-categories" aria-label="Settings categories">
|
||||
<p className="settings-category-label">Choose a category</p>
|
||||
<nav className="settings-category-grid" aria-label="Settings navigation">
|
||||
{tabs.filter(tab => tab.id !== "referrals" || ["ADMIN", "SUPER_ADMIN"].includes(profile.team_role)).map(tab => {
|
||||
const Icon = tab.icon;
|
||||
const active = activeTab === tab.id;
|
||||
return <button key={tab.id} type="button" aria-pressed={active} aria-controls="settings-detail-panel" className="settings-category" onClick={() => selectTab(tab.id)}>
|
||||
<span className="settings-category-icon"><Icon aria-hidden="true" /></span>
|
||||
<span className="settings-category-title">{tab.label}</span>
|
||||
<span className="settings-category-description">{tab.description}</span>
|
||||
{active && <span className="settings-category-selected" aria-hidden="true"><ChevronRight className="h-3 w-3" /></span>}
|
||||
</button>;
|
||||
})}
|
||||
</nav>
|
||||
<div className="settings-category-note"><Lock className="h-4 w-4" /><p>Settings are available according to your team role and permissions.</p></div>
|
||||
</aside>
|
||||
<section id="settings-detail-panel" className="settings-detail-panel" aria-labelledby="settings-detail-title">
|
||||
<header className="settings-detail-heading"><span className="settings-detail-icon"><selectedCategory.icon className="h-5 w-5" /></span><div><h2 id="settings-detail-title">{selectedCategory.label}</h2><p>{selectedCategory.description}</p></div></header>
|
||||
<div className="settings-panel-content">
|
||||
{activeTab === "referrals" && (["ADMIN", "SUPER_ADMIN"].includes(profile.team_role) ? <ReferralsTab /> : <p>Administrator access is required to manage referral commissions.</p>)}
|
||||
{activeTab === "subscription" && <SubscriptionPlansTab />}
|
||||
{activeTab === "app-versions" && <AppVersionsTab />}
|
||||
{activeTab === "security" && <SecurityTab memberId={profile.id} />}
|
||||
{activeTab === "appearance" && <AppearanceTab />}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
41
src/pages/settings/settings.css
Normal file
41
src/pages/settings/settings.css
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
.settings-page { --settings-accent: #41a9b5; --settings-line: #e8ebee; padding-bottom: 20px; }
|
||||
.settings-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
|
||||
.settings-eyebrow { color: #8c98a6; font-size: 9px; letter-spacing: .16em; font-weight: 600; margin-bottom: 6px; }
|
||||
.admin-app .settings-page-heading h1 { font-family: inherit; font-size: 23px; font-weight: 600; letter-spacing: -.04em; }
|
||||
.settings-page-heading h1 + p { font-size: 12px; color: #8c95a2; margin-top: 8px; }
|
||||
.settings-workspace-badge { display: flex; gap: 7px; align-items: center; padding: 8px 11px; border: 1px solid var(--settings-line); background: #fff; border-radius: 5px; color: #87929e; font-size: 10px; white-space: nowrap; }
|
||||
.settings-workspace { display: grid; grid-template-columns: 284px minmax(0, 1fr); gap: 24px; align-items: start; }
|
||||
.settings-categories { padding: 20px 16px; background: #fff; border: 1px solid var(--settings-line); border-radius: 6px; }
|
||||
.settings-category-label { font-size: 10px; color: #8a95a3; margin-bottom: 16px; }
|
||||
.settings-category-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
|
||||
.admin-app .settings-page .settings-category { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; min-height: 137px; padding: 17px 8px 13px; border: 1px solid #e9edf0; background: #fff; border-radius: 3px; color: #3f4a59; box-shadow: 0 3px 10px #22334404; transition: border-color .2s, background .2s; }
|
||||
.admin-app .settings-page .settings-category:hover { border-color: #9bcdd4; background: #fbfefe; }
|
||||
.admin-app .settings-page .settings-category[aria-pressed="true"] { border-color: var(--settings-accent); background: #f5fcfc; box-shadow: 0 0 0 1px #41a9b51a; }
|
||||
.settings-category-icon { display: grid; place-items: center; width: 42px; height: 42px; position: relative; color: #647583; }
|
||||
.settings-category-icon::before { content: ''; position: absolute; width: 27px; height: 27px; right: 0; bottom: 0; border-radius: 50%; background: #e5f5f5; }
|
||||
.settings-category-icon svg { position: relative; width: 28px; height: 28px; stroke-width: 1.2; }
|
||||
.settings-category[aria-pressed="true"] .settings-category-icon { color: #348c9c; }
|
||||
.settings-category-title { font-size: 10px; font-weight: 600; text-align: center; }
|
||||
.settings-category-description { font-size: 9px; font-weight: 400; line-height: 1.6; text-align: center; color: #9aa3ad; }
|
||||
.settings-category-selected { position: absolute; top: 5px; right: 5px; color: #41a9b5; }
|
||||
.settings-category-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--settings-line); color: #9aa5b2; font-size: 10px; line-height: 1.8; }
|
||||
.settings-category-note svg { flex-shrink: 0; margin-top: 3px; }
|
||||
.settings-detail-panel { min-width: 0; min-height: 570px; border: 1px solid var(--settings-line); background: #fff; border-radius: 6px; }
|
||||
.settings-detail-heading { display: flex; align-items: center; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--settings-line); }
|
||||
.settings-detail-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #eef8f9; color: #409aa8; }
|
||||
.admin-app .settings-page .settings-detail-heading h2 { font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.02em; }
|
||||
.settings-detail-heading p { margin-top: 5px; color: #99a0aa; font-size: 10px; }
|
||||
.settings-panel-content { padding: 22px; min-width: 0; overflow-wrap: anywhere; }
|
||||
.settings-page .settings-panel-content > div { min-width: 0; }
|
||||
.settings-page .settings-panel-content h1, .settings-page .settings-panel-content h2 { font-family: inherit; }
|
||||
.settings-page .settings-panel-content :is(table) { font-size: 11px; }
|
||||
.settings-page .settings-panel-content input { max-width: 100%; }
|
||||
.settings-page .settings-category:focus-visible { outline: 2px solid var(--settings-accent); outline-offset: 3px; }
|
||||
html.dark .settings-page { --settings-line: #343940; }
|
||||
html.dark .admin-app .settings-page :is(.settings-categories,.settings-detail-panel,.settings-workspace-badge,.settings-category) { background: #20252b; color: #d5dce3; }
|
||||
html.dark .admin-app .settings-page .settings-category { border-color: #343940; }
|
||||
html.dark .admin-app .settings-page .settings-category[aria-pressed="true"] { background: #23383c; border-color: #54adba; }
|
||||
html.dark .settings-category-icon::before, html.dark .settings-detail-icon { background: #293d42; }
|
||||
@media (max-width: 1279px) { .settings-workspace { grid-template-columns: 232px minmax(0,1fr); gap: 16px; } .settings-categories { padding: 16px 12px; } .settings-category-grid { gap: 9px; } .settings-panel-content { padding: 16px; } }
|
||||
@media (max-width: 900px) { .settings-workspace { grid-template-columns: minmax(0,1fr); } .settings-category-grid { grid-template-columns: repeat(5,minmax(0,1fr)); } .settings-category-note { display: none; } .settings-category-label { margin-bottom: 12px; } .settings-detail-panel { min-height: 400px; } }
|
||||
@media (max-width: 600px) { .settings-page-heading { align-items: flex-start; margin-bottom: 20px; } .settings-workspace-badge { display: none; } .settings-page-heading h1 + p { line-height: 1.8; } .settings-category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .admin-app .settings-page .settings-category { min-height: 115px; padding: 12px 8px; } .settings-category-description { display: none; } .settings-detail-heading { padding: 18px 16px; } .settings-panel-content { padding: 16px 12px; } }
|
||||
Loading…
Reference in New Issue
Block a user