Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Show first revision description on patch
Brandon Oxendine committed 2 days ago
commit 56db0a0dcb1e01a1c802e7803856987b280c9593
parent 255bc46
2 files changed +53 -22
modified src/components/Revision.svelte
@@ -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}
modified src/views/repo/Patch.svelte
@@ -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">