From b33b05c711a8aa72b3b1e61e815ed88ff6b51c63 Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Sat, 21 Nov 2026 12:02:38 +0300 Subject: [PATCH] Redesign admin sidebar, profile and settings pages --- src/components/profile/profile.css | 53 ++++++ src/components/sidebar/Sidebar.tsx | 33 +++- src/components/sidebar/SidebarLogo.tsx | 26 +-- src/components/sidebar/SidebarNavGroup.tsx | 14 +- src/components/sidebar/sidebar.css | 109 +++++++++++ src/layouts/AppLayout.tsx | 2 +- src/main.tsx | 1 + src/pages/ProfilePage.tsx | 208 +++++++++------------ src/pages/SettingsPage.tsx | 108 +++++------ src/pages/settings/settings.css | 41 ++++ 10 files changed, 394 insertions(+), 201 deletions(-) create mode 100644 src/components/profile/profile.css create mode 100644 src/components/sidebar/sidebar.css create mode 100644 src/pages/settings/settings.css diff --git a/src/components/profile/profile.css b/src/components/profile/profile.css new file mode 100644 index 0000000..87ffd89 --- /dev/null +++ b/src/components/profile/profile.css @@ -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%; } } diff --git a/src/components/sidebar/Sidebar.tsx b/src/components/sidebar/Sidebar.tsx index 566990f..0427ffa 100644 --- a/src/components/sidebar/Sidebar.tsx +++ b/src/components/sidebar/Sidebar.tsx @@ -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 && ( {unreadCount > 99 ? "99+" : unreadCount} @@ -189,11 +207,14 @@ export function Sidebar({ />