From d4e4f9749ab2d0242e735b3b34f9a35e20582acf Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Tue, 13 Jun 2023 13:18:24 +0200 Subject: [PATCH] Fix some drag & drop issues before demo --- .../projects_new/[projectId]/Board.svelte | 2 +- .../[projectId]/BranchLane.svelte | 4 +- .../[projectId]/CommitGroup.svelte | 38 ++++++++++--------- .../projects_new/[projectId]/helpers.ts | 11 ++++++ 4 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 src/routes/projects_new/[projectId]/helpers.ts diff --git a/src/routes/projects_new/[projectId]/Board.svelte b/src/routes/projects_new/[projectId]/Board.svelte index 58098b065..5b89f7965 100644 --- a/src/routes/projects_new/[projectId]/Board.svelte +++ b/src/routes/projects_new/[projectId]/Board.svelte @@ -52,7 +52,7 @@ id: `${Date.now()}-${file.id}-commit`, description: '', kind: 'commit', - files: [file], + files: [{ ...file, isDndShadowItem: false }], isDndShadowItem: !isFinal } ] diff --git a/src/routes/projects_new/[projectId]/BranchLane.svelte b/src/routes/projects_new/[projectId]/BranchLane.svelte index c502d9096..80cd6a353 100644 --- a/src/routes/projects_new/[projectId]/BranchLane.svelte +++ b/src/routes/projects_new/[projectId]/BranchLane.svelte @@ -36,9 +36,9 @@ for (const file of fileItems) { commitItems.push({ id: `${Date.now()}-${file.id}`, - description: '', + description: 'New commit', kind: 'commit', - files: [file], + files: [{ ...file, isDndShadowItem: false }], isDndShadowItem: !isFinal }); } diff --git a/src/routes/projects_new/[projectId]/CommitGroup.svelte b/src/routes/projects_new/[projectId]/CommitGroup.svelte index e545271ff..3d28c625e 100644 --- a/src/routes/projects_new/[projectId]/CommitGroup.svelte +++ b/src/routes/projects_new/[projectId]/CommitGroup.svelte @@ -50,24 +50,26 @@ } -
handleDndEvent(e, false)} - on:finalize={(e) => handleDndEvent(e, true)} -> - {#each files.filter((x) => x.hunks) as file, idx (file.id)} -
- -
- {/each} +
+
handleDndEvent(e, false)} + on:finalize={(e) => handleDndEvent(e, true)} + > + {#each files.filter((x) => x.hunks) as file, idx (file.id)} +
+ +
+ {/each} +
{description}
diff --git a/src/routes/projects_new/[projectId]/helpers.ts b/src/routes/projects_new/[projectId]/helpers.ts new file mode 100644 index 000000000..d929510c2 --- /dev/null +++ b/src/routes/projects_new/[projectId]/helpers.ts @@ -0,0 +1,11 @@ +import type { Commit, File } from './types'; + +export function createCommit(files: File[], isShadow: boolean): Commit { + return { + id: `commit-${Date.now()}`, + description: '', + kind: 'commit', + files: files, + isDndShadowItem: isShadow + }; +}