From 9414437353cc43dd4b0325038fa66d4a6594712c Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Wed, 30 Oct 2024 10:37:51 +0000 Subject: [PATCH] Start showing diffs --- .../patches/[changeId]/+page.svelte | 7 ++++ .../cloud/patches/CloudPatchDetails.svelte | 4 +-- .../cloud/patches/CloudPatchSections.svelte | 36 +++++++++++++++++++ .../src/lib/cloud/patches/DiffSection.svelte | 22 ++++++++++++ packages/shared/src/lib/cloud/types.ts | 4 +-- 5 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 packages/shared/src/lib/cloud/patches/CloudPatchSections.svelte create mode 100644 packages/shared/src/lib/cloud/patches/DiffSection.svelte diff --git a/apps/desktop/src/routes/[projectId]/series/branches/[cloudBranchId]/patches/[changeId]/+page.svelte b/apps/desktop/src/routes/[projectId]/series/branches/[cloudBranchId]/patches/[changeId]/+page.svelte index b21e74fed5..aaa84f9850 100644 --- a/apps/desktop/src/routes/[projectId]/series/branches/[cloudBranchId]/patches/[changeId]/+page.svelte +++ b/apps/desktop/src/routes/[projectId]/series/branches/[cloudBranchId]/patches/[changeId]/+page.svelte @@ -1,5 +1,6 @@ {#if $optionalPatch.state === 'uninitialized'} @@ -44,7 +42,7 @@
-

Reviews (all versions):

+

Reviews (all revisions):

Viewings: {patch.reviewAll.viewed}

Sign offs: {patch.reviewAll.signedOff}

diff --git a/packages/shared/src/lib/cloud/patches/CloudPatchSections.svelte b/packages/shared/src/lib/cloud/patches/CloudPatchSections.svelte new file mode 100644 index 0000000000..b77779ba92 --- /dev/null +++ b/packages/shared/src/lib/cloud/patches/CloudPatchSections.svelte @@ -0,0 +1,36 @@ + + +{#if $optionalPatch.state === 'uninitialized'} +

Loading...

+{:else if $optionalPatch.state === 'not-found'} +

Failed to find patch

+{:else if $optionalPatch.state === 'found'} + {@const patch = $optionalPatch.value} + +

{patch.title}

+ + {#each patch.sections as section} + {#if section.sectionType === 'diff'} + + {/if} + {/each} +{/if} + + diff --git a/packages/shared/src/lib/cloud/patches/DiffSection.svelte b/packages/shared/src/lib/cloud/patches/DiffSection.svelte new file mode 100644 index 0000000000..11bc7190bb --- /dev/null +++ b/packages/shared/src/lib/cloud/patches/DiffSection.svelte @@ -0,0 +1,22 @@ + + +
+

{diffSection.newPath || diffSection.oldPath}

+
+
{diffSection.diffPatch}
+
+
+ + diff --git a/packages/shared/src/lib/cloud/types.ts b/packages/shared/src/lib/cloud/types.ts index f7c78fdc50..c791d84d39 100644 --- a/packages/shared/src/lib/cloud/types.ts +++ b/packages/shared/src/lib/cloud/types.ts @@ -139,7 +139,7 @@ interface CloudSection { position?: number; } -class CloudTextSection implements CloudSection { +export class CloudTextSection implements CloudSection { id: number; sectionType: 'text' = 'text' as const; identifier?: string | undefined; @@ -164,7 +164,7 @@ class CloudTextSection implements CloudSection { this.data = apiTextSection.data; } } -class CloudDiffSection implements CloudSection { +export class CloudDiffSection implements CloudSection { id: number; sectionType: 'diff' = 'diff' as const; identifier?: string | undefined;