Skip to content

Commit

Permalink
squash: change comment captions
Browse files Browse the repository at this point in the history
Remove some unused types
  • Loading branch information
sebastinez committed Dec 14, 2023
1 parent 80e6705 commit 19f0732
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 0 additions & 4 deletions httpd-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ import type {
} from "./lib/project/commit.js";
import type { Issue, IssueState } from "./lib/project/issue.js";
import type {
CodeLocation,
LifecycleState,
Merge,
Patch,
PatchState,
PatchUpdateAction,
Range,
Review,
Revision,
Verdict,
Expand All @@ -42,7 +40,6 @@ import { Fetcher } from "./lib/fetcher.js";
export type {
BaseUrl,
Blob,
CodeLocation,
Comment,
Commit,
CommitBlob,
Expand All @@ -62,7 +59,6 @@ export type {
PatchState,
PatchUpdateAction,
Project,
Range,
Remote,
Review,
Revision,
Expand Down
26 changes: 14 additions & 12 deletions src/components/Comment.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
let state: "read" | "edit" | "submit" = "read";
function editedCaption(lastEdit: Comment["edits"][0]) {
return ` ${
lastEdit.author.alias
? lastEdit.author.alias
: utils.formatNodeId(lastEdit.author.id)
} edited ${utils.formatTimestamp(lastEdit.timestamp / 1000)}`;
}
export let editComment:
| ((body: string, embeds: Embed[]) => Promise<void>)
| undefined = undefined;
Expand Down Expand Up @@ -130,6 +138,11 @@
</div>
<NodeId nodeId={authorId} alias={authorAlias} />
{caption}
{#if lastEdit}
<span class="txt-small last-edit" title={editedCaption(lastEdit)}>
• edited
</span>
{/if}
<div class="header-right">
{#if id && editComment && state === "read"}
<div class="edit-buttons">
Expand Down Expand Up @@ -175,7 +188,7 @@
<Markdown {rawPath} content={body} />
{/if}
</div>
{#if (id && handleReaction) || (id && reactions && reactions.size > 0) || lastEdit}
{#if (id && handleReaction) || (id && reactions && reactions.size > 0)}
<div class="actions">
{#if id && handleReaction}
{@const handleReaction_ = handleReaction}
Expand All @@ -192,17 +205,6 @@
{#if id && reactions && reactions.size > 0}
<Reactions {handleReaction} {reactions} />
{/if}
{#if lastEdit}
<span class="txt-small last-edit">
<!-- TODO: When timestamp is being returned as seconds instead of ms, remove / 1000 -->
Edited {utils.formatTimestamp(lastEdit.timestamp / 1000)} by
{#if lastEdit.author.alias}
{lastEdit.author.alias}
{:else}
{utils.formatNodeId(lastEdit.author.id)}
{/if}
</span>
{/if}
</div>
{/if}
</div>

0 comments on commit 19f0732

Please sign in to comment.