mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-09 01:45:00 +00:00
fix(app): show the archive undo toast in the sidebar, with only Undo pressable
The archive button sat 2px from the kebab, so a press aimed at the menu could archive the workspace. The toast card was a Pressable used only to pause on hover, which made the whole card look clickable. Toasts raised by the workspace list now land above the sidebar footer, next to the row that raised them. A collapsed sidebar stays mounted and its rows still handle the archive shortcut, so while it is hidden those toasts go to the app host. A toast leaves when the sidebar hides because its dismissal is what ends an archive's undo window.
This commit is contained in:
@@ -10,6 +10,8 @@ import { expectWorkspaceAbsentFromSidebar } from "./sidebar";
|
||||
type DaemonClient = Awaited<ReturnType<typeof connectNewWorkspaceDaemonClient>>;
|
||||
|
||||
const UNDO_SHORTCUT = process.platform === "darwin" ? "Meta+Z" : "Control+Z";
|
||||
const ARCHIVE_SHORTCUT =
|
||||
process.platform === "darwin" ? "Meta+Shift+Backspace" : "Control+Shift+Backspace";
|
||||
/** The archived toast's lifetime, from `WORKSPACE_ARCHIVE_UNDO_WINDOW_MS`. */
|
||||
const UNDO_WINDOW_MS = 6000;
|
||||
|
||||
@@ -46,6 +48,25 @@ export async function archiveFromRowButton(page: Page, workspaceId: string): Pro
|
||||
await expect(undoButton(page)).toBeVisible();
|
||||
}
|
||||
|
||||
/** Drags the sidebar's edge past its minimum, leaving it as narrow as it goes. */
|
||||
export async function resizeSidebarToMinimum(page: Page): Promise<void> {
|
||||
const handle = await page.getByTestId("left-sidebar-resize-handle").boundingBox();
|
||||
if (!handle) throw new Error("Sidebar resize handle is not laid out");
|
||||
const y = handle.y + handle.height / 2;
|
||||
await page.mouse.move(handle.x + handle.width / 2, y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(handle.x - 30, y, { steps: 8 });
|
||||
await page.mouse.move(10, y, { steps: 16 });
|
||||
await page.mouse.up();
|
||||
await expect
|
||||
.poll(async () => (await page.getByTestId("sidebar-footer").boundingBox())?.width)
|
||||
.toBeLessThanOrEqual(200);
|
||||
}
|
||||
|
||||
export async function pressArchiveShortcut(page: Page): Promise<void> {
|
||||
await page.keyboard.press(ARCHIVE_SHORTCUT);
|
||||
}
|
||||
|
||||
export async function pressUndoShortcut(page: Page): Promise<void> {
|
||||
await page.keyboard.press(UNDO_SHORTCUT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user