From 5bc873178a5779e41ddb662d40eeb6ee386d5736 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Mon, 22 Jul 2024 19:40:14 +1000 Subject: [PATCH] Fixes (including downloading Local projects from nested directories) (#10585) - Address part of https://github.com/enso-org/cloud-v2/issues/1350 - Turns out the reason downloads were broken were (I assume) the query string was getting lost - so the Electron server never passed the correct parent directory to the backend. - Fix "Escape" key using old project ID and navigating to a nonexistent tab - Fix validation for tab names (previously all strings were passing validation due to an incorrect custom predicate being passed to `zod`) - Add clip path to entire tab bar so that the bottoms of tabs are cut off on hover if they are next to the currently selected tab. - Add s-shaped curve to hovered tabs, so that their edges match the edges of the currently selected tab. - Avoid navigating back to "Data Catalog" page when closing a project tab, when the project tab is not the currently open page. - Fix size of paywall icons in "Shared With" column (16px to be consistent with all other icons) # Important Notes None --- .../e2e/actions/EditorPageActions.ts | 8 ++ app/dashboard/e2e/copy.spec.ts | 2 + .../dashboard/column/SharedWithColumn.tsx | 3 +- .../columnHeading/SharedWithColumnHeading.tsx | 4 +- app/dashboard/src/hooks/projectHooks.ts | 11 ++- app/dashboard/src/layouts/Editor.tsx | 6 +- app/dashboard/src/layouts/TabBar.tsx | 99 ++++++++++++++----- .../src/pages/dashboard/Dashboard.tsx | 24 ++--- .../src/providers/ProjectsProvider.tsx | 19 ++-- app/ide-desktop/client/src/bin/server.ts | 12 +-- 10 files changed, 124 insertions(+), 64 deletions(-) diff --git a/app/dashboard/e2e/actions/EditorPageActions.ts b/app/dashboard/e2e/actions/EditorPageActions.ts index f87535cca15..6121f2c93ec 100644 --- a/app/dashboard/e2e/actions/EditorPageActions.ts +++ b/app/dashboard/e2e/actions/EditorPageActions.ts @@ -12,4 +12,12 @@ export default class EditorPageActions extends PageActions { get goToPage(): Omit { return goToPageActions.goToPageActions(this.step.bind(this)) } + /** + * Waits for the editor to load. + */ + waitForEditorToLoad(): EditorPageActions { + return this.step('wait for the editor to load', async () => { + await this.page.waitForSelector('[data-testid=editor]', { state: 'visible' }) + }) + } } diff --git a/app/dashboard/e2e/copy.spec.ts b/app/dashboard/e2e/copy.spec.ts index f14cf38ef32..b1f9839d841 100644 --- a/app/dashboard/e2e/copy.spec.ts +++ b/app/dashboard/e2e/copy.spec.ts @@ -159,6 +159,7 @@ test.test('duplicate', ({ page }) => .mockAllAndLogin({ page }) // Assets: [0: New Project 1] .newEmptyProject() + .waitForEditorToLoad() .goToPage.drive() .driveTable.rightClickRow(0) .contextMenu.duplicate() @@ -176,6 +177,7 @@ test.test('duplicate (keyboard)', ({ page }) => .mockAllAndLogin({ page }) // Assets: [0: New Project 1] .newEmptyProject() + .waitForEditorToLoad() .goToPage.drive() .driveTable.clickRow(0) .press('Mod+D') diff --git a/app/dashboard/src/components/dashboard/column/SharedWithColumn.tsx b/app/dashboard/src/components/dashboard/column/SharedWithColumn.tsx index 7a47534debc..47335ddd3c3 100644 --- a/app/dashboard/src/components/dashboard/column/SharedWithColumn.tsx +++ b/app/dashboard/src/components/dashboard/column/SharedWithColumn.tsx @@ -102,7 +102,8 @@ export default function SharedWithColumn(props: SharedWithColumnPropsInternal) { diff --git a/app/dashboard/src/components/dashboard/columnHeading/SharedWithColumnHeading.tsx b/app/dashboard/src/components/dashboard/columnHeading/SharedWithColumnHeading.tsx index d58dbe6b8aa..c232144dd66 100644 --- a/app/dashboard/src/components/dashboard/columnHeading/SharedWithColumnHeading.tsx +++ b/app/dashboard/src/components/dashboard/columnHeading/SharedWithColumnHeading.tsx @@ -30,7 +30,7 @@ export default function SharedWithColumnHeading(props: column.AssetColumnHeading
{ @@ -46,7 +46,7 @@ export default function SharedWithColumnHeading(props: column.AssetColumnHeading feature="share" variant="icon" children={false} - size="xsmall" + size="medium" /> )}
diff --git a/app/dashboard/src/hooks/projectHooks.ts b/app/dashboard/src/hooks/projectHooks.ts index 2bdeb1afd83..4b04e4c1269 100644 --- a/app/dashboard/src/hooks/projectHooks.ts +++ b/app/dashboard/src/hooks/projectHooks.ts @@ -36,8 +36,10 @@ declare module '#/utilities/LocalStorage' { const PROJECT_SCHEMA = z .object({ - id: z.custom(x => typeof x === 'string'), - parentId: z.custom(x => typeof x === 'string'), + id: z.custom(x => typeof x === 'string' && x.startsWith('project-')), + parentId: z.custom( + x => typeof x === 'string' && x.startsWith('directory-') + ), title: z.string(), type: z.nativeEnum(backendModule.BackendType), }) @@ -329,6 +331,7 @@ export function useCloseProject() { const client = reactQuery.useQueryClient() const closeProjectMutation = useCloseProjectMutation() const removeLaunchedProject = projectsProvider.useRemoveLaunchedProject() + const projectsStore = projectsProvider.useProjectsStore() const setPage = projectsProvider.useSetPage() return eventCallbacks.useEventCallback((project: Project) => { @@ -359,7 +362,9 @@ export function useCloseProject() { removeLaunchedProject(project.id) - setPage(projectsProvider.TabType.drive) + if (projectsStore.getState().page === project.id) { + setPage(projectsProvider.TabType.drive) + } }) } diff --git a/app/dashboard/src/layouts/Editor.tsx b/app/dashboard/src/layouts/Editor.tsx index 156905de8ef..3d61f482c47 100644 --- a/app/dashboard/src/layouts/Editor.tsx +++ b/app/dashboard/src/layouts/Editor.tsx @@ -116,7 +116,11 @@ export default function Editor(props: EditorProps) { } return ( -