Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add activity timeline to `Issue.svelte`
Sebastian Martinez committed 1 year ago
commit a3a0850b497e6f41904ba222ca029cca9589add7
parent 3f88cedd40a655e0729cc2fb817af2af9084b76c
1 file changed +35 -0
modified src/views/repo/Issue.svelte
@@ -2,6 +2,7 @@
  import type { Config } from "@bindings/Config";
  import type { Issue } from "@bindings/Issue";
  import type { RepoInfo } from "@bindings/RepoInfo";
+
  import type { IssueOps } from "@bindings/IssueOps";

  import capitalize from "lodash/capitalize";

@@ -12,6 +13,7 @@
    issueStatusColor,
    truncateDid,
  } from "@app/lib/utils";
+
  import { invoke } from "@tauri-apps/api/core";

  import Border from "@app/components/Border.svelte";
  import CopyableId from "@app/components/CopyableId.svelte";
@@ -218,5 +220,38 @@
          content={issue.discussion[0].edits.slice(-1)[0].body} />
      {/if}
    </div>
+
    <div>
+
      {#await invoke<IssueOps[]>( "activity_by_id", { rid: repo.rid, typeName: "xyz.radicle.issue", id: issue.id }, ) then activity}
+
        {#each activity.slice(1) as { action, timestamp, author }}
+
          {#if action.type === "lifecycle"}
+
            <div class="txt-small body">
+
              <div class="global-flex txt-small">
+
                <NodeId {...authorForNodeId(author)} />
+
                alias={author.alias} /> change of status to {action.state
+
                  .status}
+
                <!-- <div class="global-oid"></div> -->
+
                {formatTimestamp(timestamp)}
+
              </div>
+
            </div>
+
          {:else if action.type === "comment"}
+
            <div class="txt-small body">
+
              <Markdown rid={repo.rid} breaks content={action.body} />
+
              <div class="global-flex txt-small" style:margin-top="1.5rem">
+
                <NodeId {...authorForNodeId(author)} />
+
                {#if action.replyTo}
+
                  replied to <div class="global-oid">
+
                    {formatOid(action.replyTo)}
+
                  </div>
+
                {:else}
+
                  commented
+
                {/if}
+
                <!-- <div class="global-oid"></div> -->
+
                {formatTimestamp(timestamp)}
+
              </div>
+
            </div>
+
          {/if}
+
        {/each}
+
      {/await}
+
    </div>
  </div>
</Layout>