v0.9.35 settings redesign
This commit is contained in:
@@ -11,12 +11,18 @@ const NAV_ICON = {
|
||||
settings: <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="3"/><path d="M19.07 4.93l-1.41 1.41M5.34 18.66l-1.41 1.41M12 2v2M12 20v2M4.93 4.93l1.41 1.41M18.66 18.66l1.41 1.41M2 12h2M20 12h2"/></svg>,
|
||||
};
|
||||
|
||||
export default function NavDrawer({ open, onClose, onMessages, onGroupManager, onBranding, onSettings, onUsers, features = {} }) {
|
||||
export default function NavDrawer({ open, onClose, onMessages, onGroupManager, onScheduleManager, onBranding, onSettings, onUsers, features = {} }) {
|
||||
const { user } = useAuth();
|
||||
const drawerRef = useRef(null);
|
||||
const isAdmin = user?.role === 'admin';
|
||||
const isMobile = window.matchMedia('(pointer: coarse)').matches || window.innerWidth < 768;
|
||||
|
||||
// Team-managed access: check if user is in any of the designated manager groups
|
||||
// (frontend-only — no API enforcement yet)
|
||||
const userGroupIds = features.userGroupMemberships || [];
|
||||
const canAccessGroupManager = isAdmin || (features.teamGroupManagers || []).some(gid => userGroupIds.includes(gid));
|
||||
const canAccessScheduleManager = isAdmin || (features.teamScheduleManagers || []).some(gid => userGroupIds.includes(gid));
|
||||
|
||||
// Close on outside click
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -72,10 +78,10 @@ export default function NavDrawer({ open, onClose, onMessages, onGroupManager, o
|
||||
<>
|
||||
<div className="nav-drawer-section-label admin">Admin</div>
|
||||
{item(NAV_ICON.users, 'User Manager', onUsers)}
|
||||
{features.groupManager && !isMobile && item(NAV_ICON.groups, 'Group Manager', onGroupManager)}
|
||||
{features.branding && item(NAV_ICON.branding, 'Branding', onBranding)}
|
||||
{!isMobile && item(NAV_ICON.schedules, 'Schedule Manager', () => {}, true)}
|
||||
{item(NAV_ICON.settings, 'Settings', onSettings)}
|
||||
{features.groupManager && !isMobile && canAccessGroupManager && item(NAV_ICON.groups, 'Group Manager', onGroupManager)}
|
||||
{features.scheduleManager && !isMobile && canAccessScheduleManager && item(NAV_ICON.schedules, 'Schedule Manager', onScheduleManager || (() => {}))}
|
||||
{features.branding && item(NAV_ICON.branding, 'Branding', onBranding)}
|
||||
{isAdmin && item(NAV_ICON.settings, 'Settings', onSettings)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user