fix(#15950): mobile favorites folder navigation with proper back button (#16118)

## What’s done
- Clicking a favorite folder on mobile now opens a clean drill-down
layer with only its contents
- Added a back button (icon + folder name) — visually 100% identical to
`NavigationDrawerBackButton`
- Sidebar no longer collapses when opening a folder
- Tree line is removed on mobile (consistent with current Twenty design)

## Intentional deviations from the mockup
1. **Back button does not replace `MultiWorkspaceDropdownButton`**  
Kept `NavigationDrawerHeader` untouched — it’s responsible for the
hamburger menu and workspace name.
   Added the back button as a separate block below.  
→ This feels cleaner architecturally and avoids breaking other places
that use `NavigationDrawerHeader`.

2. **Vertical spacing between items is slightly tighter than in the
mockup**
Used `NavigationDrawerSubItem` — the standard component for nested items
in Twenty.
Current production spacing matches this exactly, so I preferred
consistency over pixel-perfect mockup matching.

Happy to adjust either point if the team prefers to follow the mockup
1:1.

Closes #15950

---------

Co-authored-by: Baptiste Devessier <baptiste@devessier.fr>
This commit is contained in:
Anton Ambarov
2025-12-03 15:08:52 +05:00
committed by GitHub
parent e18262cfa6
commit a892462c05
6 changed files with 178 additions and 10 deletions
@@ -1,15 +1,23 @@
import { useRecoilValue } from 'recoil';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { FavoritesFolderContent } from '@/favorites/components/FavoritesFolderContent';
import { useFavoritesByFolder } from '@/favorites/hooks/useFavoritesByFolder';
import { MainNavigationDrawerFixedItems } from '@/navigation/components/MainNavigationDrawerFixedItems';
import { MainNavigationDrawerScrollableItems } from '@/navigation/components/MainNavigationDrawerScrollableItems';
import { SupportDropdown } from '@/support/components/SupportDropdown';
import { NavigationDrawer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
import { NavigationDrawerFixedContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerFixedContent';
import { NavigationDrawerScrollableContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerScrollableContent';
import { currentFavoriteFolderIdState } from '@/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdState';
export const MainNavigationDrawer = ({ className }: { className?: string }) => {
const currentWorkspace = useRecoilValue(currentWorkspaceState);
const currentFavoriteFolderId = useRecoilValue(currentFavoriteFolderIdState);
const { favoritesByFolder } = useFavoritesByFolder();
const openedFolder = favoritesByFolder.find(
(f) => f.folderId === currentFavoriteFolderId,
);
return (
<NavigationDrawer
@@ -21,7 +29,15 @@ export const MainNavigationDrawer = ({ className }: { className?: string }) => {
</NavigationDrawerFixedContent>
<NavigationDrawerScrollableContent>
<MainNavigationDrawerScrollableItems />
{currentFavoriteFolderId && openedFolder ? (
<FavoritesFolderContent
folderName={openedFolder.folderName}
folderId={openedFolder.folderId}
favorites={openedFolder.favorites}
/>
) : (
<MainNavigationDrawerScrollableItems />
)}
</NavigationDrawerScrollableContent>
<NavigationDrawerFixedContent>