From fc05770775236b663489518a26f65c826ca3f646 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 3 Jul 2023 12:18:13 +0200 Subject: [PATCH] Split patch revision creation from patch revision events Also uses same border-radius on comment and other events, and removes the revision creation as a timeline event. Signed-off-by: Sebastian Martinez --- src/components/Comment.svelte | 4 +- src/components/Thread.svelte | 5 +- src/views/projects/Cob/Revision.svelte | 375 ++++++++++++------------- src/views/projects/Patch.svelte | 21 +- 4 files changed, 185 insertions(+), 220 deletions(-) diff --git a/src/components/Comment.svelte b/src/components/Comment.svelte index 6dec83771..0520f0a6e 100644 --- a/src/components/Comment.svelte +++ b/src/components/Comment.svelte @@ -26,7 +26,7 @@ .card { display: flex; flex-direction: column; - border-radius: var(--border-radius); + border-radius: inherit; background-color: inherit; } .card-header { @@ -38,7 +38,7 @@ } .card-body { font-size: var(--font-size-small); - padding: 0 1rem 0.5rem 1rem; + padding: 0 1rem 0.7rem 1rem; } .actions { display: flex; diff --git a/src/components/Thread.svelte b/src/components/Thread.svelte index db92a4dce..1b093faa1 100644 --- a/src/components/Thread.svelte +++ b/src/components/Thread.svelte @@ -57,10 +57,10 @@ } .comment { background-color: var(--color-foreground-1); - border-radius: var(--border-radius); + border-radius: var(--border-radius-small); } .reply { - margin-left: 3rem; + margin-left: 1.5rem; } .actions { display: flex; @@ -89,6 +89,7 @@ id={reply.id} authorId={reply.author.id} authorAlias={reply.author.alias} + caption="replied" timestamp={reply.timestamp} body={reply.body} /> diff --git a/src/views/projects/Cob/Revision.svelte b/src/views/projects/Cob/Revision.svelte index aad8d1f3a..116190508 100644 --- a/src/views/projects/Cob/Revision.svelte +++ b/src/views/projects/Cob/Revision.svelte @@ -33,6 +33,7 @@ export let revisionOid: string; export let revisionTimestamp: number; export let revisionAuthor: { id: string; alias?: string | undefined }; + export let revisionDescription: string; export let timelines: Timeline[]; export let previousRevId: string | undefined = undefined; export let previousRevOid: string | undefined = undefined; @@ -80,38 +81,29 @@
-
-
-
- (expanded = !expanded)} /> +
+
+
+
+ (expanded = !expanded)} /> +
+ + Revision + {utils.formatObjectId(revisionId)} + + +
+
+
+ + {utils.formatTimestamp(revisionTimestamp)} + + {#if response?.diff.stats} + {@const { insertions, deletions } = response.diff.stats} + + {/if} + {#if previousRevOid} + + + + {/if} + + + + + + + + + {#if item === projectHead} + + Compare to {projectDefaultBranch} ({utils.formatObjectId( + projectHead, + )}) + + {:else if previousRevId} + + Compare to previous revision ({utils.formatObjectId( + previousRevId, + )}) + + {/if} + + + + +
- - Revision - {utils.formatObjectId(revisionId)} - - -
-
-
- - {utils.formatTimestamp(revisionTimestamp)} - - {#if response?.diff.stats} - {@const { insertions, deletions } = response.diff.stats} - - {/if} - {#if previousRevOid} - - - - {/if} - - - - - - - - - {#if item === projectHead} - - Compare to {projectDefaultBranch} ({utils.formatObjectId( - projectHead, - )}) - - {:else if previousRevId} - - Compare to previous revision ({utils.formatObjectId( - previousRevId, - )}) - - {/if} - - - - -
+ {#if expanded} + {@const caption = + patchId === revisionId + ? "opened this patch" + : `updated to ${utils.formatObjectId(revisionId)}`} +
+ {#if revisionDescription && !first} +
+ +
+ {/if} +
+ + {caption} + + {#if response?.commits} +
+ {#each response.commits as commit, i} +
+ + ╰─ + + {i === 0 ? "╎" : "│"} + + + +
+ +
+
+
+ + {utils.formatCommit(commit.id)} + +
+ {/each} +
+ {/if} +
+ {#if error} +
+ +
+ {/if} +
+ {/if}
{#if expanded} -
+ {#if timelines.length > 0} {#each timelines as element} - {#if element.type === "thread"} -
+
+ {#if element.type === "thread"} -
- {:else if element.type === "revision"} - {@const caption = - patchId === element.inner.id - ? "opened this patch" - : `updated to ${utils.formatObjectId(element.inner.id)}`} - {#if element.inner.description && !first} -
- -
- {/if} -
- - {caption} - - {#if response?.commits} -
- {#each response.commits.reverse() as commit, i} -
- - ╰─ - - {i === 0 ? "╎" : "│"} - - - -
- -
-
-
- - {utils.formatCommit(commit.id)} - -
- {/each} -
- {/if} -
- {#if error} -
- -
- {/if} - {:else if element.type === "merge"} -
-
+ {:else if element.type === "merge"} +
-
-
-
+
-
- {:else if element.type === "review"} - {@const [author, review] = element.inner} - {#if review.comment} -
- -
- {:else} -
-
+ {:else if element.type === "review"} + {@const [author, review] = element.inner} + {#if review.comment} +
+ +
+ {:else} +
-
-
-
+
-
+ {/if} {/if} - {/if} +
{/each} -
+ {/if} {/if}
diff --git a/src/views/projects/Patch.svelte b/src/views/projects/Patch.svelte index 02633cf79..4de6b9b43 100644 --- a/src/views/projects/Patch.svelte +++ b/src/views/projects/Patch.svelte @@ -1,5 +1,5 @@