diff --git a/src/components/IssueTimeline.svelte b/src/components/IssueTimeline.svelte index 5f545ebf7..f46939099 100644 --- a/src/components/IssueTimeline.svelte +++ b/src/components/IssueTimeline.svelte @@ -17,6 +17,7 @@ authorForNodeId, formatTimestamp, issueStatusColor, + pluralize, publicKeyFromDid, } from "@app/lib/utils"; import Icon from "./Icon.svelte"; @@ -126,72 +127,95 @@ - {:else if op.type === "label" && op.previous && op.previous.type === op.type} - {@const changed = itemDiff(op.previous?.labels ?? [], op.labels)} - {#if changed.added.length || changed.removed.length} -
-
- -
-
- - {#if changed.added.length} - added label{changed.added.length > 1 ? "s" : ""} - {#each changed.added as label} - {label} - {/each} + {:else if op.type === "label"} +
+
+ +
+
+ + {#if op.previous && op.previous.type === op.type} + {@const changed = itemDiff(op.previous?.labels ?? [], op.labels)} + {#if changed.added.length || changed.removed.length} + {#if changed.added.length} + added {pluralize("label", changed.removed.length)} + {#each changed.added as label} + {label} + {/each} + {/if} + {#if changed.removed.length} + removed {pluralize("label", changed.removed.length)} + {#each changed.removed as label} + {label} + {/each} + {/if} {/if} - {#if changed.removed.length} - removed label{changed.removed.length > 1 ? "s" : ""} - {#each changed.removed as label} - {label} - {/each} - {/if} -
- {formatTimestamp(op.timestamp)} -
+ {:else} + added {pluralize("label", op.labels.length)} + {#each op.labels as label} + {label} + {/each} + {/if} +
+ {formatTimestamp(op.timestamp)}
- {/if} - {:else if op.type === "assign" && op.previous && op.previous.type === op.type} - {@const changed = itemDiff(op.previous?.assignees ?? [], op.assignees)} - {#if changed.added.length || changed.removed.length} -
-
- -
-
- - {#if changed.added.length} - assigned - {#each changed.added as assignee} - {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} - - {/await} - {/each} +
+ {:else if op.type === "assign"} +
+
+ +
+
+ + {#if op.previous && op.previous.type === op.type} + {@const changed = itemDiff( + op.previous?.assignees ?? [], + op.assignees, + )} + {#if changed.added.length || changed.removed.length} + {#if changed.added.length} + assigned + {#each changed.added as assignee} + {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} + + {/await} + {/each} + {/if} + {#if changed.removed.length} + unassigned + {#each changed.removed as assignee} + {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} + + {/await} + {/each} + {/if} {/if} - {#if changed.removed.length} - unassigned - {#each changed.removed as assignee} - {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} - - {/await} - {/each} - {/if} -
- {formatTimestamp(op.timestamp)} -
+ {:else} + assigned + {#each op.assignees as assignee} + {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} + + {/await} + {/each} + {/if} +
+ {formatTimestamp(op.timestamp)}
- {/if} +
{:else if op.type === "edit"} {#if op.previous && op.previous.type === op.type}
diff --git a/src/components/PatchTimeline.svelte b/src/components/PatchTimeline.svelte index a90b4de37..b573e8095 100644 --- a/src/components/PatchTimeline.svelte +++ b/src/components/PatchTimeline.svelte @@ -17,6 +17,7 @@ authorForNodeId, formatTimestamp, patchStatusColor, + pluralize, publicKeyFromDid, } from "@app/lib/utils"; import Icon from "./Icon.svelte"; @@ -147,42 +148,52 @@
- {:else if op.type === "label" && op.previous && op.previous.type === op.type} - {@const changed = itemDiff(op.previous?.labels ?? [], op.labels)} - {#if changed.added.length || changed.removed.length} -
-
- -
-
- - {#if changed.added.length} - added label{changed.added.length > 1 ? "s" : ""} - {#each changed.added as label} - {label} - {/each} + {:else if op.type === "label"} +
+
+ +
+
+ + {#if op.previous && op.previous.type === op.type} + {@const changed = itemDiff(op.previous?.labels ?? [], op.labels)} + {#if changed.added.length || changed.removed.length} + {#if changed.added.length} + added {pluralize("label", changed.added.length)} + {#each changed.added as label} + {label} + {/each} + {/if} + {#if changed.removed.length} + removed {pluralize("label", changed.removed.length)} + {#each changed.removed as label} + {label} + {/each} + {/if} {/if} - {#if changed.removed.length} - removed label{changed.removed.length > 1 ? "s" : ""} - {#each changed.removed as label} - {label} - {/each} - {/if} -
- {formatTimestamp(op.timestamp)} -
+ {:else} + added {pluralize("label", op.labels.length)} + {#each op.labels as label} + {label} + {/each} + {/if} +
+ {formatTimestamp(op.timestamp)}
- {/if} - {:else if op.type === "assign" && op.previous && op.previous.type === op.type} - {@const changed = itemDiff(op.previous?.assignees ?? [], op.assignees)} - {#if changed.added.length || changed.removed.length} -
-
- -
-
- +
+ {:else if op.type === "assign"} +
+
+ +
+
+ + {#if op.previous && op.previous.type === op.type} + {@const changed = itemDiff( + op.previous?.assignees ?? [], + op.assignees, + )} {#if changed.added.length} assigned {#each changed.added as assignee} @@ -207,12 +218,23 @@ {/await} {/each} {/if} -
- {formatTimestamp(op.timestamp)} -
+ {:else} + assigned + {#each op.assignees as assignee} + {#await invoke( "alias", { nid: publicKeyFromDid(assignee) }, ) then alias} + + {/await} + {/each} + {/if} +
+ {formatTimestamp(op.timestamp)}
- {/if} +
{:else if op.type === "merge"}