Merge branch 'feat/desktop-offline' into feat/do-toast-place

This commit is contained in:
Linus Rath
2026-11-04 18:18:48 +01:00
50 changed files with 1633 additions and 459 deletions
+26 -2
View File
@@ -313,6 +313,18 @@ optgroup {
background-color: var(--color-muted-foreground);
}
/* The folded folder column (components/layout/sidebar.tsx) leaves its 48px
to the icons: a 4px scrollbar, in a gutter kept on both sides. */
:root:not([data-native-scrollbars="on"]) [data-folder-rail]::-webkit-scrollbar {
width: 4px;
}
@supports not selector(::-webkit-scrollbar) {
:root:not([data-native-scrollbars="on"]) [data-folder-rail] {
scrollbar-width: thin;
}
}
/* Enhanced Email Content Styling */
.email-content-wrapper {
@@ -617,8 +629,9 @@ optgroup {
--titlebar-right-inset: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw));
--titlebar-left-inset: env(titlebar-area-x, 0px);
--titlebar-row-height: env(titlebar-area-height, 0px);
/* Where a drawer from the window's edge starts (the folder drawer): under
the top bar, and under the window's controls when they are over the page. */
/* Where a drawer from the window's edge starts (Mail's folders, the
Calendar, Contacts and Files sidebars): under the top bar, and under the
window's controls when they are over the page. */
--drawer-top: max(var(--app-top-inset), var(--titlebar-row-height));
}
@@ -627,6 +640,17 @@ html[data-window-controls] [data-window-row-right] {
padding-right: calc(var(--titlebar-right-inset) + 0.5rem) !important;
}
/*
* The composer's header runs over its plugin panels. The head above the panel at the
* window's right takes that room inside itself, so it stays as wide as the panel and
* its Hide button stays at the panel's edge, with its window buttons left of the controls.
*/
html[data-window-controls]:not([dir="rtl"]) [data-window-row-right] > [data-composer-panel-head="right"],
html[data-window-controls][dir="rtl"] [data-window-row-right] > [data-composer-panel-head="left"] {
margin-right: calc(-1 * (var(--titlebar-right-inset) + 0.5rem));
padding-right: calc(var(--titlebar-right-inset) + 0.5rem);
}
/* Something floating at the top end of a page with no row: next to the controls, lined up. */
html[data-window-controls]:not([dir="rtl"]) [data-window-beside-controls] {
right: calc(var(--titlebar-right-inset) + 0.5rem);
@@ -866,3 +866,56 @@ describe('CalendarApp company calendars on a phone', () => {
}
});
});
// Below the full desktop the sidebar is the same drawer as Mail's folders
// (usability test 2026-11-04): from the window's edge, the page dimmed,
// Escape closes it, and the focus goes in and back to the menu button.
describe('CalendarApp sidebar drawer', () => {
beforeEach(() => {
media.desktop = false;
});
const drawer = () => screen.getByTestId('calendar-sidebar-drawer');
const menu = () => screen.getByRole('button', { name: 'nav_open_menu' });
it("opens from the window's edge, over the app rail and under the top bar", () => {
renderApp();
const classes = drawer().className.split(/\s+/);
expect(classes).toEqual(expect.arrayContaining(['fixed', 'start-0', 'top-[var(--drawer-top)]', 'bottom-0']));
expect(classes).not.toContain('absolute');
});
it("is out of reach while closed, so Tab doesn't walk into the hidden calendars", () => {
renderApp();
expect(drawer()).toHaveAttribute('inert');
fireEvent.click(menu());
expect(drawer()).not.toHaveAttribute('inert');
});
it('takes the focus in, keeps Tab there and gives it back to the menu button on Escape', () => {
renderApp();
menu().focus();
fireEvent.click(menu());
expect(drawer().contains(document.activeElement)).toBe(true);
const stops = Array.from(drawer().querySelectorAll<HTMLElement>('button:not(:disabled)'));
stops.at(-1)!.focus();
fireEvent.keyDown(stops.at(-1)!, { key: 'Tab' });
expect(document.activeElement).toBe(stops[0]);
fireEvent.keyDown(document.activeElement!, { key: 'Escape' });
expect(drawer()).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu());
});
it('closes on a click on the dimmed window and gives the focus back to the menu button', () => {
renderApp();
menu().focus();
fireEvent.click(menu());
const scrim = screen.getByTestId('drawer-scrim');
expect(scrim.className.split(/\s+/)).toEqual(expect.arrayContaining(['fixed', 'inset-0']));
(document.activeElement as HTMLElement).blur();
fireEvent.click(scrim);
expect(drawer()).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu());
});
});
+125 -121
View File
@@ -60,6 +60,7 @@ import { useIsFocusedProTab, useIsPaneScoped } from "@/hooks/use-pane-context";
import { useProMultiAccountCalendars } from "@/hooks/use-pro-multi-account-calendars";
import { useEventUserEmails } from "@/hooks/use-event-user-emails";
import { ResizeHandle } from "@/components/layout/resize-handle";
import { EdgeDrawer } from "@/components/layout/edge-drawer";
import { descriptionWithNote } from "@/lib/calendar-description";
import { filterTasksByCalendars } from "@/lib/calendar-tasks";
import { baseEventStoreId, isServerRecurrenceInstance } from "@/lib/recurrence-instances";
@@ -183,6 +184,7 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
// collapses into a burger-toggled overlay instead of taking inline space.
const isNarrow = !isFullDesktop;
const [narrowSidebarOpen, setNarrowSidebarOpen] = useState(false);
const closeNarrowSidebar = useCallback(() => setNarrowSidebarOpen(false), []);
useEffect(() => { if (!isNarrow) setNarrowSidebarOpen(false); }, [isNarrow]);
const { showAppsModal, inlineApp, loadedApps, handleManageApps, handleInlineApp, closeInlineApp, closeAppsModal } = useSidebarApps();
const { client, isAuthenticated, logout, checkAuth, switchAccount, activeAccountId, isLoading: authLoading } = useAuthStore();
@@ -2218,6 +2220,97 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
/>
);
// The sidebar's content: beside the views on the full desktop, a drawer below it.
const calendarSidebar = (
<>
<CalendarSidebarHeader
onCreateEvent={() => { setNarrowSidebarOpen(false); openCreateForView(); }}
createLabel={createLabel}
tourTarget={!isNarrow}
/>
<div className="flex-1 overflow-y-auto overflow-x-hidden py-3">
<div className="px-3">
<MiniCalendar
selectedDate={selectedDate}
displayMonth={miniMonth}
onSelectDate={handleMiniCalendarSelect}
onChangeMonth={handleMiniMonthChange}
events={events}
firstDayOfWeek={firstDayOfWeek}
showWeekNumbers={showWeekNumbers}
/>
</div>
<CalendarSidebarPanel
calendars={allCalendars}
selectedCalendarIds={shownCalendarIds}
onToggleVisibility={toggleShownCalendar}
onColorChange={client ? (calendarId, color) => {
if (calendarId === BIRTHDAY_CALENDAR_ID) {
updateSetting('birthdayCalendarColor', color);
return;
}
// Shared calendars: recolor locally only (the viewer usually
// can't write the owner's calendar, and it'd recolor it for
// everyone). Personal calendars write through to the server.
const cal = allCalendars.find((c) => c.id === calendarId);
if (cal?.isShared) {
setSharedCalendarColor(sharedCalendarColorKey(cal), color);
return;
}
updateCalendar(client, calendarId, { color });
} : undefined}
onResetColor={(cal) => {
// Drop the local override. A calendar with a server color goes
// back to it; one without gets a fresh unused color from the
// auto-assign effect (so it never reverts to a collision).
removeSharedCalendarColor(sharedCalendarColorKey(cal));
}}
onShareCalendar={client ? (cal) => setSharingCalendarId(cal.id) : undefined}
onCreateEvent={(cal: Calendar) => {
setDefaultCalendarIdForCreate(cal.id);
openCreateModal();
}}
onClearCalendar={client ? async (cal: Calendar) => {
const ok = await confirmAction({
title: tMgmt("clear_events"),
message: tMgmt("confirm_clear", { name: shownName.calendar(cal) }),
variant: "destructive",
confirmText: tMgmt("clear_events"),
});
if (!ok) return;
try {
const count = await clearCalendarEvents(client, cal.id);
toast.success(tMgmt("events_cleared", { count }));
} catch (err) {
// The store rethrows the server's reason (#434).
toast.error(err instanceof Error && err.message ? err.message : tMgmt("error_clear"));
}
} : undefined}
onDeleteCalendar={client ? async (cal: Calendar) => {
const ok = await confirmAction({
title: tMgmt("delete"),
message: tMgmt("confirm_delete", { name: shownName.calendar(cal) }),
variant: "destructive",
confirmText: tMgmt("delete"),
});
if (!ok) return;
try {
await removeCalendar(client, cal.id);
toast.success(tMgmt("calendar_deleted"));
} catch {
toast.error(tMgmt("error_delete"));
}
} : undefined}
onCreateCalendar={client ? () => setShowCreateCalendar(true) : undefined}
onSubscribe={canSubscribe ? () => setShowSubscriptionModal(true) : undefined}
onEditSubscription={(subId) => setEditingSubscription(subId)}
client={client}
multiAccountMode={multiAccountEnabled && accountClients.length > 1}
/>
</div>
</>
);
return (
<div className={cn("flex flex-col overflow-hidden pt-[var(--app-top-inset)]", mvShell ? "bg-[var(--mv-canvas)]" : "bg-background", isEmbedded ? "h-full" : "h-dvh")}>
{!isEmbedded && <SkipLink>{tShell("skip_to_content")}</SkipLink>}
@@ -2253,138 +2346,49 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
<InlineAppView apps={loadedApps} activeAppId={inlineApp!.id} onClose={closeInlineApp} className="flex-1" />
)}
{/* Narrow-pane backdrop: dim and close overlay sidebar */}
{isNarrow && narrowSidebarOpen && !inlineApp && (
<div
className={cn(
"inset-0 bg-black/50 z-40",
isEmbedded ? "absolute" : "fixed"
)}
onClick={() => setNarrowSidebarOpen(false)}
/>
)}
{!inlineApp && (
<div className="flex flex-col flex-1 min-w-0 min-h-0">
<div className="flex flex-1 min-w-0 min-h-0">
{/* Sidebar - in-flow when desktop pane, overlay when narrow */}
{(isNarrow || !sidebarCollapsed) && (
{/* The sidebar: in flow on the full desktop; below it a drawer from
the window's edge, over the app rail, as Mail's folders. */}
{isNarrow && (
<EdgeDrawer
open={narrowSidebarOpen}
onClose={closeNarrowSidebar}
contained={isEmbedded || mvShell}
// A closed drawer is off-screen: not a pane for F6.
data-pane={narrowSidebarOpen ? "sidebar" : undefined}
data-testid="calendar-sidebar-drawer"
className="border-e border-border bg-secondary overflow-hidden"
>
{calendarSidebar}
</EdgeDrawer>
)}
{!isNarrow && !sidebarCollapsed && (
<>
<div
// A closed drawer is off-screen: not a pane for F6.
data-pane={!isNarrow || narrowSidebarOpen ? "sidebar" : undefined}
data-pane="sidebar"
className={cn(
"border-e border-border bg-secondary flex flex-col overflow-hidden flex-shrink-0",
!isResizing && "transition-[width] duration-300",
isNarrow && cn(
"absolute inset-y-0 start-0 z-50 w-72 pt-[var(--app-top-inset)]",
"transform transition-transform duration-300 ease-in-out",
!narrowSidebarOpen && "-translate-x-full rtl:translate-x-full"
)
)}
style={isNarrow ? undefined : { width: `${calSidebarWidth}px` }}
style={{ width: `${calSidebarWidth}px` }}
>
<CalendarSidebarHeader
onCreateEvent={() => { setNarrowSidebarOpen(false); openCreateForView(); }}
createLabel={createLabel}
tourTarget={!isNarrow}
/>
<div className="flex-1 overflow-y-auto overflow-x-hidden py-3">
<div className="px-3">
<MiniCalendar
selectedDate={selectedDate}
displayMonth={miniMonth}
onSelectDate={handleMiniCalendarSelect}
onChangeMonth={handleMiniMonthChange}
events={events}
firstDayOfWeek={firstDayOfWeek}
showWeekNumbers={showWeekNumbers}
/>
</div>
<CalendarSidebarPanel
calendars={allCalendars}
selectedCalendarIds={shownCalendarIds}
onToggleVisibility={toggleShownCalendar}
onColorChange={client ? (calendarId, color) => {
if (calendarId === BIRTHDAY_CALENDAR_ID) {
updateSetting('birthdayCalendarColor', color);
return;
}
// Shared calendars: recolor locally only (the viewer usually
// can't write the owner's calendar, and it'd recolor it for
// everyone). Personal calendars write through to the server.
const cal = allCalendars.find((c) => c.id === calendarId);
if (cal?.isShared) {
setSharedCalendarColor(sharedCalendarColorKey(cal), color);
return;
}
updateCalendar(client, calendarId, { color });
} : undefined}
onResetColor={(cal) => {
// Drop the local override. A calendar with a server color goes
// back to it; one without gets a fresh unused color from the
// auto-assign effect (so it never reverts to a collision).
removeSharedCalendarColor(sharedCalendarColorKey(cal));
}}
onShareCalendar={client ? (cal) => setSharingCalendarId(cal.id) : undefined}
onCreateEvent={(cal: Calendar) => {
setDefaultCalendarIdForCreate(cal.id);
openCreateModal();
}}
onClearCalendar={client ? async (cal: Calendar) => {
const ok = await confirmAction({
title: tMgmt("clear_events"),
message: tMgmt("confirm_clear", { name: shownName.calendar(cal) }),
variant: "destructive",
confirmText: tMgmt("clear_events"),
});
if (!ok) return;
try {
const count = await clearCalendarEvents(client, cal.id);
toast.success(tMgmt("events_cleared", { count }));
} catch (err) {
// The store rethrows the server's reason (#434).
toast.error(err instanceof Error && err.message ? err.message : tMgmt("error_clear"));
}
} : undefined}
onDeleteCalendar={client ? async (cal: Calendar) => {
const ok = await confirmAction({
title: tMgmt("delete"),
message: tMgmt("confirm_delete", { name: shownName.calendar(cal) }),
variant: "destructive",
confirmText: tMgmt("delete"),
});
if (!ok) return;
try {
await removeCalendar(client, cal.id);
toast.success(tMgmt("calendar_deleted"));
} catch {
toast.error(tMgmt("error_delete"));
}
} : undefined}
onCreateCalendar={client ? () => setShowCreateCalendar(true) : undefined}
onSubscribe={canSubscribe ? () => setShowSubscriptionModal(true) : undefined}
onEditSubscription={(subId) => setEditingSubscription(subId)}
client={client}
multiAccountMode={multiAccountEnabled && accountClients.length > 1}
/>
</div>
{calendarSidebar}
</div>
{!isNarrow && (
<ResizeHandle
pane="sidebar"
value={calSidebarWidth}
min={180}
max={400}
onResizeStart={() => { dragStartWidth.current = calSidebarWidth; setIsResizing(true); }}
onResize={(delta) => setCalSidebarWidth(Math.max(180, Math.min(400, dragStartWidth.current + delta)))}
onResizeEnd={() => {
setIsResizing(false);
localStorage.setItem("calendar-sidebar-width", String(calSidebarWidth));
}}
onDoubleClick={() => { setCalSidebarWidth(256); localStorage.setItem("calendar-sidebar-width", "256"); }}
/>
)}
<ResizeHandle
pane="sidebar"
value={calSidebarWidth}
min={180}
max={400}
onResizeStart={() => { dragStartWidth.current = calSidebarWidth; setIsResizing(true); }}
onResize={(delta) => setCalSidebarWidth(Math.max(180, Math.min(400, dragStartWidth.current + delta)))}
onResizeEnd={() => {
setIsResizing(false);
localStorage.setItem("calendar-sidebar-width", String(calSidebarWidth));
}}
onDoubleClick={() => { setCalSidebarWidth(256); localStorage.setItem("calendar-sidebar-width", "256"); }}
/>
</>
)}
@@ -102,6 +102,48 @@ describe('ContactsApp', () => {
expect(within(drawer()).getByText('tabs.all')).toBeInTheDocument();
});
// The same drawer as Mail's folders (usability test 2026-11-04): it opened
// beside the app rail, ignored Escape and left the focus on the page.
it("opens the drawer from the window's edge, over the app rail and under the top bar", () => {
renderContacts();
const classes = drawer().className.split(/\s+/);
expect(classes).toEqual(expect.arrayContaining(['fixed', 'start-0', 'top-[var(--drawer-top)]', 'bottom-0']));
expect(classes).not.toContain('absolute');
});
it('takes the focus into the drawer, keeps Tab there and gives it back to the menu button on Escape', () => {
renderContacts();
const menu = screen.getAllByRole('button', { name: 'open_categories' })[0];
menu.focus();
fireEvent.click(menu);
// The category on screen.
const current = within(drawer()).getByRole('button', { name: /tabs\.all/ });
expect(document.activeElement).toBe(current);
const stops = Array.from(drawer().querySelectorAll<HTMLElement>('button:not(:disabled)'));
stops.at(-1)!.focus();
fireEvent.keyDown(stops.at(-1)!, { key: 'Tab' });
expect(document.activeElement).toBe(stops[0]);
fireEvent.keyDown(document.activeElement!, { key: 'Escape' });
expect(drawer()).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu);
});
it('dims the whole window behind the drawer and closes it on a click there, back to the menu button', () => {
renderContacts();
const menu = screen.getAllByRole('button', { name: 'open_categories' })[0];
menu.focus();
fireEvent.click(menu);
const scrim = screen.getByTestId('drawer-scrim');
expect(scrim.className.split(/\s+/)).toEqual(expect.arrayContaining(['fixed', 'inset-0']));
// A press on the scrim drops the focus to the page.
(document.activeElement as HTMLElement).blur();
fireEvent.click(scrim);
expect(drawer()).toHaveAttribute('inert');
expect(screen.queryByTestId('drawer-scrim')).toBeNull();
expect(document.activeElement).toBe(menu);
});
it("closes the drawer when something in it is picked, so it doesn't stay over the form", () => {
renderContacts();
fireEvent.click(screen.getAllByRole('button', { name: 'open_categories' })[0]);
+97 -97
View File
@@ -49,6 +49,7 @@ import { useIsEmbedded } from "@/hooks/use-is-embedded";
import { useIsFocusedProTab } from "@/hooks/use-pane-context";
import { useProMultiAccountContacts } from "@/hooks/use-pro-multi-account-contacts";
import { ResizeHandle } from "@/components/layout/resize-handle";
import { EdgeDrawer } from "@/components/layout/edge-drawer";
import { useIsFullDesktop, useIsMobile } from "@/hooks/use-media-query";
import { useRefreshGesture } from "@/hooks/use-refresh-gesture";
import type { ContactCard, AddressBook, AddressBookRights } from "@/lib/jmap/types";
@@ -210,6 +211,7 @@ function ContactsAppContent({ linkSegments: routeSegments }: ContactsAppProps =
// into a burger-toggled overlay.
const isNarrow = !isFullDesktop;
const [narrowSidebarOpen, setNarrowSidebarOpen] = useState(false);
const closeNarrowSidebar = useCallback(() => setNarrowSidebarOpen(false), []);
useEffect(() => { if (!isNarrow) setNarrowSidebarOpen(false); }, [isNarrow]);
// A new view (a form, a group, a contact) replaces whatever the drawer was for.
useEffect(() => { setNarrowSidebarOpen(false); }, [view]);
@@ -1285,6 +1287,60 @@ function ContactsAppContent({ linkSegments: routeSegments }: ContactsAppProps =
}
})();
// The categories: beside the list on the full desktop, a drawer below it.
const contactsSidebar = (
<ContactsSidebar
groups={groups}
individuals={individuals}
addressBooks={addressBooks}
activeCategory={activeCategory}
onSelectCategory={guard(handleSelectCategory)}
onCreateGroup={fromDrawer(guard(handleCreateGroup))}
onCreateContact={fromDrawer(guard(handleCreateNew))}
onCreateAddressBook={client ? fromDrawer(() => setCreatingAddressBook(true)) : undefined}
onImport={fromDrawer(() => setShowImportDialog(true))}
onEditGroup={fromDrawer(guard(handleEditGroupFromSidebar))}
onDeleteGroup={fromDrawer(handleDeleteGroupFromSidebar)}
onComposeGroup={fromDrawer(handleComposeGroupFromSidebar)}
onDropContacts={handleDropContacts}
onDropContactsToCategory={handleDropContactsToCategory}
onRenameAddressBook={client ? fromDrawer((book: AddressBook) => setRenamingAddressBook(book)) : undefined}
onShareAddressBook={client ? fromDrawer((book: AddressBook) => setSharingAddressBookId(book.id)) : undefined}
onSetDefaultAddressBook={client ? fromDrawer(async (book: AddressBook) => {
try {
await setDefaultAddressBook(client, book);
toast.success(t("address_books.default_updated"));
} catch {
toast.error(t("address_books.set_default_failed"));
}
}) : undefined}
onCreateContactInBook={fromDrawer(guard((book: AddressBook) => {
setDefaultBookIdForCreate(book.id);
setSelectedContact(null);
setView("create");
}))}
onDeleteAddressBook={client ? fromDrawer(async (book: AddressBook) => {
const ok = await confirmDialog({
title: t("address_books.delete_title"),
message: t("address_books.confirm_delete", { name: shownName.addressBook(book) }),
variant: "destructive",
confirmText: t("address_books.delete"),
});
if (!ok) return;
try {
await removeAddressBook(client, book);
toast.success(t("address_books.deleted"));
} catch {
toast.error(t("address_books.delete_failed"));
}
}) : undefined}
onRenameKeyword={fromDrawer((kw: string) => setRenamingKeyword(kw))}
onDeleteKeyword={fromDrawer((kw: string) => void handleDeleteKeyword(kw))}
directoryCount={showDirectory ? directoryPrincipals.length : undefined}
multiAccountMode={multiAccountEnabled && accountClients.length > 1}
/>
);
const mobileBackToList = () => {
if (returnToEmail) {
setReturnToEmail(false);
@@ -1331,105 +1387,49 @@ function ContactsAppContent({ linkSegments: routeSegments }: ContactsAppProps =
{inlineApp && (
<InlineAppView apps={loadedApps} activeAppId={inlineApp!.id} onClose={closeInlineApp} />
)}
{/* Clips the closed drawer, so it never sits over the nav rail. */}
{/* Holds the drawer in a Pro pane and clips it there when closed. */}
<div className={cn("relative flex flex-1 min-h-0 overflow-hidden", inlineApp && "hidden")}>
{/* Narrow-pane backdrop for the overlay categories sidebar */}
{isNarrow && narrowSidebarOpen && (
<div
className={cn(
"inset-0 bg-black/50 z-40",
isEmbedded ? "absolute" : "fixed"
)}
onClick={() => setNarrowSidebarOpen(false)}
/>
{/* Panel 1: the categories. Below the full desktop a drawer from the
window's edge, over the app rail, as Mail's folders. */}
{showListPanel && isNarrow && (
<EdgeDrawer
open={narrowSidebarOpen}
onClose={closeNarrowSidebar}
contained={isEmbedded || mvShell}
data-testid="contacts-sidebar-drawer"
data-pane="sidebar"
className="border-e border-border bg-background"
>
{contactsSidebar}
</EdgeDrawer>
)}
{showListPanel && !isNarrow && !isMobile && (
<>
<div
data-pane="sidebar"
className={cn(
"border-e border-border flex flex-col flex-shrink-0 bg-background",
!isSidebarResizing && "transition-[width] duration-300",
)}
style={{ width: `${sidebarWidth}px` }}
>
{contactsSidebar}
</div>
<ResizeHandle
pane="sidebar"
value={sidebarWidth}
min={180}
max={400}
onResizeStart={() => { sidebarDragStartWidth.current = sidebarWidth; setIsSidebarResizing(true); }}
onResize={(delta) => setSidebarWidth(Math.max(180, Math.min(400, sidebarDragStartWidth.current + delta)))}
onResizeEnd={() => {
setIsSidebarResizing(false);
localStorage.setItem("contacts-sidebar-width", String(sidebarWidth));
}}
onDoubleClick={() => { setSidebarWidth(256); localStorage.setItem("contacts-sidebar-width", "256"); }}
/>
</>
)}
{/* Panel 1: Categories sidebar (in-flow on desktop, overlay on narrow) */}
{showListPanel && (!isMobile || isNarrow) && (
<>
<div
data-testid={isNarrow ? "contacts-sidebar-drawer" : undefined}
data-pane="sidebar"
className={cn(
"border-e border-border flex flex-col flex-shrink-0 bg-background",
!isSidebarResizing && "transition-[width] duration-300",
isNarrow && cn(
"absolute inset-y-0 start-0 z-50 w-72 pt-[var(--app-top-inset)]",
"transform transition-[transform,visibility] duration-300 ease-in-out",
!narrowSidebarOpen && "invisible -translate-x-full rtl:translate-x-full"
)
)}
// Closed, the drawer is out of reach: no clicks, no Tab stops.
inert={isNarrow && !narrowSidebarOpen}
style={isNarrow ? undefined : { width: `${sidebarWidth}px` }}
>
<ContactsSidebar
groups={groups}
individuals={individuals}
addressBooks={addressBooks}
activeCategory={activeCategory}
onSelectCategory={guard(handleSelectCategory)}
onCreateGroup={fromDrawer(guard(handleCreateGroup))}
onCreateContact={fromDrawer(guard(handleCreateNew))}
onCreateAddressBook={client ? fromDrawer(() => setCreatingAddressBook(true)) : undefined}
onImport={fromDrawer(() => setShowImportDialog(true))}
onEditGroup={fromDrawer(guard(handleEditGroupFromSidebar))}
onDeleteGroup={fromDrawer(handleDeleteGroupFromSidebar)}
onComposeGroup={fromDrawer(handleComposeGroupFromSidebar)}
onDropContacts={handleDropContacts}
onDropContactsToCategory={handleDropContactsToCategory}
onRenameAddressBook={client ? fromDrawer((book: AddressBook) => setRenamingAddressBook(book)) : undefined}
onShareAddressBook={client ? fromDrawer((book: AddressBook) => setSharingAddressBookId(book.id)) : undefined}
onSetDefaultAddressBook={client ? fromDrawer(async (book: AddressBook) => {
try {
await setDefaultAddressBook(client, book);
toast.success(t("address_books.default_updated"));
} catch {
toast.error(t("address_books.set_default_failed"));
}
}) : undefined}
onCreateContactInBook={fromDrawer(guard((book: AddressBook) => {
setDefaultBookIdForCreate(book.id);
setSelectedContact(null);
setView("create");
}))}
onDeleteAddressBook={client ? fromDrawer(async (book: AddressBook) => {
const ok = await confirmDialog({
title: t("address_books.delete_title"),
message: t("address_books.confirm_delete", { name: shownName.addressBook(book) }),
variant: "destructive",
confirmText: t("address_books.delete"),
});
if (!ok) return;
try {
await removeAddressBook(client, book);
toast.success(t("address_books.deleted"));
} catch {
toast.error(t("address_books.delete_failed"));
}
}) : undefined}
onRenameKeyword={fromDrawer((kw: string) => setRenamingKeyword(kw))}
onDeleteKeyword={fromDrawer((kw: string) => void handleDeleteKeyword(kw))}
directoryCount={showDirectory ? directoryPrincipals.length : undefined}
multiAccountMode={multiAccountEnabled && accountClients.length > 1}
/>
</div>
{!isNarrow && (
<ResizeHandle
pane="sidebar"
value={sidebarWidth}
min={180}
max={400}
onResizeStart={() => { sidebarDragStartWidth.current = sidebarWidth; setIsSidebarResizing(true); }}
onResize={(delta) => setSidebarWidth(Math.max(180, Math.min(400, sidebarDragStartWidth.current + delta)))}
onResizeEnd={() => {
setIsSidebarResizing(false);
localStorage.setItem("contacts-sidebar-width", String(sidebarWidth));
}}
onDoubleClick={() => { setSidebarWidth(256); localStorage.setItem("contacts-sidebar-width", "256"); }}
/>
)}
</>
)}
{/* The list and the contact: the main content, after the sidebar. */}
<AppMain
+3
View File
@@ -323,6 +323,8 @@ export function ContactsSidebar({
{/* All contacts */}
<button
onClick={() => onSelectCategory("all")}
// Marked as the other categories are: the drawer opens on it.
aria-current={isAllActive ? "true" : undefined}
className={cn(
"w-full flex items-center gap-2 px-3 text-sm transition-colors min-h-8 pointer-coarse:min-h-11",
isAllActive
@@ -342,6 +344,7 @@ export function ContactsSidebar({
{directoryCount !== undefined && (
<button
onClick={() => onSelectCategory("directory")}
aria-current={activeCategory === "directory" ? "true" : undefined}
className={cn(
"w-full flex items-center gap-2 px-3 text-sm transition-colors min-h-8 pointer-coarse:min-h-11",
activeCategory === "directory"
@@ -585,6 +585,7 @@ describe('composer-sidebar and composer-sidebar-right', () => {
Element.prototype.getBoundingClientRect = function (this: Element) {
if (this.matches('[data-testid="email-composer"]')) return rect(100, 800);
if (this.matches('[data-composer-header]')) return rect(100, 156);
if (this.matches('[data-composer-panels]')) return rect(156, 800);
if (this.matches('[data-composer-footer]')) return rect(740, 800);
return original.call(this);
};
@@ -593,7 +594,9 @@ describe('composer-sidebar and composer-sidebar-right', () => {
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
fireEvent.click(document.querySelector('[data-composer-panel-toggle="right"]')!);
expect(panel('right').dataset.composerSidebarMode).toBe('overlay');
expect(panel('right').style.top).toBe('56px');
// The header is above the row the panel is laid over: the panel starts at that row's top.
expect(document.querySelector('[data-composer-panels]')!.contains(document.querySelector('[data-composer-header]'))).toBe(false);
expect(panel('right').style.top).toBe('0px');
expect(panel('right').style.bottom).toBe('60px');
} finally {
Element.prototype.getBoundingClientRect = original;
@@ -718,7 +721,7 @@ describe('composer-sidebar and composer-sidebar-right', () => {
// Opened once: it stays open for the next composer.
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
expect(panel('right').dataset.composerSidebarMode).toBe('docked');
fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_hide' }));
fireEvent.click(screen.getByRole('button', { name: 'hide_panel' }));
expect(panel('right').dataset.composerSidebarMode).toBe('folded');
});
@@ -742,11 +745,134 @@ describe('composer-sidebar and composer-sidebar-right', () => {
offerSlots('p1', ['composer-sidebar-right']);
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_show' }));
fireEvent.click(screen.getByRole('button', { name: 'show_panel' }));
expect(panel('right').dataset.composerSidebarMode).toBe('overlay');
expect(panel('right').className).toContain('absolute');
fireEvent.click(screen.getByRole('button', { name: 'plugin_panel_hide' }));
fireEvent.click(screen.getByRole('button', { name: 'hide_panel' }));
expect(panel('right').dataset.composerSidebarMode).toBe('folded');
});
});
// With a panel open, the composer's header runs over it: Full screen, Pop out
// and Close end the whole composer, not the message column in the middle of
// it. The panel's head (the header above it) has its own Hide button.
describe('the composer header with a plugin panel open', () => {
function stubWidth(width: number) {
class FixedWidthObserver {
constructor(private cb: ResizeObserverCallback) {}
observe(el: Element) {
if ((el as HTMLElement).dataset.testid !== 'email-composer') return;
this.cb([{ target: el, contentRect: { width, height: 700 } } as unknown as ResizeObserverEntry], this as unknown as ResizeObserver);
}
unobserve() {}
disconnect() {}
}
vi.stubGlobal('ResizeObserver', FixedWidthObserver);
}
const panel = (side: 'left' | 'right') => document.querySelector<HTMLElement>(`[data-composer-sidebar="${side}"]`)!;
const header = () => document.querySelector<HTMLElement>('[data-composer-header]')!;
const head = (side: 'left' | 'right') => document.querySelector<HTMLElement>(`[data-composer-panel-head="${side}"]`);
const buttons = (el: HTMLElement) => Array.from(el.querySelectorAll<HTMLElement>('button'));
afterEach(() => {
vi.unstubAllGlobals();
for (const side of ['left', 'right']) {
localStorage.removeItem(`composerPluginSidebarCollapsed:${side}`);
localStorage.removeItem(`composerPluginSidebarWidth:${side}`);
}
});
it('keeps Close the last control, at the end of the row over the open panel', () => {
stubWidth(1400);
offerSlots('p1', ['composer-sidebar-right']);
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
expect(panel('right').dataset.composerSidebarMode).toBe('docked');
// One row over the message and the panel: the panel is not beside the header.
expect(header().parentElement).toBe(screen.getByTestId('email-composer'));
expect(header().compareDocumentPosition(panel('right')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
// The part of it above the panel is as wide as the panel...
const right = head('right')!;
expect(header()).toContainElement(right);
expect(right.style.minWidth).toBe('260px');
// ...and ends with Full screen, Pop out and Close, Close last.
const all = buttons(header());
expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close'));
expect(right).toContainElement(screen.getByTestId('composer-close'));
expect(right).toContainElement(screen.getByTestId('composer-maximize'));
});
it('gives the open panel a Hide button in its head, and the header a Show button while it is folded', () => {
stubWidth(1400);
offerSlots('p1', ['composer-sidebar', 'composer-sidebar-right']);
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
for (const side of ['left', 'right'] as const) {
const hide = head(side)!.querySelector<HTMLElement>(`[data-composer-panel-hide="${side}"]`)!;
expect(hide).toBeTruthy();
expect(hide).toHaveAccessibleName('hide_panel');
expect(hide.getAttribute('title')).toBe('hide_panel');
expect(hide.getAttribute('aria-expanded')).toBe('true');
}
// At the panel's inner edge, where it meets the message: last in the left head, first in the right one.
expect(buttons(head('left')!).at(-1)!.dataset.composerPanelHide).toBe('left');
expect(buttons(head('right')!)[0].dataset.composerPanelHide).toBe('right');
fireEvent.click(head('right')!.querySelector('[data-composer-panel-hide]')!);
expect(panel('right').dataset.composerSidebarMode).toBe('folded');
expect(head('right')).toBeNull();
// Folded: one Show button in the header, before the window buttons; Close still last.
const show = screen.getByRole('button', { name: 'show_panel' });
expect(header()).toContainElement(show);
expect(show.getAttribute('aria-expanded')).toBe('false');
const all = buttons(header());
expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close'));
expect(all.indexOf(show)).toBeLessThan(all.indexOf(screen.getByTestId('composer-maximize')));
fireEvent.click(show);
expect(panel('right').dataset.composerSidebarMode).toBe('docked');
expect(head('right')).toContainElement(screen.getByTestId('composer-close'));
});
it('hides the panel with Hide and closes the composer only with Close', () => {
stubWidth(1400);
offerSlots('p1', ['composer-sidebar-right']);
const onClose = vi.fn();
render(<EmailComposer initialData={DRAFT} onClose={onClose} />);
const hide = head('right')!.querySelector<HTMLElement>('[data-composer-panel-hide]')!;
const close = screen.getByTestId('composer-close');
expect(hide).not.toBe(close);
expect(hide).not.toHaveAccessibleName(close.getAttribute('aria-label')!);
fireEvent.click(hide);
expect(panel('right').dataset.composerSidebarMode).toBe('folded');
expect(onClose).not.toHaveBeenCalled();
expect(screen.queryByRole('alertdialog')).toBeNull();
expect(screen.getByTestId('email-composer')).toBeInTheDocument();
fireEvent.click(screen.getByTestId('composer-close'));
expect(onClose.mock.calls.length > 0 || screen.queryByRole('alertdialog') !== null).toBe(true);
});
it('gives a panel laid over a narrow composer the same head', () => {
stubWidth(700);
offerSlots('p1', ['composer-sidebar-right']);
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} />);
fireEvent.click(screen.getByRole('button', { name: 'show_panel' }));
expect(panel('right').dataset.composerSidebarMode).toBe('overlay');
expect(head('right')).toContainElement(screen.getByTestId('composer-close'));
fireEvent.click(screen.getByRole('button', { name: 'hide_panel' }));
expect(panel('right').dataset.composerSidebarMode).toBe('folded');
});
it('keeps Close last in a composer that is its own window', () => {
stubWidth(1400);
offerSlots('p1', ['composer-sidebar-right']);
render(<EmailComposer initialData={DRAFT} onClose={vi.fn()} ownWindow={{}} />);
const all = buttons(header());
expect(all[all.length - 1]).toBe(screen.getByTestId('composer-close'));
expect(head('right')).toContainElement(screen.getByTestId('composer-close'));
});
});
+113 -25
View File
@@ -1,20 +1,25 @@
"use client";
// The composer-sidebar and composer-sidebar-right plugin panels. Each has a
// width the user can drag (kept across composers) and a button in the
// composer's header that shows and hides it (the left panel's at the start,
// the right one's at the end, like the reader's). Folded, a panel takes no
// room at all. When the composer is too narrow for an open panel next to
// it, the panel folds by itself (right first); opening it anyway lays it
// over the composer instead of squeezing the message into a column nobody
// can write in. Laid over, it stays between the composer's header and its
// bottom bar: the panel's own button, Close and Send stay in reach.
// width the user can drag (kept across composers). The composer's header
// runs across the whole composer, panels included, so its window buttons
// (Full screen, Pop out, Close) stay at the far end of it, as Outlook and
// Gmail have them. The part of that row above an open panel is the
// panel's head: it holds "Hide <panel>", at the panel's inner edge. A
// folded panel takes no room at all, and a "Show <panel>" button in the
// header brings it back (the left panel's at the start, the right one's
// before the window buttons). When the composer is too narrow for an open
// panel next to it, the panel folds by itself (right first); opening it
// anyway lays it over the composer instead of squeezing the message into a
// column nobody can write in. Laid over, it stays between the header and
// the bottom bar: Hide, Close and Send stay in reach.
import { useEffect, useLayoutEffect, useRef, useState, type RefObject } from "react";
import { useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from "react";
import { useTranslations } from "next-intl";
import { PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen } from "@/components/icons";
import { PluginSlot } from "@/components/plugins/plugin-slot";
import { usePluginSlotOffers } from "@/hooks/use-plugin-slot-offers";
import { get as getActivePlugin } from "@/lib/plugin-sandbox/registry";
import { onPanelRequest, type PanelRequest } from "@/lib/plugin-sandbox/panel-requests";
import { ResizeHandle } from "@/components/layout/resize-handle";
import { cn } from "@/lib/utils";
@@ -196,40 +201,123 @@ export function useComposerSidebars(root: HTMLElement | null, composerId: string
}
};
return { modes, open, close, toggle, focusRequests, widths, setSideWidth };
// What the panels are called in their Show and Hide buttons: their plugins' names.
const nameOf = (offers: readonly { pluginId: string }[]) =>
offers.map((o) => getActivePlugin(o.pluginId)?.plugin.name).filter((n): n is string => !!n).join(", ") || null;
const names: Record<ComposerSidebarSide, string | null> = { left: nameOf(leftOffers), right: nameOf(rightOffers) };
return { modes, open, close, toggle, focusRequests, widths, setSideWidth, names };
}
/** The button in the composer's header that shows and hides one panel (none on phones). */
export function ComposerPanelToggle({
side,
mode,
onToggle,
className,
}: {
/** Open beside the composer or over it: on screen, with a head in the header row. */
export function isPanelOpen(mode: ComposerSidebarMode | null): boolean {
return mode === "docked" || mode === "overlay";
}
/** The Show or Hide button of one panel. */
function PanelButton({ side, open, name, onToggle, className }: {
side: ComposerSidebarSide;
mode: ComposerSidebarMode | null;
open: boolean;
name: string | null;
onToggle: () => void;
className?: string;
}) {
const t = useTranslations("email_viewer");
if (!mode) return null;
const isOpen = mode !== "folded";
const Icon = side === "left" ? (isOpen ? PanelLeftClose : PanelLeftOpen) : (isOpen ? PanelRightClose : PanelRightOpen);
const t = useTranslations("composer_panel");
const tViewer = useTranslations("email_viewer");
const label = name
? t(open ? "hide_panel" : "show_panel", { name })
: tViewer(open ? "plugin_panel_hide" : "plugin_panel_show");
const Icon = side === "left" ? (open ? PanelLeftClose : PanelLeftOpen) : (open ? PanelRightClose : PanelRightOpen);
return (
<button
type="button"
onClick={(e) => { e.stopPropagation(); onToggle(); }}
className={cn("hidden md:grid h-8 w-8 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground", className)}
title={t(isOpen ? "plugin_panel_hide" : "plugin_panel_show")}
aria-label={t(isOpen ? "plugin_panel_hide" : "plugin_panel_show")}
aria-pressed={isOpen}
title={label}
aria-label={label}
aria-expanded={open}
data-composer-panel-toggle={side}
data-composer-panel-hide={open ? side : undefined}
>
<Icon className="h-4 w-4 rtl:-scale-x-100" />
</button>
);
}
/**
* The button in the composer's header that brings a folded panel back (none
* on phones). An open panel's Hide button is in its head instead
* (ComposerPanelHead).
*/
export function ComposerPanelToggle({
side,
mode,
name = null,
onToggle,
className,
}: {
side: ComposerSidebarSide;
mode: ComposerSidebarMode | null;
name?: string | null;
onToggle: () => void;
className?: string;
}) {
if (mode !== "folded") return null;
return <PanelButton side={side} open={false} name={name} onToggle={onToggle} className={className} />;
}
/**
* The part of the composer's header row above an open panel, as wide as the
* panel: its Hide button at the panel's inner edge, and for the right panel
* whatever else ends the row (the window buttons, Close last), so they stay
* at the far end of the composer. On phones there are no panels, and no head.
*/
export function ComposerPanelHead({
side,
mode,
width = COMPOSER_SIDEBAR_WIDTH,
name = null,
onToggle,
className,
childrenClassName,
children,
}: {
side: ComposerSidebarSide;
mode: ComposerSidebarMode | null;
width?: number;
name?: string | null;
onToggle: () => void;
/** Padding of the row it is part of. */
className?: string;
/** The gap between what it holds besides Hide, as in the row it is part of. */
childrenClassName?: string;
children?: ReactNode;
}) {
if (!isPanelOpen(mode)) return null;
const hide = <PanelButton side={side} open name={name} onToggle={onToggle} />;
return (
<div
className={cn(
// Below md, where panels aren't shown, only what it holds besides Hide
// shows, at the end of the row (one laid over a composer that got narrower).
"contents md:flex shrink-0 items-center self-stretch border-border",
side === "left" ? "border-e" : "border-s",
className,
)}
// At least the panel's width, so Hide sits at the panel's edge; more when
// the buttons need it (a narrow panel in the desktop app, beside its controls).
style={{ minWidth: width }}
data-composer-panel-head={side}
>
{side === "right" && hide}
<div className="hidden md:block flex-1" />
{/* No gap of the head's own around Hide and the space: a 260 px panel in the desktop app has just enough room for the buttons. */}
{children && <div className={cn("contents md:flex items-center", childrenClassName)}>{children}</div>}
{side === "left" && hide}
</div>
);
}
const COMPOSER_HEADER = "[data-composer-header], [data-mv-compose-titlebar], [data-mv-compose-inline-bar]";
const COMPOSER_FOOTER = "[data-composer-footer]";
+164 -112
View File
@@ -92,7 +92,7 @@ import { useIdentityStore } from "@/stores/identity-store";
import { useProMultiAccountIdentities, stripCrossAccountIdentityPrefix } from "@/hooks/use-pro-multi-account-identities";
import { useAccountStore } from "@/stores/account-store";
import { useSettingsStore } from "@/stores/settings-store";
import { ComposerPanelToggle, ComposerPluginSidebar, useComposerSidebars } from "./composer-plugin-sidebars";
import { ComposerPanelHead, ComposerPanelToggle, ComposerPluginSidebar, isPanelOpen, useComposerSidebars } from "./composer-plugin-sidebars";
import { dragKindFromTypes } from "@/components/pro/pro-shell-drop";
import { useIsPaneScoped } from "@/hooks/use-pane-context";
import { ComposerSelectionMenu, useComposerSelectionMenu } from "./composer-selection-menu";
@@ -3621,13 +3621,28 @@ export function EmailComposer({
[pluginDraft, pluginSelection, pluginComposerId, pluginSidebars.focusRequests.right],
);
// The buttons that show and hide the plugin panels, in the header.
const leftPanelToggle = pluginSidebars.modes.left
? <ComposerPanelToggle side="left" mode={pluginSidebars.modes.left} onToggle={() => pluginSidebars.toggle('left')} />
// The plugin panels in the header row: a folded one's Show button, and an
// open one's head with its Hide button (see composer-plugin-sidebars.tsx).
const leftPanelToggle = pluginSidebars.modes.left === 'folded'
? <ComposerPanelToggle side="left" mode="folded" name={pluginSidebars.names.left} onToggle={() => pluginSidebars.toggle('left')} />
: null;
const rightPanelToggle = pluginSidebars.modes.right
? <ComposerPanelToggle side="right" mode={pluginSidebars.modes.right} onToggle={() => pluginSidebars.toggle('right')} />
const rightPanelToggle = pluginSidebars.modes.right === 'folded'
? <ComposerPanelToggle side="right" mode="folded" name={pluginSidebars.names.right} onToggle={() => pluginSidebars.toggle('right')} />
: null;
const rightPanelOpen = isPanelOpen(pluginSidebars.modes.right);
const panelHead = (side: 'left' | 'right', className: string, children?: React.ReactNode, childrenClassName?: string) => (
<ComposerPanelHead
side={side}
mode={pluginSidebars.modes[side]}
width={pluginSidebars.widths[side]}
name={pluginSidebars.names[side]}
onToggle={() => pluginSidebars.toggle(side)}
className={className}
childrenClassName={childrenClassName}
>
{children}
</ComposerPanelHead>
);
// The right-click menu on selected text, when a plugin put entries in it.
const selectionMenu = useComposerSelectionMenu();
@@ -4737,6 +4752,86 @@ export function EmailComposer({
</button>
);
// What ends the header row: the window buttons, Close last. With the right
// panel open they end its head instead, at the far end of the composer.
const windowButtons = (
<>
{canMaximize && (
<button
type="button"
onClick={() => setMaximized((v) => !v)}
className="hidden md:grid h-8 w-8 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={maximized ? t('restore') : t('maximize')}
title={maximized ? t('restore') : t('maximize')}
data-testid="composer-maximize"
>
{maximized ? <Minimize2 className="w-4 h-4" /> : <Maximize2 className="w-4 h-4" />}
</button>
)}
{popOutButton(cn(phoneLayout ? "hidden md:grid" : "grid", "h-8 w-8 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"), "w-4 h-4")}
{!closeBesideControls && composerCloseButton}
</>
);
const mvInlineButtons = mvWindow && (
<>
{mvWindow.popOut && (
<button
type="button"
onClick={mvWindow.popOut}
className="grid h-8 w-8 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={t('pop_out')}
title={t('pop_out')}
>
<ExternalLink className="h-4 w-4" />
</button>
)}
{popOutButton("grid h-8 w-8 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground", "h-4 w-4")}
<button
type="button"
onClick={() => handleClose()}
className="grid h-8 w-8 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={tCommon('close')}
title={tCommon('close')}
>
<X className="h-4 w-4" />
</button>
</>
);
const mvWindowButtons = mvWindow && (
<>
{mvWindow.state !== "minimized" && popOutButton("grid h-7 w-7 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground", "h-4 w-4")}
<button
type="button"
onClick={(e) => { e.stopPropagation(); mvWindow.setState(mvWindow.state === "minimized" ? "normal" : "minimized"); }}
className="grid h-7 w-7 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={mvWindow.state === "minimized" ? t("restore") : t("minimize")}
title={mvWindow.state === "minimized" ? t("restore") : t("minimize")}
>
<Minus className="h-4 w-4" />
</button>
<button
type="button"
onClick={(e) => { e.stopPropagation(); mvWindow.setState(mvWindow.state === "maximized" ? "normal" : "maximized"); }}
className="grid h-7 w-7 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={mvWindow.state === "maximized" ? t("restore") : t("maximize")}
title={mvWindow.state === "maximized" ? t("restore") : t("maximize")}
>
{mvWindow.state === "maximized" ? <Minimize2 className="h-4 w-4" /> : <Maximize2 className="h-4 w-4" />}
</button>
<button
type="button"
onClick={(e) => { e.stopPropagation(); handleClose(); }}
className="grid h-7 w-7 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={tCommon('close')}
title={tCommon('close')}
>
<X className="h-4 w-4" />
</button>
</>
);
// Files dropped on the header attach, as on the rest of the message.
const headerDropProps = { onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop };
// `keepDraft`: the bin's discard, which deletes the draft once its Undo is
// over, not here.
const handleDiscardAndClose = ({ keepDraft = false }: { keepDraft?: boolean } = {}) => {
@@ -5019,8 +5114,11 @@ export function EmailComposer({
data-testid="email-composer"
// Edits made while the draft moves wouldn't move with it.
inert={isPoppingOut || undefined}
// The header row on top, across the plugin panels too, so the window
// buttons and Close end the whole composer; panels and message below.
data-tour="composer"
className={cn(
"flex h-full bg-background relative",
"flex flex-col h-full bg-background relative",
className,
// Over everything but dialogs (z-60) and toasts; below the desktop app's window controls.
// At the folder sidebar's z-50 and after it in the page, so over it (compose-p2-5).
@@ -5039,112 +5137,57 @@ export function EmailComposer({
<div role="status" aria-live="polite" aria-atomic="true" className="sr-only" data-testid="composer-live-region">
{liveMessage && <span key={liveMessage.n}>{liveMessage.text}</span>}
</div>
<ComposerPluginSidebar side="left" mode={pluginSidebars.modes.left} extraProps={pluginSidebarLeftProps} width={pluginSidebars.widths.left} onWidthChange={(w) => pluginSidebars.setSideWidth('left', w)} />
{/* Right-side composer sidebar slot is rendered after the main content div below. */}
<div
className="flex flex-col h-full bg-background relative flex-1 min-w-0"
data-tour="composer"
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDragOver={handleDragOver}
onDrop={handleDrop}
>
{/* Drag overlay */}
{isDraggingOver && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-background/80 border-2 border-dashed border-primary rounded-lg pointer-events-none">
<div className="flex flex-col items-center gap-2 text-primary">
<Paperclip className="w-8 h-8" />
<span className="text-sm font-medium">{t('drop_files')}</span>
</div>
</div>
)}
{/* Header - mobile: clean bar with close/send, desktop: title bar.
In Mountain View's window it is the window's title bar instead. */}
{mvWindow?.variant === "inline" ? (
<div className="flex items-center gap-2 h-10 ps-4 pe-1.5 shrink-0 border-b border-border/50" data-mv-compose-inline-bar="">
{mode === 'replyAll'
? <ReplyAll className="w-4 h-4 text-muted-foreground flex-shrink-0" />
: mode === 'forward'
? <Forward className="w-4 h-4 text-muted-foreground flex-shrink-0" />
: <Reply className="w-4 h-4 text-muted-foreground flex-shrink-0" />}
<h3 className="flex-1 min-w-0 truncate text-sm" data-testid="composer-save-status" data-status={saveStatus}>
{mode === 'reply' ? t('reply') : mode === 'replyAll' ? t('reply_all') : mode === 'forward' ? t('forward') : t('new_message')}
</h3>
{saveStatus === 'saving' && <Save className="w-3.5 h-3.5 animate-pulse text-muted-foreground flex-shrink-0" aria-label={t('saving')} />}
{leftPanelToggle}
{rightPanelToggle}
{mvWindow.popOut && (
<button
type="button"
onClick={mvWindow.popOut}
className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={t('pop_out')}
title={t('pop_out')}
>
<ExternalLink className="h-4 w-4" />
</button>
)}
{popOutButton("grid h-8 w-8 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground", "h-4 w-4")}
<button
type="button"
onClick={() => handleClose()}
className="grid h-8 w-8 place-items-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={tCommon('close')}
title={tCommon('close')}
>
<X className="h-4 w-4" />
</button>
<div className="flex items-stretch h-10 shrink-0 border-b border-border/50" data-mv-compose-inline-bar="" {...headerDropProps}>
{panelHead('left', 'px-1.5')}
<div className="flex-1 min-w-0 flex items-center gap-2 ps-4 pe-1.5">
{mode === 'replyAll'
? <ReplyAll className="w-4 h-4 text-muted-foreground flex-shrink-0" />
: mode === 'forward'
? <Forward className="w-4 h-4 text-muted-foreground flex-shrink-0" />
: <Reply className="w-4 h-4 text-muted-foreground flex-shrink-0" />}
<h3 className="flex-1 min-w-0 truncate text-sm" data-testid="composer-save-status" data-status={saveStatus}>
{mode === 'reply' ? t('reply') : mode === 'replyAll' ? t('reply_all') : mode === 'forward' ? t('forward') : t('new_message')}
</h3>
{saveStatus === 'saving' && <Save className="w-3.5 h-3.5 animate-pulse text-muted-foreground flex-shrink-0" aria-label={t('saving')} />}
{leftPanelToggle}
{rightPanelToggle}
{!rightPanelOpen && mvInlineButtons}
</div>
{panelHead('right', 'ps-1.5 pe-1.5', mvInlineButtons, 'gap-2')}
</div>
) : mvWindow ? (
<div
className={cn(
"flex items-center gap-1 h-10 ps-4 pe-1.5 shrink-0 bg-[var(--mv-search-bg)]",
"flex items-stretch h-10 shrink-0 bg-[var(--mv-search-bg)]",
mvWindow.state === "minimized" && "cursor-pointer",
)}
data-mv-compose-titlebar=""
onClick={mvWindow.state === "minimized" ? () => mvWindow.setState("normal") : undefined}
{...headerDropProps}
>
<h3 className="flex-1 min-w-0 truncate text-sm font-medium" data-testid="composer-save-status" data-status={saveStatus}>
{mode === 'reply' || mode === 'replyAll' || mode === 'forward'
? (subject || t('new_message'))
: t('new_message')}
</h3>
{saveStatus === 'saving' && <Save className="w-3.5 h-3.5 animate-pulse text-muted-foreground flex-shrink-0" aria-label={t('saving')} />}
{mvWindow.state !== "minimized" && leftPanelToggle}
{mvWindow.state !== "minimized" && rightPanelToggle}
{mvWindow.state !== "minimized" && popOutButton("grid h-7 w-7 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground", "h-4 w-4")}
<button
type="button"
onClick={(e) => { e.stopPropagation(); mvWindow.setState(mvWindow.state === "minimized" ? "normal" : "minimized"); }}
className="grid h-7 w-7 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={mvWindow.state === "minimized" ? t("restore") : t("minimize")}
title={mvWindow.state === "minimized" ? t("restore") : t("minimize")}
>
<Minus className="h-4 w-4" />
</button>
<button
type="button"
onClick={(e) => { e.stopPropagation(); mvWindow.setState(mvWindow.state === "maximized" ? "normal" : "maximized"); }}
className="grid h-7 w-7 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={mvWindow.state === "maximized" ? t("restore") : t("maximize")}
title={mvWindow.state === "maximized" ? t("restore") : t("maximize")}
>
{mvWindow.state === "maximized" ? <Minimize2 className="h-4 w-4" /> : <Maximize2 className="h-4 w-4" />}
</button>
<button
type="button"
onClick={(e) => { e.stopPropagation(); handleClose(); }}
className="grid h-7 w-7 place-items-center rounded-full text-muted-foreground hover:bg-foreground/10 hover:text-foreground"
aria-label={tCommon('close')}
title={tCommon('close')}
>
<X className="h-4 w-4" />
</button>
{mvWindow.state !== "minimized" && panelHead('left', 'px-1.5')}
<div className="flex-1 min-w-0 flex items-center gap-1 ps-4 pe-1.5">
<h3 className="flex-1 min-w-0 truncate text-sm font-medium" data-testid="composer-save-status" data-status={saveStatus}>
{mode === 'reply' || mode === 'replyAll' || mode === 'forward'
? (subject || t('new_message'))
: t('new_message')}
</h3>
{saveStatus === 'saving' && <Save className="w-3.5 h-3.5 animate-pulse text-muted-foreground flex-shrink-0" aria-label={t('saving')} />}
{mvWindow.state !== "minimized" && leftPanelToggle}
{mvWindow.state !== "minimized" && rightPanelToggle}
{(mvWindow.state === "minimized" || !rightPanelOpen) && mvWindowButtons}
</div>
{mvWindow.state !== "minimized" && panelHead('right', 'ps-1.5 pe-1.5', mvWindowButtons, 'gap-1')}
</div>
) : (
<div ref={setComposerHeader} className="flex items-center gap-3 px-4 py-2 md:py-0 md:h-14 border-b bg-background shrink-0" data-composer-header="">
<div ref={setComposerHeader} className="flex items-stretch md:h-14 border-b bg-background shrink-0" data-composer-header="" {...headerDropProps}>
{panelHead('left', 'px-2')}
<div className="flex-1 min-w-0 flex items-center gap-3 px-4 py-2 md:py-0">
{closeBesideControls && composerCloseButton}
{/* The left panel's button at the start, the right one's at the end: where each panel is. */}
{/* A folded panel's Show button where the panel goes: the left one's at the start, the right one's before the window buttons. */}
{leftPanelToggle && <div className="hidden md:flex -ms-2">{leftPanelToggle}</div>}
<div className="flex-1 min-w-0 flex items-center gap-3">
<div className="flex items-center gap-2" data-testid="composer-save-status" data-status={saveStatus}>
@@ -5214,23 +5257,31 @@ export function EmailComposer({
</Button>
))}
{rightPanelToggle}
{canMaximize && (
<button
type="button"
onClick={() => setMaximized((v) => !v)}
className="hidden md:grid h-8 w-8 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
aria-label={maximized ? t('restore') : t('maximize')}
title={maximized ? t('restore') : t('maximize')}
data-testid="composer-maximize"
>
{maximized ? <Minimize2 className="w-4 h-4" /> : <Maximize2 className="w-4 h-4" />}
</button>
)}
{popOutButton(cn(phoneLayout ? "hidden md:grid" : "grid", "h-8 w-8 place-items-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"), "w-4 h-4")}
{!closeBesideControls && composerCloseButton}
{!rightPanelOpen && windowButtons}
</div>
{panelHead('right', 'ps-1.5 pe-4', windowButtons, 'gap-3')}
</div>
)}
{/* The left panel, the message and the right panel, under the header. */}
<div className="flex flex-1 min-h-0 relative" data-composer-panels="">
<ComposerPluginSidebar side="left" mode={pluginSidebars.modes.left} extraProps={pluginSidebarLeftProps} width={pluginSidebars.widths.left} onWidthChange={(w) => pluginSidebars.setSideWidth('left', w)} />
<div
className="flex flex-col h-full bg-background relative flex-1 min-w-0"
onDragEnter={handleDragEnter}
onDragLeave={handleDragLeave}
onDragOver={handleDragOver}
onDrop={handleDrop}
>
{/* Drag overlay */}
{isDraggingOver && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-background/80 border-2 border-dashed border-primary rounded-lg pointer-events-none">
<div className="flex flex-col items-center gap-2 text-primary">
<Paperclip className="w-8 h-8" />
<span className="text-sm font-medium">{t('drop_files')}</span>
</div>
</div>
)}
{/* Fields + body. While pinFields holds, the fields sit outside the
body's scroll container so From/To/Cc/Bcc/Subject stay reachable
while scrolling long bodies, matching the pinned formatting toolbar
@@ -6306,6 +6357,7 @@ export function EmailComposer({
)}
</div>
<ComposerPluginSidebar side="right" mode={pluginSidebars.modes.right} extraProps={pluginSidebarRightProps} width={pluginSidebars.widths.right} onWidthChange={(w) => pluginSidebars.setSideWidth('right', w)} />
</div>
<ComposerSelectionMenu menu={selectionMenu} composerId={pluginComposerId} onClipboard={clipboardFromMenu} />
</div>
);
@@ -366,6 +366,53 @@ describe('FileBrowser', () => {
expect(drawer).not.toHaveAttribute('inert');
});
// The same drawer as Mail's folders (usability test 2026-11-04): it opened
// beside the app rail with only the file list dimmed, ignored Escape and
// left the focus on the page.
it("opens the folder drawer from the window's edge, with the whole window dimmed", () => {
renderBrowser();
const drawer = screen.getByTestId('files-sidebar-drawer');
const classes = drawer.className.split(/\s+/);
expect(classes).toEqual(expect.arrayContaining(['fixed', 'start-0', 'top-[var(--drawer-top)]', 'bottom-0']));
expect(classes).not.toContain('absolute');
tree();
expect(screen.getByTestId('drawer-scrim').className.split(/\s+/)).toEqual(expect.arrayContaining(['fixed', 'inset-0']));
});
it('takes the focus into the folder drawer, keeps Tab there and gives it back on Escape without clearing the search', () => {
renderBrowser();
const drawer = screen.getByTestId('files-sidebar-drawer');
const menu = screen.getByRole('button', { name: 'open_folder_tree' });
fireEvent.change(screen.getAllByRole('searchbox')[0], { target: { value: 'notes' } });
menu.focus();
fireEvent.click(menu);
// The folder on screen.
expect(drawer.contains(document.activeElement)).toBe(true);
expect(document.activeElement).toHaveAttribute('aria-current', 'page');
const stops = Array.from(drawer.querySelectorAll<HTMLElement>('button:not(:disabled)'));
stops.at(-1)!.focus();
fireEvent.keyDown(stops.at(-1)!, { key: 'Tab' });
expect(document.activeElement).toBe(stops[0]);
fireEvent.keyDown(document.activeElement!, { key: 'Escape' });
expect(drawer).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu);
expect(screen.getAllByRole('searchbox')[0]).toHaveValue('notes');
});
it('closes the folder drawer on a click on the dimmed window and gives the focus back to the menu button', () => {
renderBrowser();
const drawer = screen.getByTestId('files-sidebar-drawer');
const menu = screen.getByRole('button', { name: 'open_folder_tree' });
menu.focus();
fireEvent.click(menu);
// A press on the scrim drops the focus to the page.
(document.activeElement as HTMLElement).blur();
fireEvent.click(screen.getByTestId('drawer-scrim'));
expect(drawer).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu);
});
it("renames in a dialog that selects the name without its extension and closes on Escape", async () => {
renderBrowser({ props: { selectedResources: new Set(['notes.txt']) } });
fireEvent.keyDown(window, { key: 'F2' });
+17 -15
View File
@@ -32,6 +32,8 @@ import { INTERNAL_DRAG_TYPE, isInternalDrag, readDraggedNames } from "@/componen
import { ResizeHandle } from "@/components/layout/resize-handle";
import { AppMain } from "@/components/layout/app-landmarks";
import { useIsEmbedded } from "@/hooks/use-is-embedded";
import { useMountainViewShell } from "@/hooks/use-mountain-view-shell";
import { EdgeDrawer } from "@/components/layout/edge-drawer";
import { getDroppedFilesAndFolders } from "@/lib/webdav/drop-utils";
import { getFilePreviewKind } from "@/lib/file-preview";
import type { FileAppAction } from "@/lib/files-app-actions";
@@ -298,6 +300,7 @@ export function FileBrowser({
const isMobile = useIsMobile();
const touch = useMediaQuery("(pointer: coarse)") && isMobile;
const [narrowSidebarOpen, setNarrowSidebarOpen] = useState(false);
const closeNarrowSidebar = useCallback(() => setNarrowSidebarOpen(false), []);
useEffect(() => { if (!isNarrow) setNarrowSidebarOpen(false); }, [isNarrow]);
useEffect(() => { setNarrowSidebarOpen(false); }, [currentPath]);
// Anything picked in the drawer closes it (R7).
@@ -844,6 +847,8 @@ export function FileBrowser({
return;
}
if (e.key === "Escape") {
// The folder drawer is the innermost layer; it closes itself (R8).
if (narrowSidebarOpen) return;
// The details panel over the list closes first (innermost layer, R8).
if (showDetails && isNarrow) toggleDetails(false);
else if (searchQuery) setSearchQuery("");
@@ -906,7 +911,7 @@ export function FileBrowser({
return () => window.removeEventListener("keydown", handler);
}, [
showNewFolder, showNewTextFile, renameTarget, renameFolder, shareTargetId, moveTarget, accountPickerMode, selectedList, singleSelected, inTrash,
showDetails, isNarrow, toggleDetails,
showDetails, isNarrow, toggleDetails, narrowSidebarOpen,
selectAllVisible, onCopy, onCut, onPaste, clipboard, searchQuery, onClearSelection, deleteNames, openResource,
focusedName, onToggleSelect, currentPath, navigateUp, viewMode, gridColumns, moveFocus, displayResources,
]);
@@ -1107,6 +1112,8 @@ export function FileBrowser({
const tSidebar = useTranslations("sidebar");
const tShell = useTranslations("shell");
const isEmbedded = useIsEmbedded();
// Mountain View's card holds the drawer, under its top bar.
const mvShell = useMountainViewShell(isEmbedded);
useRegisterCommands(tSidebar("files"), [
{ id: "upload-files", label: tMenu("files_upload_files"), icon: Upload, run: () => fileInputRef.current?.click(), when: () => canCreate },
{ id: "upload-folder", label: tMenu("files_upload_folder"), icon: FolderUp, run: () => folderInputRef.current?.click(), when: () => canCreate },
@@ -1312,26 +1319,21 @@ export function FileBrowser({
} : null;
return (
// Clips the closed drawer, so it never sits over the nav rail.
// Holds the drawer in a Pro pane and clips it there when closed.
<div className="relative flex flex-1 min-h-0 overflow-hidden">
{/* Folder sidebar: in flow on desktop, a drawer on narrow panes */}
{sidebar && isNarrow && narrowSidebarOpen && (
<div className="absolute inset-0 bg-black/50 z-40" onClick={() => setNarrowSidebarOpen(false)} />
)}
{/* Folder sidebar: in flow on the full desktop; below it a drawer from
the window's edge, over the app rail, as Mail's folders. */}
{sidebar && (isNarrow ? (
<div
<EdgeDrawer
open={narrowSidebarOpen}
onClose={closeNarrowSidebar}
contained={isEmbedded || mvShell}
data-testid="files-sidebar-drawer"
data-pane="sidebar"
className={cn(
"absolute inset-y-0 start-0 z-50 w-72 border-e border-border",
"transform transition-[transform,visibility] duration-300 ease-in-out",
!narrowSidebarOpen && "invisible -translate-x-full rtl:translate-x-full",
)}
// Closed, the drawer is out of reach: no clicks, no Tab stops.
inert={!narrowSidebarOpen}
className="border-e border-border"
>
{sidebar}
</div>
</EdgeDrawer>
) : (
<>
<div
@@ -0,0 +1,65 @@
import { useState } from 'react';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { EdgeDrawer } from '../edge-drawer';
// The drawer Calendar, Contacts and Files open below the full desktop, with
// the keyboard side Mail's phone drawer uses too (useEdgeDrawer).
function Harness({ contained = false, onPickFocus }: { contained?: boolean; onPickFocus?: () => void }) {
const [open, setOpen] = useState(false);
return (
<>
<button type="button" onClick={() => setOpen(true)}>menu</button>
<input aria-label="elsewhere" />
<EdgeDrawer open={open} onClose={() => setOpen(false)} contained={contained} data-testid="drawer">
<button type="button">first</button>
<button type="button" aria-current="true">current</button>
<button type="button" onClick={() => { setOpen(false); onPickFocus?.(); }}>pick</button>
</EdgeDrawer>
</>
);
}
describe('EdgeDrawer', () => {
it('opens on the current item and gives the focus back to the opener after a pick', () => {
render(<Harness />);
const menu = screen.getByText('menu');
menu.focus();
fireEvent.click(menu);
expect(document.activeElement).toBe(screen.getByText('current'));
fireEvent.click(screen.getByText('pick'));
expect(screen.getByTestId('drawer')).toHaveAttribute('inert');
expect(document.activeElement).toBe(menu);
});
// Seen in the desktop app: with visibility in the opening transition the
// panel is still hidden in its first frame and refuses the focus.
it('is visible from its first frame when it opens, and hidden only after sliding out', () => {
render(<Harness />);
const classes = () => screen.getByTestId('drawer').className.split(/\s+/);
expect(classes()).toContain('transition-[transform,visibility]');
fireEvent.click(screen.getByText('menu'));
expect(classes()).toContain('transition-transform');
expect(classes()).not.toContain('transition-[transform,visibility]');
expect(classes()).not.toContain('invisible');
});
it('leaves the focus where a pick moved it, outside the drawer', () => {
render(<Harness onPickFocus={() => screen.getByLabelText('elsewhere').focus()} />);
const menu = screen.getByText('menu');
menu.focus();
fireEvent.click(menu);
act(() => fireEvent.click(screen.getByText('pick')));
expect(document.activeElement).toBe(screen.getByLabelText('elsewhere'));
});
it('stays inside a Pro pane: at the pane\'s edge, with only the pane dimmed', () => {
render(<Harness contained />);
fireEvent.click(screen.getByText('menu'));
const classes = screen.getByTestId('drawer').className.split(/\s+/);
expect(classes).toEqual(expect.arrayContaining(['absolute', 'inset-y-0', 'start-0']));
expect(classes).not.toContain('fixed');
expect(screen.getByTestId('drawer-scrim').className.split(/\s+/)).toContain('absolute');
});
});
@@ -0,0 +1,224 @@
import { act, render, screen, fireEvent, cleanup } from '@testing-library/react';
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import type { Mailbox } from '@/lib/jmap/types';
// The folded folder column (600 to 1024 px) of a mailbox with many folders,
// scrolled: shared accounts left only their headings' rules behind, stacked
// into a ladder of lines; the unread counter sat on the icon; one folder of
// one's own was a letter in a box; and the drawer a hover opened kept the
// column's scroll offset, so the hovered folder was somewhere else.
vi.mock('@/components/plugins/plugin-slot', () => ({ PluginSlot: () => null }));
vi.mock('@/components/tour/tour-provider', () => ({
useTour: () => ({ startTour: vi.fn(), resetTourCompletion: vi.fn(), activeTour: null, endTour: vi.fn(), registerStep: vi.fn() }),
}));
vi.mock('@/contexts/drag-drop-context', () => ({
useDragDropContext: () => ({ isDragging: false }),
}));
vi.mock('@/hooks/use-mailbox-drop', () => ({
useMailboxDrop: () => ({ dropHandlers: {}, isValidDropTarget: false, isInvalidDropTarget: false }),
}));
vi.mock('@/hooks/use-tag-drop', () => ({
useTagDrop: () => ({ dropHandlers: {}, isValidDropTarget: false }),
}));
vi.mock('../account-switcher', () => ({ AccountSwitcher: () => null }));
const { Sidebar } = await import('../sidebar');
const { useAuthStore } = await import('@/stores/auth-store');
const { useSettingsStore } = await import('@/stores/settings-store');
const { useUIStore } = await import('@/stores/ui-store');
const box = (id: string, name: string, role: string | null, extra: Partial<Mailbox> = {}) => ({
id, name, role, parentId: null, totalEmails: 0, unreadEmails: 0, myRights: { mayAddItems: true }, ...extra,
}) as unknown as Mailbox;
const shared = (id: string, name: string, role: string | null, extra: Partial<Mailbox> = {}) =>
box(`g1:${id}`, name, role, { originalId: id, accountId: 'g1', accountName: 'Sam Ortega', isShared: true, ...extra });
const own = [
box('inbox', 'Inbox', 'inbox', { totalEmails: 120, unreadEmails: 9 }),
box('clients', 'Clients', null, { parentId: 'inbox', unreadEmails: 132 }),
box('trash', 'Trash', 'trash', { unreadEmails: 3 }),
box('news', 'Newsletters', null, { unreadEmails: 150 }),
];
// A shared account without an inbox: two folders someone shared.
const sharedNoInbox = [shared('team', 'Team', null, { unreadEmails: 2 }), shared('board', 'Board', null, { unreadEmails: 1 })];
const nav = () => document.querySelector<HTMLElement>('[data-folder-nav]')!;
const drawer = () => document.querySelector<HTMLElement>('[data-folder-drawer]');
const row = (key: string) => document.querySelector<HTMLElement>(`[data-rail-key="${key}"]`)!;
const railButtons = () => Array.from(nav().querySelectorAll<HTMLElement>('[data-testid="folder-row"] > button'));
describe('the folded folder column with many folders', () => {
beforeEach(() => {
localStorage.clear();
useAuthStore.setState({ activeAccountId: 'login-a', client: { getAccountId: () => 'me', getCapabilities: () => ({}) } } as never);
useSettingsStore.setState({
hideAccountSwitcher: true, interfaceLayout: 'default', openOnHover: true, unreadCountStyle: 'count',
showSharedMailAccounts: true, hiddenSharedMailAccounts: {}, compactSharedMailboxes: false,
} as never);
useUIStore.setState({ sidebarCollapsed: true, compactSidebarExpanded: false } as never);
});
afterEach(() => {
cleanup();
vi.useRealTimers();
vi.restoreAllMocks();
useUIStore.setState({ sidebarCollapsed: false } as never);
});
it('draws one rule between sections, never two in a row', () => {
render(<Sidebar mailboxes={[...own, ...sharedNoInbox]} selectedMailbox="inbox" />);
// Folders, Your folders, Shared (with its account inside), Tags.
const rules = nav().querySelectorAll('[data-rail-separator]');
expect(rules).toHaveLength(2 + 1);
// Walk the column in order: something to click between any two rules.
const order = Array.from(nav().querySelectorAll('[data-rail-separator], [data-testid="folder-row"]'));
order.forEach((el, i) => {
if (i === 0) return;
const both = el.hasAttribute('data-rail-separator') && order[i - 1].hasAttribute('data-rail-separator');
expect(both, `two rules in a row at ${i}`).toBe(false);
});
});
it('lists a shared account as one item, which opens the drawer with it unfolded when it has no inbox', () => {
render(<Sidebar mailboxes={[...own, ...sharedNoInbox]} selectedMailbox="inbox" />);
const item = row('shared-account-g1');
expect(item.getAttribute('data-testid')).toBe('folder-row');
const button = item.querySelector('button')!;
expect(button.getAttribute('title')).toBe('name_unread');
expect(item.querySelector('[data-testid="folded-unread"]')?.textContent).toBe('3');
fireEvent.click(button);
expect(drawer()).not.toBeNull();
expect(screen.getByText('Team')).toBeTruthy();
});
it('opens a shared account\'s inbox from its item, and marks it while one of its folders is open', () => {
const onMailboxSelect = vi.fn();
const mailboxes = [...own, shared('in', 'Inbox', 'inbox', { unreadEmails: 4 }), ...sharedNoInbox];
const { rerender } = render(<Sidebar mailboxes={mailboxes} selectedMailbox="inbox" onMailboxSelect={onMailboxSelect} />);
fireEvent.click(row('shared-account-g1').querySelector('button')!);
expect(onMailboxSelect).toHaveBeenCalledWith('g1:in');
rerender(<Sidebar mailboxes={mailboxes} selectedMailbox="g1:team" onMailboxSelect={onMailboxSelect} />);
expect(row('shared-account-g1').querySelector('[data-testid="folded-selected"]')).not.toBeNull();
});
it('puts the counter at the icon\'s corner, beside the glyph, and says 99+ for more', () => {
render(<Sidebar mailboxes={own} selectedMailbox="inbox" />);
const badge = row('trash').querySelector<HTMLElement>('[data-testid="folded-unread"]')!;
expect(badge.textContent).toBe('3');
// On the 36px item, above the 16px icon's box, not inside it over the glyph.
expect(badge.parentElement!.tagName).toBe('BUTTON');
expect(badge.parentElement!.className).toContain('h-9');
expect(badge.className.split(/\s+/)).toEqual(expect.arrayContaining(['absolute', 'top-0', 'end-0', 'h-3']));
expect(badge.className).not.toContain('ring-2');
expect(row('news').querySelector('[data-testid="folded-unread"]')!.textContent).toBe('99+');
});
it('gives every item a tooltip with its name and count', () => {
render(<Sidebar mailboxes={[...own, ...sharedNoInbox]} selectedMailbox="inbox" />);
for (const button of railButtons()) {
const title = button.getAttribute('title');
expect(title, button.outerHTML.slice(0, 120)).toBeTruthy();
expect(title).toBe(button.getAttribute('aria-label'));
}
// With unread mail the name carries the count.
expect(row('inbox').querySelector('button')!.getAttribute('title')).toBe('name_unread');
});
it('draws one folder of one\'s own as a plain folder, several with their first letter inside the folder', () => {
render(<Sidebar mailboxes={own} selectedMailbox="inbox" />);
expect(row('news').querySelector('[data-testid="folder-initial"]')).toBeNull();
expect(row('news').querySelector('svg')).not.toBeNull();
cleanup();
render(<Sidebar mailboxes={[...own, box('receipts', 'receipts', null)]} selectedMailbox="inbox" />);
const letter = row('receipts').querySelector('[data-testid="folder-initial"]')!;
expect(letter.textContent).toBe('R');
// Inside the folder glyph, an icon like the others, not a box of its own.
expect(letter.closest('svg')?.querySelector('path')).not.toBeNull();
expect(letter.closest('svg')!.getAttribute('class')).toContain('w-4');
});
it('marks the open folder with a bar at the edge and a filled item', () => {
render(<Sidebar mailboxes={own} selectedMailbox="trash" />);
// Over the filled item, not under it.
expect(row('trash').querySelector('[data-testid="folded-selected"]')!.className).toContain('z-10');
expect(row('trash').querySelector('button')!.className).toContain('bg-accent');
expect(row('inbox').querySelector('[data-testid="folded-selected"]')).toBeNull();
expect(row('inbox').querySelector('button')!.className).not.toContain('bg-accent');
});
it('scrolls on its own, never sideways, with a thin scrollbar', () => {
render(<Sidebar mailboxes={own} selectedMailbox="inbox" />);
expect(nav().hasAttribute('data-folder-rail')).toBe(true);
expect(nav().className.split(/\s+/)).toEqual(expect.arrayContaining(['overflow-y-auto', 'overflow-x-hidden', 'min-h-0']));
});
it('moves through the items with the arrows, Home and End', () => {
render(<Sidebar mailboxes={[...own, ...sharedNoInbox]} selectedMailbox="inbox" />);
const buttons = railButtons().filter((b) => !(b as HTMLButtonElement).disabled);
buttons[0].focus();
fireEvent.keyDown(buttons[0], { key: 'ArrowDown' });
expect(document.activeElement).toBe(buttons[1]);
fireEvent.keyDown(buttons[1], { key: 'ArrowUp' });
expect(document.activeElement).toBe(buttons[0]);
fireEvent.keyDown(buttons[0], { key: 'End' });
expect(document.activeElement).toBe(buttons[buttons.length - 1]);
fireEvent.keyDown(buttons[buttons.length - 1], { key: 'Home' });
expect(document.activeElement).toBe(buttons[0]);
});
describe('the drawer opened from the scrolled column', () => {
// jsdom has no layout: the list's items sit at fixed places in the
// content, further down in the longer tree of the drawer.
let scrollTop = 0;
const NAV_TOP = 100;
const place = (el: Element) => {
const key = (el as HTMLElement).dataset?.railKey;
if (key !== 'news') return null;
return drawer() ? 900 : 500;
};
beforeEach(() => {
scrollTop = 0;
vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function (this: Element) {
// The list shows 600px; anything else is somewhere inside it.
const isNav = this.hasAttribute('data-folder-nav');
const at = place(this);
const top = isNav ? NAV_TOP : at === null ? NAV_TOP + 10 : NAV_TOP + at - scrollTop;
const height = isNav ? 600 : 36;
return { top, bottom: top + height, left: 0, right: 48, width: 48, height, x: 0, y: top, toJSON: () => ({}) } as DOMRect;
});
});
const trackScroll = () => Object.defineProperty(nav(), 'scrollTop', {
configurable: true,
get: () => scrollTop,
set: (v: number) => { scrollTop = v; },
});
it('puts the hovered item back under the pointer, and the column back where it was', () => {
vi.useFakeTimers();
const { container } = render(<Sidebar mailboxes={own} selectedMailbox="inbox" />);
trackScroll();
scrollTop = 200;
const news = row('news');
document.elementFromPoint = vi.fn(() => news.querySelector('button'));
// At 400 on screen in the column: 100 + 500 - 200.
fireEvent.mouseEnter(container.firstElementChild!, { clientX: 20, clientY: 410 });
act(() => { vi.advanceTimersByTime(400); });
expect(drawer()).not.toBeNull();
// In the drawer it is 900 down the list: scrolled so it is at 400 again.
expect(scrollTop).toBe(600);
fireEvent.mouseLeave(container.firstElementChild!);
expect(drawer()).toBeNull();
expect(scrollTop).toBe(200);
});
it('starts at the top when All folders opens it', () => {
render(<Sidebar mailboxes={own} selectedMailbox="inbox" />);
trackScroll();
scrollTop = 200;
fireEvent.click(screen.getByTestId('folded-all-folders'));
expect(drawer()).not.toBeNull();
expect(scrollTop).toBe(0);
});
});
});
@@ -102,11 +102,15 @@ describe('the folded column\'s drawer (default layout)', () => {
expect(inDrawer).toBe(docked);
});
it('mirrors the collapse arrows in RTL, where the drawer comes from the right', () => {
// RTL: globals.css mirrors the chevrons icons; a flip of their own as well would turn them back.
it('leaves the collapse arrows to the global RTL mirror, where the drawer comes from the right', () => {
const arrow = () => screen.getByTestId('sidebar-collapse').querySelector('svg')!.getAttribute('class') ?? '';
render(<Sidebar mailboxes={mailboxes} selectedMailbox="inbox" />);
expect(screen.getByTestId('sidebar-collapse').querySelector('svg')!.getAttribute('class')).toContain('rtl:-scale-x-100');
expect(arrow()).toMatch(/tabler-icon-chevrons-(left|right)/);
expect(arrow()).not.toMatch(/rtl:/);
openFromAllFolders();
expect(screen.getByTestId('sidebar-collapse').querySelector('svg')!.getAttribute('class')).toContain('rtl:-scale-x-100');
expect(arrow()).toMatch(/tabler-icon-chevrons-(left|right)/);
expect(arrow()).not.toMatch(/rtl:/);
});
it('keeps Tab and Shift+Tab inside while open', () => {
+76
View File
@@ -0,0 +1,76 @@
"use client";
import type { HTMLAttributes, ReactNode } from "react";
import { cn } from "@/lib/utils";
import { useEdgeDrawer } from "@/hooks/use-edge-drawer";
interface DrawerScrimProps {
onClose: () => void;
/** In a Pro pane: dims the pane only, not the other one beside it. */
contained?: boolean;
className?: string;
"data-testid"?: string;
}
/**
* The dimmed page behind a drawer. A click on it closes the drawer; the
* click, not the press, so it can't go through to what is under it.
*/
export function DrawerScrim({ onClose, contained, className, "data-testid": testId = "drawer-scrim" }: DrawerScrimProps) {
return (
<div
aria-hidden="true"
data-testid={testId}
data-drawer-scrim=""
className={cn("inset-0 bg-black/50 z-40", contained ? "absolute" : "fixed", className)}
onClick={() => onClose()}
/>
);
}
interface EdgeDrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
open: boolean;
onClose: () => void;
/**
* In a Pro pane or Mountain View's card: at the start edge of the nearest
* positioned box instead of the window's.
*/
contained?: boolean;
/** Where the focus goes back to when the opener is gone by then. */
returnFocus?: () => HTMLElement | null | undefined;
children: ReactNode;
}
/**
* A sidebar opened over the page below the full desktop, as Mail's folders
* do: from the window's start edge (the right in RTL), over the app rail,
* from under the top bar and the window's controls (--drawer-top) to the
* bottom, with the page dimmed behind it. Keyboard and focus: useEdgeDrawer.
* Closed, it is off-screen and out of reach: no clicks, no Tab stops.
*/
export function EdgeDrawer({ open, onClose, contained, returnFocus, className, children, ...rest }: EdgeDrawerProps) {
const ref = useEdgeDrawer({ open, onClose, returnFocus });
return (
<>
{open && <DrawerScrim onClose={onClose} contained={contained} />}
<div
{...rest}
ref={ref}
data-edge-drawer=""
inert={!open}
className={cn(
"z-50 w-72 max-w-[85%] flex flex-col",
contained ? "absolute inset-y-0 start-0" : "fixed start-0 top-[var(--drawer-top)] bottom-0",
"transform duration-300 ease-in-out",
// Visible at once on opening, so the focus can go in straight away
// (a visibility transition keeps it hidden for that first frame);
// hidden only once it has slid out on closing.
open ? "shadow-xl transition-transform" : "invisible -translate-x-full rtl:translate-x-full transition-[transform,visibility]",
className
)}
>
{children}
</div>
</>
);
}
+217 -42
View File
@@ -1,7 +1,7 @@
"use client";
import { hoverOpens } from "@/lib/open-on-hover";
import { memo, useState, useEffect, useMemo, useCallback, useRef, useId, Fragment, ReactNode } from "react";
import { memo, useState, useEffect, useLayoutEffect, useMemo, useCallback, useRef, useId, Fragment, ReactNode } from "react";
import { useTranslations } from "next-intl";
import { useRouter } from "@/i18n/navigation";
import { PluginSlot } from "@/components/plugins/plugin-slot";
@@ -396,6 +396,9 @@ interface SidebarRowProps {
testName?: string;
testMailboxId?: string;
testShared?: boolean;
/** Names the row the same folded and unfolded, so the drawer opened by a
* hover can put the hovered item back under the pointer. */
railKey?: string;
}
function SidebarRow({
@@ -420,6 +423,7 @@ function SidebarRow({
testName,
testMailboxId,
testShared,
railKey,
}: SidebarRowProps) {
const t = useTranslations('sidebar');
const tShell = useTranslations('shell');
@@ -436,6 +440,8 @@ function SidebarRow({
unread, total, role: testRole, mode: countMode, showTotalGlobally: showFolderTotalCount, mountainView,
}).unread;
const accessibleName = unreadForName > 0 ? tShell('name_unread', { name: label, count: unreadForName }) : undefined;
// The default layout's folded column: one grid of square items.
const railItem = isCollapsed && !mountainView;
const [labelRef, shortenedLabel] = useShortenedText(labelCandidates ?? [label]);
// Touch has no right-click: a long-press opens the same menu (R7), and a
// ⋮ shows it too.
@@ -473,21 +479,31 @@ function SidebarRow({
data-shared={testShared ? 'true' : undefined}
data-selected={isSelected ? 'true' : undefined}
data-has-unread={(unread ?? 0) > 0 && testRole !== 'drafts' ? '' : undefined}
style={{ paddingBlock: 'var(--density-sidebar-py)' }}
data-rail-key={railKey ?? testMailboxId ?? undefined}
style={railItem ? undefined : { paddingBlock: 'var(--density-sidebar-py)' }}
className={cn(
"group w-full flex items-center tap:min-h-[44px] text-sm transition-colors duration-150",
isCollapsed ? "justify-center px-1" : "pe-2",
// Folded, every item is the same square on one grid, as in Outlook's
// folded pane: the button carries the hover and the selection, and a
// bar at the column's edge marks the open one.
// Mountain View's 72px rail keeps its own pill rows (globals.css).
railItem ? "relative justify-center py-px" : isCollapsed ? "justify-center px-1" : "pe-2",
openFromRow && "cursor-pointer select-none",
isVirtual
? "text-muted-foreground"
: isSelected
? "bg-accent text-accent-foreground font-semibold border-s-2 border-primary"
: "hover:bg-muted/50 text-foreground border-s-2 border-transparent",
railItem
? (isVirtual ? "text-muted-foreground" : isSelected ? "text-accent-foreground font-semibold" : "text-foreground")
: isVirtual
? "text-muted-foreground"
: isSelected
? "bg-accent text-accent-foreground font-semibold border-s-2 border-primary"
: "hover:bg-muted/50 text-foreground border-s-2 border-transparent",
// Only a folder that takes the drop lights up. Elsewhere the pointer
// says no (dropEffect none), as in a native mail client.
isValidDropTarget && "bg-primary/20 ring-2 ring-primary ring-inset"
)}
>
{railItem && isSelected && (
<span aria-hidden="true" data-testid="folded-selected" className="absolute z-10 start-0 top-1/2 -translate-y-1/2 h-5 w-[0.1875rem] rounded-e-full bg-primary" />
)}
{!isCollapsed && (
<div
className="flex items-center flex-shrink-0"
@@ -528,28 +544,36 @@ function SidebarRow({
aria-describedby={muted && !isCollapsed ? mutedId : undefined}
className={cn(
"flex items-center gap-2 min-w-0 transition-colors",
isCollapsed ? "justify-center" : "flex-1 text-start",
railItem
? cn(
// 36px high: the icon sits 10px down, under the counter's
// 12px, so the counter never covers the glyph.
"relative justify-center w-full max-w-10 h-9 rounded-md focus-visible:outline-2 focus-visible:outline-ring focus-visible:-outline-offset-2",
!isVirtual && (isSelected ? "bg-accent" : "hover:bg-muted/60"),
)
: isCollapsed ? "relative justify-center w-10 h-8" : "flex-1 text-start",
isVirtual && "cursor-default select-none"
)}
title={isCollapsed ? label : undefined}
// Folded, the name and count are only in the tooltip.
title={isCollapsed ? (accessibleName ?? label) : undefined}
>
<span className="relative flex items-center justify-center flex-shrink-0 w-4 h-4">
{icon}
{/* Folded to icons, the count rides on the icon (p2-9); the name says it already. */}
{isCollapsed && unreadForName > 0 && (
unreadCountStyle === 'dot' ? (
<span aria-hidden="true" data-testid="folded-unread" className="absolute -top-0.5 -end-1 w-2 h-2 rounded-full bg-primary ring-2 ring-secondary" />
) : (
<span
aria-hidden="true"
data-testid="folded-unread"
className="absolute -top-2 -end-3 min-w-4 h-4 px-1 rounded-full bg-primary text-primary-foreground text-[0.625rem] leading-4 font-semibold tabular-nums text-center ring-2 ring-secondary"
>
{unreadForName > 99 ? '99+' : unreadForName}
</span>
)
)}
</span>
{/* Folded to icons, a small counter at the icon's top corner (p2-9); the name says it already. */}
{isCollapsed && unreadForName > 0 && (
unreadCountStyle === 'dot' ? (
<span aria-hidden="true" data-testid="folded-unread" className="absolute top-1.5 end-1.5 w-1.5 h-1.5 rounded-full bg-primary" />
) : (
<span
aria-hidden="true"
data-testid="folded-unread"
className="absolute top-0 end-0 min-w-3 h-3 px-[0.1875rem] rounded-full bg-primary text-primary-foreground text-[0.5625rem] leading-3 font-semibold tabular-nums text-center"
>
{unreadForName > 99 ? '99+' : unreadForName}
</span>
)
)}
{!isCollapsed && (
<>
<span
@@ -598,20 +622,52 @@ function SidebarRow({
);
}
/** A folder of one's own on the folded strip: its first letter in a small box. */
/**
* A folder of one's own on the folded strip, when there are several: the
* folder glyph the other rows use, same size and stroke, with the folder's
* first letter inside it. A letter in a box of its own looked like no other
* icon in the column.
*/
function FolderInitial({ name, className }: { name: string; className?: string }) {
const initial = Array.from(name.trim())[0]?.toLocaleUpperCase() ?? '?';
return (
<span
<svg
aria-hidden="true"
data-testid="folder-initial"
className={cn(className, "grid place-items-center rounded-[0.25rem] border border-current text-[0.625rem] font-semibold leading-none")}
data-testid="folder-initial-icon"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
className={className}
>
{initial}
</span>
{/* Lucide's folder outline. */}
<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
<text
data-testid="folder-initial"
x="12"
y="13"
textAnchor="middle"
dominantBaseline="central"
fill="currentColor"
stroke="none"
fontSize="10"
fontWeight="700"
>
{initial}
</text>
</svg>
);
}
/** Whether the folder `id` is this node or below it. */
const subtreeHas = (node: MailboxNode, id: string): boolean =>
node.id === id || node.children.some((child) => subtreeHas(child, id));
/** Unread mail in the folders below a node (a shared account counts nothing itself). */
const subtreeUnread = (node: MailboxNode): number =>
node.children.reduce((sum, child) => sum + (child.unreadEmails ?? 0) + subtreeUnread(child), 0);
/** A folder the server gave a role (inbox, sent, trash...), as opposed to one the user made. */
const isSystemFolder = (node: MailboxNode) => !!node.role;
/** Key of the single-account "Your folders" section in the collapsed set. */
@@ -634,6 +690,7 @@ function SidebarSectionHeader({
status,
onAdd,
addTitle,
railKey,
}: {
label: string;
expanded: boolean;
@@ -650,9 +707,14 @@ function SidebarSectionHeader({
onContextMenu?: (event: React.MouseEvent) => void;
/** A short note after the label, e.g. how many accounts have loaded. */
status?: ReactNode;
/** The folded column's item for the same thing (see SidebarRow). */
railKey?: string;
}) {
if (isCollapsed) {
return first ? null : <div className="h-px bg-border/50 mx-2 my-2" aria-hidden />;
// One thin rule between sections. A sub-section (a shared account, the
// folders inside a Pro account group) draws none: under a section's own
// rule they stacked into a ladder of lines.
return first || sub ? null : <div className="h-px bg-border mx-2.5 my-1.5" data-rail-separator="" aria-hidden />;
}
const paddingY = sub ? "pt-2" : first ? "pt-3" : "pt-5";
@@ -670,6 +732,7 @@ function SidebarSectionHeader({
return (
<div
onContextMenu={onContextMenu}
data-rail-key={railKey}
className={cn(
"group w-full flex items-center pb-1 select-none rounded-sm hover:bg-muted/40 transition-colors",
paddingX,
@@ -740,6 +803,7 @@ function MailboxTreeItem({
pickOnly = false,
sharedAccountName,
renderAfterChild,
initials = false,
}: {
node: MailboxNode;
selectedMailbox: string;
@@ -763,19 +827,23 @@ function MailboxTreeItem({
/** Rendered after each direct child's subtree, e.g. the Scheduled row after
* Drafts. Not passed further down. */
renderAfterChild?: (child: MailboxNode) => React.ReactNode;
/** Folded: several folders of one's own are listed, so each carries its
* first letter. One alone is a plain folder. */
initials?: boolean;
}) {
const tNotifications = useTranslations('notifications');
const tListExtra = useTranslations('mail_list_extra');
const tSidebar = useTranslations('sidebar');
const hasChildren = node.children.length > 0;
const isExpanded = expandedFolders.has(node.id);
const Icon = sharedAccountName ? User : getIconForMailbox(node.role, hasChildren, isExpanded, node.id);
// Folded, no subfolders show, so no folder is drawn open.
const Icon = sharedAccountName ? User : getIconForMailbox(node.role, hasChildren, isExpanded && !isCollapsed, node.id);
const isVirtualNode = node.id.startsWith('shared-');
const isSelected = selectedMailbox === node.id;
const label = sharedAccountName ?? localizeMailboxName(node.role, node.name, (k) => tSidebar(`mailboxes.${k}`));
// Folded to icons, eight folders of one's own were eight identical folder
// icons (p2-9): each shows its first letter instead.
const letterIcon = isCollapsed && !node.role && !sharedAccountName && !isVirtualNode;
// icons (p2-9): each carries its first letter inside the folder glyph.
const letterIcon = isCollapsed && initials && !node.role && !sharedAccountName && !isVirtualNode;
// Only for the active login's folders: its client tells a missing
// accountId (own mailbox) apart.
const muted = useMutedMailbox(isVirtualNode || dragAccountId || pickOnly ? null : node);
@@ -969,6 +1037,7 @@ function TagItem({
isCollapsed={isCollapsed}
dropHandlers={globalDragging ? (dropHandlers as Record<string, unknown>) : undefined}
isValidDropTarget={isValidDropTarget}
railKey={`tag:${node.id}`}
/>
{hasChildren && isExpanded && !isCollapsed && node.children.map((child) => (
@@ -1299,9 +1368,26 @@ function SidebarImpl({
}, [railOpen]);
// The pointer resting on the folders floats the tree out; on the header
// (expand, compose) it doesn't, so the expand button can still be clicked.
const armRailHover = useCallback((target: EventTarget | null) => {
const navRef = useRef<HTMLElement>(null);
// The item the pointer rests on in the folded column, and where on screen.
const hoveredRailItem = useRef<{ key: string; top: number } | null>(null);
const lastPointer = useRef<{ x: number; y: number; target: EventTarget | null }>({ x: 0, y: 0, target: null });
// Read when the tree floats out, not when the pointer arrived: the column
// may have been scrolled under a resting pointer in between.
const noteHoveredRailItem = useCallback(() => {
const { x, y, target } = lastPointer.current;
const under = typeof document.elementFromPoint === 'function' ? document.elementFromPoint(x, y) : null;
const from = under ?? (target instanceof Element ? target : null);
const item = from?.closest<HTMLElement>('[data-rail-key]');
hoveredRailItem.current = item?.dataset.railKey && navRef.current?.contains(item)
? { key: item.dataset.railKey, top: item.getBoundingClientRect().top }
: null;
}, []);
const armRailHover = useCallback((e: React.MouseEvent) => {
if (!hoverOpens()) return;
if (mvShell) { setRailHovered(true); return; }
const target = e.target;
lastPointer.current = { x: e.clientX, y: e.clientY, target };
if (mvShell) { noteHoveredRailItem(); setRailHovered(true); return; }
if (target instanceof Element && target.closest('[data-sidebar-head]')) {
if (railHoverTimer.current) clearTimeout(railHoverTimer.current);
railHoverTimer.current = null;
@@ -1310,9 +1396,59 @@ function SidebarImpl({
if (railHoverTimer.current) return;
railHoverTimer.current = setTimeout(() => {
railHoverTimer.current = null;
noteHoveredRailItem();
setRailHovered(true);
}, RAIL_HOVER_DELAY_MS);
}, [mvShell]);
}, [mvShell, noteHoveredRailItem]);
// The folded column and the tree floated out of it share one scrolling
// list. Scrolled down the column, the tree opened at that same offset, which
// in the longer tree was somewhere else: a hover now puts the hovered item
// back under the pointer, All folders starts at the top (and the focus
// brings the open folder into view), and folding back returns the column
// to where it was.
const railScrollTop = useRef<number | null>(null);
useLayoutEffect(() => {
const nav = navRef.current;
if (!nav) return;
if (hoverExpanded) {
if (railScrollTop.current !== null) return;
railScrollTop.current = nav.scrollTop;
const hovered = railOpen ? null : hoveredRailItem.current;
const item = hovered
? Array.from(nav.querySelectorAll<HTMLElement>('[data-rail-key]')).find((el) => el.dataset.railKey === hovered.key)
: null;
nav.scrollTop = item && hovered ? nav.scrollTop + item.getBoundingClientRect().top - hovered.top : 0;
return;
}
if (railScrollTop.current === null) return;
const railTop = railScrollTop.current;
railScrollTop.current = null;
// Unfolded meanwhile: the full list keeps its own place.
if (!isCollapsed) return;
nav.scrollTop = railTop;
// A folder picked in the tree is shown in the column too.
const current = nav.querySelector<HTMLElement>('[aria-current="page"]');
if (!current) return;
const view = nav.getBoundingClientRect();
const box = current.getBoundingClientRect();
if (box.top < view.top) nav.scrollTop += box.top - view.top;
else if (box.bottom > view.bottom) nav.scrollTop += box.bottom - view.bottom;
}, [hoverExpanded, railOpen, isCollapsed]);
// Folded, the arrows, Home and End go from item to item, Enter opens.
const moveInRail = useCallback((e: React.KeyboardEvent<HTMLElement>) => {
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp' && e.key !== 'Home' && e.key !== 'End') return;
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
const items = Array.from(e.currentTarget.querySelectorAll<HTMLElement>('[data-testid="folder-row"] > button:not(:disabled)'));
if (items.length === 0) return;
const at = items.indexOf(document.activeElement as HTMLElement);
const next = e.key === 'Home' ? 0
: e.key === 'End' ? items.length - 1
: at < 0 ? 0
: e.key === 'ArrowDown' ? Math.min(at + 1, items.length - 1) : Math.max(at - 1, 0);
e.preventDefault();
e.stopPropagation();
items[next].focus();
}, []);
const { primaryIdentity: _primaryIdentity, activeAccountId } = useAuthStore(useShallow((state) => ({ primaryIdentity: state.primaryIdentity, activeAccountId: state.activeAccountId })));
const [expandedFolders, setExpandedFolders] = useState<Set<string>>(new Set());
const [expandedTags, setExpandedTags] = useState<Set<string>>(new Set());
@@ -1681,6 +1817,7 @@ function SidebarImpl({
colorful={colorfulSidebarIcons}
onContextMenu={active ? handleMailboxContextMenu : undefined}
dragAccountId={dragAccountId}
initials={tree.length > 1}
/>
))}
</div>
@@ -1770,6 +1907,31 @@ function SidebarImpl({
</div>
);
}
if (isCollapsed) {
// Folded, a shared account is one item: its inbox opens, or
// without one the drawer with the account unfolded. It was
// left out, and only its heading's rule stayed behind.
const inbox = account.children.find((child) => child.role === 'inbox');
const selectedHere = !!selected && subtreeHas(account, selected);
return (
<SidebarRow
key={account.id}
icon={<User className={getIconClass(selectedHere, false, false)} />}
label={account.name}
isSelected={selectedHere}
unread={subtreeUnread(account)}
onClick={() => {
if (inbox) { onSelect?.(inbox.id); return; }
if (!expanded) onToggle();
if (!accountExpanded) toggleSharedAccount(account.id);
setRailOpen(true);
}}
isCollapsed
testShared
railKey={account.id}
/>
);
}
return (
<div key={account.id}>
<SidebarSectionHeader
@@ -1780,6 +1942,7 @@ function SidebarImpl({
sub
icon={<User className="w-3.5 h-3.5 text-muted-foreground" />}
testId="section-shared-account"
railKey={account.id}
onContextMenu={active && menuAccountId
? (e) => handleSharedAccountContextMenu(e, menuAccountId)
: undefined}
@@ -2067,8 +2230,8 @@ function SidebarImpl({
<div
ref={rootRef}
// The peek of the collapsed rail; not with hover opening turned off.
onMouseEnter={sidebarCollapsed && !isDrawer ? (e) => armRailHover(e.target) : undefined}
onMouseMove={sidebarCollapsed && !isDrawer && !mvShell && !railHovered ? (e) => armRailHover(e.target) : undefined}
onMouseEnter={sidebarCollapsed && !isDrawer ? armRailHover : undefined}
onMouseMove={sidebarCollapsed && !isDrawer && !mvShell && !railHovered ? armRailHover : undefined}
onMouseLeave={sidebarCollapsed && !isDrawer ? () => {
if (railHoverTimer.current) clearTimeout(railHoverTimer.current);
railHoverTimer.current = null;
@@ -2143,8 +2306,8 @@ function SidebarImpl({
data-testid="sidebar-collapse"
title={isCollapsed ? t("expand_tooltip") : t("collapse_tooltip")}
>
{/* The arrows point the way the column goes: mirrored in RTL, where it sits at the right. */}
{isCollapsed ? <ChevronsRight className="w-4 h-4 rtl:-scale-x-100" /> : <ChevronsLeft className="w-4 h-4 rtl:-scale-x-100" />}
{/* The arrows point the way the column goes; the app's global RTL mirror turns them in RTL. */}
{isCollapsed ? <ChevronsRight className="w-4 h-4" /> : <ChevronsLeft className="w-4 h-4" />}
</Button>
{/* The account switcher heads the folders by default, with the
@@ -2211,7 +2374,19 @@ function SidebarImpl({
{!isCollapsed && <VacationBanner />}
{/* Mailbox List */}
<nav aria-label={t("folders")} className="flex-1 overflow-y-auto" data-tour="sidebar" data-folder-nav="" data-pane="folders">
<nav
ref={navRef}
aria-label={t("folders")}
// Folded, the column scrolls on its own, never sideways, with a thin
// scrollbar (globals.css) and the same gutter on both sides so the
// icons stay centred under the buttons above and below it.
className={cn("flex-1 min-h-0 overflow-y-auto", isCollapsed && "overflow-x-hidden py-1 [scrollbar-gutter:stable_both-edges]")}
data-tour="sidebar"
data-folder-nav=""
data-folder-rail={isCollapsed && !mvShell ? "" : undefined}
data-pane="folders"
onKeyDown={isCollapsed ? moveInRail : undefined}
>
{unifiedSectionShown && (
<div>
<SidebarSectionHeader
+18 -35
View File
@@ -79,7 +79,8 @@ import { useContactStore } from "@/stores/contact-store";
import { useIdentityStore } from "@/stores/identity-store";
import { useUIStore, sidebarFolded, listPaneCssSize, SIDEBAR_MIN, SIDEBAR_MAX, EMAIL_LIST_MIN, EMAIL_LIST_MAX, EMAIL_LIST_HEIGHT_MIN, EMAIL_LIST_HEIGHT_MAX, READING_PANE_MIN_WIDTH, READING_PANE_MIN_HEIGHT, COMPOSER_PANE_MIN_HEIGHT } from "@/stores/ui-store";
import { atLeast, PHONE_BELOW, useDeviceDetection } from "@/hooks/use-media-query";
import { useFocusTrap } from "@/hooks/use-focus-trap";
import { useEdgeDrawer } from "@/hooks/use-edge-drawer";
import { DrawerScrim } from "@/components/layout/edge-drawer";
import { usePaneSize } from "@/hooks/use-pane-size";
import { useIsFocusedProTab, usePaneId } from "@/hooks/use-pane-context";
import { useKeyboardShortcuts, type GoToMailboxTarget } from "@/hooks/use-keyboard-shortcuts";
@@ -2621,29 +2622,18 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
// Pro can mount two mail panes at once, so the sidebar id must be per-instance.
const sidebarId = useId();
const listHeadingId = useId();
// The phone drawer keeps Tab inside until it closes, and Escape closes it.
// The phone drawer keeps Tab inside until it closes, Escape closes it, and
// the focus goes back to the toggle however it closes (Escape, X, a pick,
// the scrim), unless it has moved on to something outside the drawer. The
// toggle lives in whichever MobileHeader the current view renders, so it is
// looked up inside this app instance when the one that opened it is gone.
const phoneDrawerOpen = isMobile && sidebarOpen;
const sidebarContainerRef = useFocusTrap({
isActive: phoneDrawerOpen,
onEscape: () => setSidebarOpen(false),
restoreFocus: false,
const closeSidebarDrawer = useCallback(() => setSidebarOpen(false), [setSidebarOpen]);
const sidebarContainerRef = useEdgeDrawer({
open: phoneDrawerOpen,
onClose: closeSidebarDrawer,
returnFocus: () => appRootRef.current?.querySelector<HTMLElement>('[data-sidebar-toggle]'),
});
const sidebarWasOpen = useRef(false);
useEffect(() => {
if (phoneDrawerOpen) {
sidebarWasOpen.current = true;
return;
}
if (!sidebarWasOpen.current) return;
sidebarWasOpen.current = false;
// Back to the toggle however it closed (Escape, X, a pick, the scrim),
// unless the focus has moved on to something outside the drawer. The
// toggle lives in whichever MobileHeader the current view renders, so
// look it up inside this app instance rather than threading a ref through.
const active = document.activeElement;
if (active && active !== document.body && !sidebarContainerRef.current?.contains(active)) return;
appRootRef.current?.querySelector<HTMLElement>('[data-sidebar-toggle]')?.focus();
}, [phoneDrawerOpen, sidebarContainerRef]);
// The folded column's tree open over the page as a drawer (Sidebar's
// onDrawerChange): the function that closes it, for the scrim.
const [closeFolderDrawer, setCloseFolderDrawer] = useState<(() => void) | null>(null);
@@ -5890,20 +5880,13 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
scope to the pane via `absolute` so the backdrop stays inside
the pane instead of covering the whole window. */}
{((isMobile && sidebarOpen) || closeFolderDrawer) && !inlineApp && (
<div
aria-hidden="true"
<DrawerScrim
data-testid="folder-drawer-scrim"
data-drawer-scrim=""
className={cn(
"inset-0 bg-black/50 z-40",
// The folded column's drawer opens on a desktop, so only the
// phone's scrim goes with the phone layout.
isEmbedded ? "absolute" : cn("fixed", !closeFolderDrawer && "desk:hidden")
)}
onClick={() => {
if (closeFolderDrawer) closeFolderDrawer();
else setSidebarOpen(false);
}}
contained={isEmbedded}
// The folded column's drawer opens on a desktop, so only the
// phone's scrim goes with the phone layout.
className={!isEmbedded && !closeFolderDrawer ? "desk:hidden" : undefined}
onClose={closeFolderDrawer ?? closeSidebarDrawer}
/>
)}
+72
View File
@@ -0,0 +1,72 @@
import { useEffect, useLayoutEffect, useRef } from 'react';
import { useFocusTrap } from '@/hooks/use-focus-trap';
interface UseEdgeDrawerOptions {
/** Whether the drawer is open over the page. */
open: boolean;
/** Closes it: Escape, and whatever else the caller wires (scrim, X, a pick). */
onClose: () => void;
/**
* Where the focus goes back to when the button that opened the drawer is
* gone by then (a header that rendered again).
*/
returnFocus?: () => HTMLElement | null | undefined;
}
/**
* The keyboard side of a sidebar opened over the page as a drawer (Mail's
* folders on a phone, Calendar, Contacts and Files below the full desktop):
* the focus goes to the current item in it, else the first, Tab stays inside
* until it closes, Escape closes it, and however it closes (Escape, the scrim,
* a close button, a pick) the focus goes back to the button that opened it,
* unless the pick moved it somewhere else on purpose.
*
* Returns the ref for the drawer's element.
*/
export function useEdgeDrawer({ open, onClose, returnFocus }: UseEdgeDrawerOptions) {
const ref = useFocusTrap({
isActive: open,
onEscape: onClose,
restoreFocus: false,
initialFocus: () => ref.current?.querySelector<HTMLElement>(
'[aria-current]:not(:disabled):not([tabindex="-1"])'
),
});
// The opener, read before the trap moves the focus into the drawer.
const openerRef = useRef<HTMLElement | null>(null);
const returnFocusRef = useRef(returnFocus);
useLayoutEffect(() => {
returnFocusRef.current = returnFocus;
if (!open) return;
const active = document.activeElement;
if (active instanceof HTMLElement && active !== document.body && !ref.current?.contains(active)) {
openerRef.current = active;
}
});
const wasOpen = useRef(false);
useEffect(() => {
if (open) {
wasOpen.current = true;
// The current item can sit in a folded group: then the first one.
const root = ref.current;
if (root && !root.contains(document.activeElement)) {
root.querySelector<HTMLElement>(
'button:not(:disabled), [href], input:not(:disabled), [tabindex]:not([tabindex="-1"])'
)?.focus();
}
return;
}
if (!wasOpen.current) return;
wasOpen.current = false;
const active = document.activeElement;
// A pick that moved the focus on (a dialog, a form) keeps it there.
if (active && active !== document.body && !ref.current?.contains(active)) return;
const opener = openerRef.current;
openerRef.current = null;
(opener?.isConnected ? opener : returnFocusRef.current?.())?.focus();
}, [open, ref]);
return ref;
}
+10
View File
@@ -22,6 +22,16 @@ const source = (file: string) => readFileSync(path.join(ROOT, file), 'utf8');
const classesOf = (el: Element) => el.getAttribute('class')!.split(/\s+/).filter((c) => c !== 'bk').sort();
describe('plugin UI kit components', () => {
it('starts a long LinkButton\'s lines at its icon, as a paragraph, not centred as a button would', () => {
// The AI assistant's examples in its panel ("Decline the invitation politely and suggest next month instead").
render(<kit.LinkButton icon="arrow-right">Decline the invitation politely and suggest next month instead</kit.LinkButton>);
const link = screen.getByRole('button');
expect(link.className).toMatch(/(^|\s)text-start(\s|$)/);
// The icon stays beside the first line rather than the middle of the text.
expect(link.className).toMatch(/(^|\s)items-start(\s|$)/);
expect(link.querySelector('svg')!.getAttribute('class')).toContain('mt-');
});
it('renders the app\'s own Button and Input', () => {
render(<>
<kit.Button variant="secondary" size="sm">Cancel</kit.Button>
+7 -3
View File
@@ -103,11 +103,15 @@ export const Button = React.forwardRef<HTMLButtonElement, KitButtonProps>(functi
);
});
/** A text link styled like the app's inline links ("Add condition"). */
/**
* A text link styled like the app's inline links ("Add condition"). A long one
* wraps like a paragraph: lines start at the icon's side (a button centres its
* text otherwise), with the icon beside the first line.
*/
export function LinkButton({ icon, children, className, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & { icon?: string }) {
return (
<button type="button" className={cn('bk inline-flex items-center gap-1 text-sm text-primary hover:underline disabled:opacity-50 disabled:pointer-events-none', className)} {...rest}>
{icon && <Icon name={icon} size="sm" />}
<button type="button" className={cn('bk inline-flex items-start gap-1 text-start text-sm text-primary hover:underline disabled:opacity-50 disabled:pointer-events-none', className)} {...rest}>
{icon && <Icon name={icon} size="sm" className="mt-[0.1875rem]" />}
{children}
</button>
);
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "أنت دون اتصال. الرسالة محفوظة في المسودات.",
"offline_send_unsaved": "أنت دون اتصال. تبقى الرسالة هنا وتُحفظ في المسودات عند عودة الاتصال."
},
"composer_panel": {
"show_panel": "إظهار {name}",
"hide_panel": "إخفاء {name}"
},
"desktopDevTools": {
"section_title": "استكشاف الأخطاء وإصلاحها",
"label": "أدوات المطورين ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "No teniu connexió. El missatge està desat a Esborranys.",
"offline_send_unsaved": "No teniu connexió. El missatge es queda aquí i es desa a Esborranys quan torneu a tenir connexió."
},
"composer_panel": {
"show_panel": "Mostra {name}",
"hide_panel": "Amaga {name}"
},
"desktopDevTools": {
"section_title": "Resolució de problemes",
"label": "Eines per a desenvolupadors ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Jste offline. Zpráva je uložená v Konceptech.",
"offline_send_unsaved": "Jste offline. Zpráva tu zůstane a uloží se do Konceptů, až budete znovu online."
},
"composer_panel": {
"show_panel": "Zobrazit {name}",
"hide_panel": "Skrýt {name}"
},
"desktopDevTools": {
"section_title": "Řešení potíží",
"label": "Nástroje pro vývojáře ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Du er offline. Beskeden er gemt i Kladder.",
"offline_send_unsaved": "Du er offline. Beskeden bliver her og gemmes i Kladder, når du er online igen."
},
"composer_panel": {
"show_panel": "Vis {name}",
"hide_panel": "Skjul {name}"
},
"desktopDevTools": {
"section_title": "Fejlfinding",
"label": "Udviklerværktøjer ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Sie sind offline. Die Nachricht ist in den Entwürfen gespeichert.",
"offline_send_unsaved": "Sie sind offline. Die Nachricht bleibt hier und wird in den Entwürfen gespeichert, sobald Sie wieder online sind."
},
"composer_panel": {
"show_panel": "{name} einblenden",
"hide_panel": "{name} ausblenden"
},
"desktopDevTools": {
"section_title": "Fehlerbehebung",
"label": "Entwicklertools ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "You're offline. The message is saved in Drafts.",
"offline_send_unsaved": "You're offline. The message stays here and is saved in Drafts when you're back online."
},
"composer_panel": {
"show_panel": "Show {name}",
"hide_panel": "Hide {name}"
},
"desktopDevTools": {
"section_title": "Troubleshooting",
"label": "Developer tools ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "No tienes conexión. El mensaje está guardado en Borradores.",
"offline_send_unsaved": "No tienes conexión. El mensaje se queda aquí y se guarda en Borradores cuando vuelvas a tener conexión."
},
"composer_panel": {
"show_panel": "Mostrar {name}",
"hide_panel": "Ocultar {name}"
},
"desktopDevTools": {
"section_title": "Solución de problemas",
"label": "Herramientas para desarrolladores ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Oled võrguta. Kiri on salvestatud mustanditesse.",
"offline_send_unsaved": "Oled võrguta. Kiri jääb siia ja salvestatakse mustanditesse, kui oled jälle võrgus."
},
"composer_panel": {
"show_panel": "Kuva {name}",
"hide_panel": "Peida {name}"
},
"desktopDevTools": {
"section_title": "Tõrkeotsing",
"label": "Arendaja tööriistad ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "آفلاین هستید. پیام در پیش‌نویس‌ها ذخیره شده است.",
"offline_send_unsaved": "آفلاین هستید. پیام همین‌جا می‌ماند و وقتی دوباره آنلاین شدید در پیش‌نویس‌ها ذخیره می‌شود."
},
"composer_panel": {
"show_panel": "نمایش {name}",
"hide_panel": "پنهان کردن {name}"
},
"desktopDevTools": {
"section_title": "عیب‌یابی",
"label": "ابزارهای توسعه‌دهنده ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Vous êtes hors ligne. Le message est enregistré dans les Brouillons.",
"offline_send_unsaved": "Vous êtes hors ligne. Le message reste ici et sera enregistré dans les Brouillons dès que vous serez de nouveau en ligne."
},
"composer_panel": {
"show_panel": "Afficher {name}",
"hide_panel": "Masquer {name}"
},
"desktopDevTools": {
"section_title": "Dépannage",
"label": "Outils de développement ({shortcut})",
+4
View File
@@ -7674,6 +7674,10 @@
"offline_send_saved": "אין חיבור. ההודעה שמורה בטיוטות.",
"offline_send_unsaved": "אין חיבור. ההודעה נשארת כאן ותישמר בטיוטות כשתחזרו לרשת."
},
"composer_panel": {
"show_panel": "הצגת {name}",
"hide_panel": "הסתרת {name}"
},
"desktopDevTools": {
"section_title": "פתרון בעיות",
"label": "כלים למפתחים ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Offline állapotban van. Az üzenet a Piszkozatok között van mentve.",
"offline_send_unsaved": "Offline állapotban van. Az üzenet itt marad, és a Piszkozatok közé kerül, amint újra online lesz."
},
"composer_panel": {
"show_panel": "{name} megjelenítése",
"hide_panel": "{name} elrejtése"
},
"desktopDevTools": {
"section_title": "Hibaelhárítás",
"label": "Fejlesztői eszközök ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Sei offline. Il messaggio è salvato nelle Bozze.",
"offline_send_unsaved": "Sei offline. Il messaggio resta qui e viene salvato nelle Bozze quando torni online."
},
"composer_panel": {
"show_panel": "Mostra {name}",
"hide_panel": "Nascondi {name}"
},
"desktopDevTools": {
"section_title": "Risoluzione dei problemi",
"label": "Strumenti per sviluppatori ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "オフラインです。メッセージは下書きに保存されています。",
"offline_send_unsaved": "オフラインです。メッセージはここに残り、オンラインに戻ると下書きに保存されます。"
},
"composer_panel": {
"show_panel": "{name}を表示",
"hide_panel": "{name}を非表示"
},
"desktopDevTools": {
"section_title": "トラブルシューティング",
"label": "デベロッパー ツール ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "오프라인 상태입니다. 메시지는 임시보관함에 저장되어 있습니다.",
"offline_send_unsaved": "오프라인 상태입니다. 메시지는 여기에 남아 있으며 다시 온라인이 되면 임시보관함에 저장됩니다."
},
"composer_panel": {
"show_panel": "{name} 표시",
"hide_panel": "{name} 숨기기"
},
"desktopDevTools": {
"section_title": "문제 해결",
"label": "개발자 도구 ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Jūs esat bezsaistē. Ziņojums ir saglabāts melnrakstos.",
"offline_send_unsaved": "Jūs esat bezsaistē. Ziņojums paliek šeit un tiks saglabāts melnrakstos, kad atkal būsiet tiešsaistē."
},
"composer_panel": {
"show_panel": "Rādīt {name}",
"hide_panel": "Paslēpt {name}"
},
"desktopDevTools": {
"section_title": "Problēmu novēršana",
"label": "Izstrādātāju rīki ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Та офлайн байна. Мессеж нооргонд хадгалагдсан.",
"offline_send_unsaved": "Та офлайн байна. Мессеж энд үлдэж, онлайн болмогц нооргонд хадгалагдана."
},
"composer_panel": {
"show_panel": "{name} харуулах",
"hide_panel": "{name} нуух"
},
"desktopDevTools": {
"section_title": "Алдаа засах",
"label": "Хөгжүүлэгчийн хэрэгсэл ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Du er frakoblet. Meldingen er lagret i Utkast.",
"offline_send_unsaved": "Du er frakoblet. Meldingen blir her og lagres i Utkast når du er på nett igjen."
},
"composer_panel": {
"show_panel": "Vis {name}",
"hide_panel": "Skjul {name}"
},
"desktopDevTools": {
"section_title": "Feilsøking",
"label": "Utviklerverktøy ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Je bent offline. Het bericht is opgeslagen in Concepten.",
"offline_send_unsaved": "Je bent offline. Het bericht blijft hier en wordt in Concepten opgeslagen zodra je weer online bent."
},
"composer_panel": {
"show_panel": "{name} tonen",
"hide_panel": "{name} verbergen"
},
"desktopDevTools": {
"section_title": "Probleemoplossing",
"label": "Ontwikkelaarstools ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Jesteś offline. Wiadomość jest zapisana w Szkicach.",
"offline_send_unsaved": "Jesteś offline. Wiadomość zostaje tutaj i zostanie zapisana w Szkicach, gdy wrócisz do sieci."
},
"composer_panel": {
"show_panel": "Pokaż: {name}",
"hide_panel": "Ukryj: {name}"
},
"desktopDevTools": {
"section_title": "Rozwiązywanie problemów",
"label": "Narzędzia dla deweloperów ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Está offline. A mensagem está guardada em Rascunhos.",
"offline_send_unsaved": "Está offline. A mensagem fica aqui e é guardada em Rascunhos quando voltar a estar online."
},
"composer_panel": {
"show_panel": "Mostrar {name}",
"hide_panel": "Ocultar {name}"
},
"desktopDevTools": {
"section_title": "Resolução de problemas",
"label": "Ferramentas de programador ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Sunteți offline. Mesajul este salvat în Ciorne.",
"offline_send_unsaved": "Sunteți offline. Mesajul rămâne aici și este salvat în Ciorne când sunteți din nou online."
},
"composer_panel": {
"show_panel": "Afișează {name}",
"hide_panel": "Ascunde {name}"
},
"desktopDevTools": {
"section_title": "Depanare",
"label": "Instrumente pentru dezvoltatori ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Вы не в сети. Сообщение сохранено в черновиках.",
"offline_send_unsaved": "Вы не в сети. Сообщение останется здесь и сохранится в черновиках, когда вы снова будете в сети."
},
"composer_panel": {
"show_panel": "Показать: {name}",
"hide_panel": "Скрыть: {name}"
},
"desktopDevTools": {
"section_title": "Устранение неполадок",
"label": "Инструменты разработчика ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Ste offline. Správa je uložená v Konceptoch.",
"offline_send_unsaved": "Ste offline. Správa tu zostane a uloží sa do Konceptov, keď budete znova online."
},
"composer_panel": {
"show_panel": "Zobraziť {name}",
"hide_panel": "Skryť {name}"
},
"desktopDevTools": {
"section_title": "Riešenie problémov",
"label": "Nástroje pre vývojárov ({shortcut})",
+4
View File
@@ -7681,6 +7681,10 @@
"offline_send_saved": "คุณออฟไลน์อยู่ ข้อความถูกบันทึกไว้ในจดหมายร่างแล้ว",
"offline_send_unsaved": "คุณออฟไลน์อยู่ ข้อความจะอยู่ที่นี่และถูกบันทึกในจดหมายร่างเมื่อคุณกลับมาออนไลน์"
},
"composer_panel": {
"show_panel": "แสดง {name}",
"hide_panel": "ซ่อน {name}"
},
"desktopDevTools": {
"section_title": "การแก้ไขปัญหา",
"label": "เครื่องมือสำหรับนักพัฒนาซอฟต์แวร์ ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Çevrimdışısınız. İleti Taslaklar'a kaydedildi.",
"offline_send_unsaved": "Çevrimdışısınız. İleti burada kalır ve yeniden çevrimiçi olduğunuzda Taslaklar'a kaydedilir."
},
"composer_panel": {
"show_panel": "{name} panelini göster",
"hide_panel": "{name} panelini gizle"
},
"desktopDevTools": {
"section_title": "Sorun giderme",
"label": "Geliştirici araçları ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "Ви не в мережі. Повідомлення збережено в чернетках.",
"offline_send_unsaved": "Ви не в мережі. Повідомлення залишиться тут і збережеться в чернетках, коли ви знову будете в мережі."
},
"composer_panel": {
"show_panel": "Показати: {name}",
"hide_panel": "Сховати: {name}"
},
"desktopDevTools": {
"section_title": "Усунення несправностей",
"label": "Інструменти розробника ({shortcut})",
+4
View File
@@ -7685,6 +7685,10 @@
"offline_send_saved": "Bạn đang ngoại tuyến. Thư đã được lưu trong Bản nháp.",
"offline_send_unsaved": "Bạn đang ngoại tuyến. Thư vẫn ở đây và sẽ được lưu vào Bản nháp khi bạn trực tuyến trở lại."
},
"composer_panel": {
"show_panel": "Hiện {name}",
"hide_panel": "Ẩn {name}"
},
"desktopDevTools": {
"section_title": "Khắc phục sự cố",
"label": "Công cụ cho nhà phát triển ({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "你已離線。郵件已儲存在草稿中。",
"offline_send_unsaved": "你已離線。郵件會留在這裡,恢復連線後儲存到草稿。"
},
"composer_panel": {
"show_panel": "顯示{name}",
"hide_panel": "隱藏{name}"
},
"desktopDevTools": {
"section_title": "疑難排解",
"label": "開發人員工具({shortcut})",
+4
View File
@@ -7673,6 +7673,10 @@
"offline_send_saved": "你已离线。邮件已保存在草稿中。",
"offline_send_unsaved": "你已离线。邮件会留在这里,恢复联网后保存到草稿。"
},
"composer_panel": {
"show_panel": "显示{name}",
"hide_panel": "隐藏{name}"
},
"desktopDevTools": {
"section_title": "故障排除",
"label": "开发者工具({shortcut})",