diff --git a/httpd-client/lib/project.ts b/httpd-client/lib/project.ts index 5b9d04f1a..a955ad5bc 100644 --- a/httpd-client/lib/project.ts +++ b/httpd-client/lib/project.ts @@ -1,3 +1,4 @@ +import type { Embed } from "@app/lib/file.js"; import type { Commit, Commits } from "./project/commit.js"; import type { Fetcher, RequestOptions } from "./fetcher.js"; import type { @@ -365,7 +366,7 @@ export class Client { title: string; description: string; assignees: string[]; - embeds: { name: string; content: string }[]; + embeds: Embed[]; labels: string[]; }, authToken: string, diff --git a/httpd-client/lib/project/comment.ts b/httpd-client/lib/project/comment.ts index 1e2d4ce43..6bd1f5a1e 100644 --- a/httpd-client/lib/project/comment.ts +++ b/httpd-client/lib/project/comment.ts @@ -2,6 +2,7 @@ import type { z } from "zod"; import { array, number, object, string, tuple } from "zod"; export type Comment = z.infer; +export type Embed = z.infer["embeds"][0]; export const commentSchema = object({ id: string(), diff --git a/httpd-client/lib/project/issue.ts b/httpd-client/lib/project/issue.ts index 5524cc93a..a010c2227 100644 --- a/httpd-client/lib/project/issue.ts +++ b/httpd-client/lib/project/issue.ts @@ -1,3 +1,4 @@ +import type { Embed } from "@app/lib/file.js"; import type { Comment } from "./comment.js"; import type { ZodSchema } from "zod"; import { array, boolean, literal, object, string, union } from "zod"; @@ -59,10 +60,15 @@ export type IssueUpdateAction = | { type: "comment"; body: string; - embeds: { name: string; content: string }[]; - replyTo: string; + embeds?: Embed[]; + replyTo?: string; + } + | { + type: "comment.edit"; + id: string; + body: string; + embeds: Embed[]; } - | { type: "comment.edit"; id: string; body: string } | { type: "comment.redact"; id: string } | { type: "comment.react"; diff --git a/httpd-client/lib/project/patch.ts b/httpd-client/lib/project/patch.ts index 0dfee9fa1..43e40eb39 100644 --- a/httpd-client/lib/project/patch.ts +++ b/httpd-client/lib/project/patch.ts @@ -1,3 +1,4 @@ +import type { Embed } from "@app/lib/file.js"; import type { Comment } from "./comment.js"; import type { ZodSchema, z } from "zod"; @@ -162,12 +163,15 @@ export type PatchUpdateAction = review: string; body: string; location: CodeLocation; + replyTo?: string; + embeds?: Embed[]; } | { type: "review.comment.edit"; review: string; comment: string; body: string; + embeds: Embed[]; } | { type: "review.comment.redact"; @@ -188,6 +192,8 @@ export type PatchUpdateAction = type: "revision.comment"; revision: string; body: string; + embeds?: Embed[]; + location?: CodeLocation; replyTo?: string; } | { @@ -195,6 +201,7 @@ export type PatchUpdateAction = revision: string; comment: string; body: string; + embeds: Embed[]; } | { type: "revision.comment.redact"; diff --git a/src/components/Comment.svelte b/src/components/Comment.svelte index 8a1b565b4..5143898cd 100644 --- a/src/components/Comment.svelte +++ b/src/components/Comment.svelte @@ -1,29 +1,35 @@ + + + +{#if active} + (active = false)} + on:submit={event => { + active = false; + dispatch("submit", event.detail); + }} /> +{:else} + +
(active = true)}> + {placeholder} +
+{/if} diff --git a/src/components/CommentTextarea.svelte b/src/components/ExtendedTextarea.svelte similarity index 56% rename from src/components/CommentTextarea.svelte rename to src/components/ExtendedTextarea.svelte index a8daa834e..a03b1730f 100644 --- a/src/components/CommentTextarea.svelte +++ b/src/components/ExtendedTextarea.svelte @@ -1,5 +1,5 @@ - -
- -
+{#if loading} + +{:else} + +
+ +
+{/if} diff --git a/src/components/Markdown.svelte b/src/components/Markdown.svelte index 1937eb9b0..26a68491e 100644 --- a/src/components/Markdown.svelte +++ b/src/components/Markdown.svelte @@ -1,4 +1,6 @@