diff --git a/src/components/IssueTimeline.svelte b/src/components/IssueTimeline.svelte new file mode 100644 index 000000000..d73140344 --- /dev/null +++ b/src/components/IssueTimeline.svelte @@ -0,0 +1,242 @@ + + + + +
+ {#each timeline as op} + {#if op.type === "lifecycle"} +
+
+ +
+
+ + {#if op.state.status === "closed"} + closed issue as {op.state.reason} + {:else if op.state.status === "open"} + reopened issue + {/if} +
+ {formatTimestamp(op.timestamp)} +
+
+
+ {: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} + {/if} + {#if changed.removed.length} + removed label{changed.removed.length > 1 ? "s" : ""} + {#each changed.removed 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} + {/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)} +
+
+
+ {/if} + {:else if op.type === "edit"} + {#if op.previous && op.previous.type === op.type} +
+
+ +
+
+ + changed title + {op.previous.title} + -> {op.title} +
+ {formatTimestamp(op.timestamp)} +
+
+
+ {/if} + {:else if op.type === "comment"} + {#if op.id === activity[0].id} +
+
+ +
+
+ +
opened issue
+
+ {formatTimestamp(op.timestamp)} +
+
+
+ {:else} +
+
+ +
+ +
+ {/if} + {/if} + {/each} +
diff --git a/src/components/IssueTimelineLifecycleAction.svelte b/src/components/IssueTimelineLifecycleAction.svelte deleted file mode 100644 index e548fe44a..000000000 --- a/src/components/IssueTimelineLifecycleAction.svelte +++ /dev/null @@ -1,28 +0,0 @@ - - - -
-
- - changed status to - - {formatTimestamp(op.timestamp)} -
-
-
diff --git a/src/components/PatchTimeline.svelte b/src/components/PatchTimeline.svelte index 28d6c697a..28bf42f4b 100644 --- a/src/components/PatchTimeline.svelte +++ b/src/components/PatchTimeline.svelte @@ -83,6 +83,7 @@ display: flex; align-items: flex-start; gap: 0.5rem; + word-break: break-word; } .wrapper { display: flex; diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index cbf6234a2..8989938d0 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -24,6 +24,7 @@ import { announce } from "@app/components/AnnounceSwitch.svelte"; + import AssigneeInput from "@app/components/AssigneeInput.svelte"; import Border from "@app/components/Border.svelte"; import CommentComponent from "@app/components/Comment.svelte"; import CommentToggleInput from "@app/components/CommentToggleInput.svelte"; @@ -33,14 +34,13 @@ import IssueSecondColumn from "@app/components/IssueSecondColumn.svelte"; import IssueStateBadge from "@app/components/IssueStateBadge.svelte"; import IssueStateButton from "@app/components/IssueStateButton.svelte"; - import IssueTimelineLifecycleAction from "@app/components/IssueTimelineLifecycleAction.svelte"; + import IssueTimeline from "@app/components/IssueTimeline.svelte"; import LabelInput from "@app/components/LabelInput.svelte"; + import Sidebar from "@app/components/Sidebar.svelte"; import TextInput from "@app/components/TextInput.svelte"; import ThreadComponent from "@app/components/Thread.svelte"; import Layout from "./Layout.svelte"; - import Sidebar from "@app/components/Sidebar.svelte"; - import AssigneeInput from "@app/components/AssigneeInput.svelte"; interface Props { repo: RepoInfo; @@ -72,6 +72,8 @@ let labelSaveInProgress: boolean = $state(false); let assigneesSaveInProgress: boolean = $state(false); let focusReply: boolean = $state(false); + let hideDiscussion = $state(false); + let hideTimeline = $state(false); $effect(() => { // The component doesn't get destroyed when we switch between different @@ -86,6 +88,8 @@ editingTitle = false; updatedTitle = issue.title; focusReply = false; + hideDiscussion = false; + hideTimeline = false; }); const project = $derived(repo.payloads["xyz.radicle.project"]!); @@ -324,7 +328,7 @@ width: 2rem; } .issue-body { - margin-top: 1rem; + margin: 1rem 0; position: relative; } /* We put the background and clip-path in a separate element to prevent @@ -373,6 +377,9 @@ margin-bottom: 0.5rem; color: var(--color-foreground-dim); } + .hide { + display: none; + } @@ -520,46 +527,64 @@ {/snippet} -
-
- {#each activity as op} - {#each op.actions as action} - {#if action.type === "lifecycle"} - -
- {:else if action.type === "comment"} - {@const thread = threads.find(t => t.root.id === op.id)} - {#if thread} - delegate.did), - )} - {editComment} - createReply={partial(createReply)} - reactOnComment={partial(reactOnComment, config.publicKey)} /> -
- {/if} - {/if} +
+ +
(hideDiscussion = !hideDiscussion)}> + Discussion +
+
+ {#each threads as thread} + delegate.did), + )} + {editComment} + createReply={partial(createReply)} + reactOnComment={partial(reactOnComment, config.publicKey)} /> +
{/each} - {/each} + +
+ (topLevelReplyOpen = false) + : undefined} + placeholder="Leave a comment" + submit={partial(createComment)} /> +
+
-
- (topLevelReplyOpen = false) - : undefined} - placeholder="Leave a comment" - submit={partial(createComment)} /> +
+ +
(hideTimeline = !hideTimeline)}> + Timeline +
+
+ +