mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Show first revision description on patch
This commit is contained in:
@@ -22,10 +22,18 @@
|
||||
revision: Revision;
|
||||
config: Config;
|
||||
loadPatch: () => Promise<void>;
|
||||
hideDescription?: boolean;
|
||||
}
|
||||
|
||||
const { rid, repoDelegates, patchId, revision, config, loadPatch }: Props =
|
||||
$props();
|
||||
const {
|
||||
rid,
|
||||
repoDelegates,
|
||||
patchId,
|
||||
revision,
|
||||
config,
|
||||
loadPatch,
|
||||
hideDescription = false,
|
||||
}: Props = $props();
|
||||
|
||||
const commentThreads = $derived(
|
||||
((revision.discussion &&
|
||||
@@ -164,26 +172,28 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="txt-body-m-regular patch-body">
|
||||
<CommentComponent
|
||||
caption={revision.id === patchId ? "opened patch" : "created revision"}
|
||||
{rid}
|
||||
id={revision.id}
|
||||
lastEdit={revision.description.length > 1
|
||||
? revision.description.at(-1)
|
||||
: undefined}
|
||||
author={revision.author}
|
||||
reactions={revision.reactions}
|
||||
timestamp={revision.timestamp}
|
||||
body={revision.description.slice(-1)[0].body}
|
||||
reactOnComment={reactOnRevision}
|
||||
editComment={roles.isDelegateOrAuthor(
|
||||
config.publicKey,
|
||||
repoDelegates.map(delegate => delegate.did),
|
||||
revision.author.did,
|
||||
) && editRevision}>
|
||||
</CommentComponent>
|
||||
</div>
|
||||
{#if !hideDescription}
|
||||
<div class="txt-body-m-regular patch-body">
|
||||
<CommentComponent
|
||||
caption={revision.id === patchId ? "opened patch" : "created revision"}
|
||||
{rid}
|
||||
id={revision.id}
|
||||
lastEdit={revision.description.length > 1
|
||||
? revision.description.at(-1)
|
||||
: undefined}
|
||||
author={revision.author}
|
||||
reactions={revision.reactions}
|
||||
timestamp={revision.timestamp}
|
||||
body={revision.description.slice(-1)[0].body}
|
||||
reactOnComment={reactOnRevision}
|
||||
editComment={roles.isDelegateOrAuthor(
|
||||
config.publicKey,
|
||||
repoDelegates.map(delegate => delegate.did),
|
||||
revision.author.did,
|
||||
) && editRevision}>
|
||||
</CommentComponent>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<Discussion
|
||||
cobId={patchId}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
import ExternalLink from "@app/components/ExternalLink.svelte";
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
import Id from "@app/components/Id.svelte";
|
||||
import Markdown from "@app/components/Markdown.svelte";
|
||||
import NewPatchButton from "@app/components/NewPatchButton.svelte";
|
||||
import PatchMetadata from "@app/components/PatchMetadata.svelte";
|
||||
import PatchTimeline from "@app/components/PatchTimeline.svelte";
|
||||
@@ -175,6 +176,9 @@
|
||||
value => value.author.did === didFromPublicKey(config.publicKey),
|
||||
),
|
||||
);
|
||||
const patchDescription = $derived(
|
||||
revisions[0]?.description.slice(-1)[0]?.body ?? "",
|
||||
);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -218,6 +222,13 @@
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.patch-description {
|
||||
background-color: var(--color-surface-canvas);
|
||||
border-radius: var(--border-radius-sm);
|
||||
font: var(--txt-body-m-regular);
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -341,6 +352,15 @@
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="patch-description">
|
||||
{#if patchDescription.trim()}
|
||||
<Markdown rid={repo.rid} breaks content={patchDescription} />
|
||||
{:else}
|
||||
<span class="txt-missing txt-body-m-regular">
|
||||
No description.
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="sidebar-inline">
|
||||
<PatchMetadata
|
||||
@@ -377,6 +397,7 @@
|
||||
patchId={patch.id}
|
||||
{loadPatch}
|
||||
revision={selectedRevision}
|
||||
hideDescription={selectedRevision.id === revisions[0]?.id}
|
||||
{config} />
|
||||
|
||||
<div class="global-flex" style:margin-top="1.5rem">
|
||||
|
||||
Reference in New Issue
Block a user