diff --git a/components/dashboard/DashboardModal.module.css b/components/dashboard/DashboardModal.module.css index 784acfb..4183762 100644 --- a/components/dashboard/DashboardModal.module.css +++ b/components/dashboard/DashboardModal.module.css @@ -249,8 +249,8 @@ color: var(--primary-text); } -/* Slide the drawer in from the right on phone so it reads as the same sidebar - * the burger menu opened from, rather than popping in place. */ +/* Slide the drawer in from the right on phone when it genuinely opens (the home + * Settings button, a tool sheet's link) rather than popping in place. */ @keyframes dashboardDrawerIn { from { transform: translateX(100%); @@ -260,10 +260,10 @@ } } -/* Phone: the sidebar nav lives in the burger menu, so the modal drops it and - * renders as a right-side drawer matching that menu (same width and position - * below the navbar) instead of a full-screen pane. Tabs are switched from the - * burger, which re-opens the dashboard on the chosen tab. Content is tightened +/* Phone: on a project the sidebar nav lives in the burger menu, so the modal + * drops it and renders as a right-side drawer matching that menu (same width and + * position below the navbar) instead of a full-screen pane. Tabs are switched from + * the burger, which swaps this drawer in for it on the chosen tab. Content is tightened * and slightly scaled down so the settings sit comfortably in the narrow width. */ @media (max-width: 767px) { .overlay { @@ -291,6 +291,14 @@ animation: dashboardDrawerIn 0.25s ease; } + /* Swapped in for the burger menu, which sits in this exact rect: the drawer + * is already on screen, so it must not slide in again — only its content + * changes. Same in-place replacement the sections list ⇄ section switch does + * below (see [DashboardContext].drawerSwap). */ + .modal.instant { + animation: none; + } + /* The nav sidebar and the content share the drawer, one screen at a time. * Default screen is content; .mobileSections flips to the sections list (used * when the dashboard is opened without a burger menu behind it — e.g. the diff --git a/components/dashboard/DashboardModal.tsx b/components/dashboard/DashboardModal.tsx index b87ee84..f8ab86f 100644 --- a/components/dashboard/DashboardModal.tsx +++ b/components/dashboard/DashboardModal.tsx @@ -25,7 +25,7 @@ import DashboardAuth from "./account/DashboardAuth"; import AboutSettings from "./AboutSettings"; const DashboardModal = () => { - const { isOpen, closeDashboard, activeTab, setActiveTab, openedFromMenu, setMobileMenuOpen } = + const { isOpen, closeDashboard, activeTab, setActiveTab, openedFromMenu, swapDrawerScreen, drawerSwap } = useContext(DashboardContext); const t = useTranslations("modal"); const tSidebar = useTranslations("sidebar"); @@ -40,10 +40,13 @@ const DashboardModal = () => { // so preferences/account tabs are reachable, and the back arrow returns to it. const [mobileShowSections, setMobileShowSections] = useState(false); + // Either way this is the same gesture — step back to the list of sections — + // so it looks the same either way: the drawer's content is replaced, with no + // slide. Only the list itself differs (the burger menu in a project, this + // modal's own sidebar elsewhere). const handleBack = () => { if (openedFromMenu) { - closeDashboard(); - setMobileMenuOpen(true); + swapDrawerScreen("menu"); } else { setMobileShowSections(true); } @@ -133,7 +136,7 @@ const DashboardModal = () => { return (