Skip to content

g1t/apps/web/app/routes/repo/issue.tsx

660 lines28,308 bytesCodeBlame
1import { env } from "cloudflare:workers";
2import { Bot, ExternalLink, GitCommitHorizontal, GitMerge, Play, Sparkles } from "lucide-react";
3import { Form, Link, redirect } from "react-router";
4
5import { type Pull, PROVIDERS, workOwner } from "@g1t/contracts";
6
7import type { Route } from "./+types/issue";
8import { excerpt, page } from "../../lib/meta";
9import { Markdown } from "../../components/markdown";
10import { AgentStepLine } from "../../components/agents";
11import {
12 Avatar,
13 CopyLine,
14 EmptyState,
15 ComputeNote,
16 ErrorText,
17 Input,
18 SubmitButton,
19 Textarea,
20 TimeAgo,
21} from "../../components/ui";
22import { CheckboxOption } from "../../components/ui/checkbox";
23import { CheckBadge } from "../../components/checks";
24import {
25 Assignee,
26 AssigneeStack,
27 ChangeSize,
28 CommentForm,
29 CommentList,
30 PeoplePicker,
31 IssueState,
32 Label,
33 PersonLink,
34 PullIcon,
35 plainText,
36} from "../../components/work";
37import { notFound } from "../../lib/not-found.server";
38import { openedBy } from "../../lib/opened-by";
39import { computeNoteFor } from "../../lib/compute.server";
40import { agents, identity, inbox, integrations, work } from "../../lib/services.server";
41import { assertSameOrigin, getViewer, requireUser, roleIn } from "../../lib/session.server";
42import { accessTo, refusal, repoFor } from "../../lib/access.server";
43import { SubscriptionBox } from "../../components/notifications";
44import { useRefreshWhile } from "../../lib/refresh";
45
46
47export function meta({ loaderData, params, ...args }: Route.MetaArgs) {
48 const issue = loaderData?.issue;
49 const title = issue ? `${issue.title} · Issue #${issue.number} · ` : "";
50 const state = issue?.state === "open" ? "Open" : issue?.reason === "not_planned" ? "Closed as not planned" : "Closed";
51 const body = excerpt(issue?.body);
52 return page(args, {
53 title: `${title}${params.owner}/${params.repo} · g1t`,
54 description: issue
55 ? `${state} issue #${issue.number} on ${params.owner}/${params.repo}, opened by ${issue.author.username}${issue.requestedBy ? ` for ${issue.requestedBy.username}` : ""}.${body ? ` ${body}` : ""}`
56 : null,
57 // The card shows the title and the state.
58 version: issue ? [issue.title, issue.state, issue.reason] : undefined,
59 type: "article",
60 });
61}
62
63export async function loader({ params, context }: Route.LoaderArgs) {
64 const viewer = getViewer(context);
65 const path = { namespace: params.owner, name: params.repo };
66 const number = Number(params.number);
67 // At once: only the plan's note waits for the viewer's role. Putting an
68 // agent on it needs Write: Read cannot spend compute.
69 const access = accessTo(context, params);
70 const [{ can }, found, labels, agentsEnabled, members, links, computeNote, subscription, active] = await Promise.all([
71 access,
72 work.getIssue(path, number, viewer),
73 work.listLabels(path, viewer),
74 env.RUNNER.enabled(viewer, path),
75 // A member picks assignees from the workspace's people.
76 roleIn(viewer, params.owner) ? identity.listMembers(params.owner, viewer) : null,
77 // What it is tied to outside g1t. Shown only once the issue is known visible.
78 integrations.links(path, number).catch(() => []),
79 // Before a member assigns g1t: whether the workspace's plan lets it start.
80 access.then(({ can }) => (can.run ? computeNoteFor(params.owner, "agent") : null)),
81 // Whether the viewer hears of it, for the sidebar's Notifications.
82 viewer
83 ? repoFor(context, params).then((repo) =>
84 repo.ok ? inbox.subscription(viewer, { repoId: repo.value.id, number }).catch(() => null) : null,
85 )
86 : null,
87 // The project's agents at work, for the line under the pull request
88 // one is on for this issue: with the page, not after it.
89 agents.listRuns(viewer, { repo: path, active: true, limit: 50 }).catch(() => null),
90 ]);
91 if (!found.ok) {
92 // Issues and pull requests share numbers; this one may be a pull request.
93 const pull = await work.getPull(path, number, viewer);
94 if (pull.ok) throw redirect(`/${params.owner}/${params.repo}/pull/${number}`);
95 throw notFound("issue");
96 }
97 const { issue } = found.value;
98 return {
99 ...found.value,
100 viewer,
101 labels: labels.ok ? labels.value : [],
102 agentsEnabled,
103 computeNote,
104 links,
105 subscription,
106 // As the project's agents.json has them; left out, the line fetches them.
107 activeRuns: active?.ok ? { runs: active.value, member: can.run } : undefined,
108 members: members?.ok ? members.value.map((member) => member.username) : [],
109 // The author can close and reopen their own issue, and whoever g1t's
110 // agent filed one for, that one; Triage and up, anyone's.
111 canManage: viewer != null && (viewer.id === workOwner(issue).id || can.triage),
112 can,
113 };
114}
115
116export async function action({ request, params, context }: Route.ActionArgs) {
117 assertSameOrigin(request);
118 const user = requireUser(context, request);
119 const form = await request.formData();
120 const path = { namespace: params.owner, name: params.repo };
121 const number = Number(params.number);
122 // What each form needs; closing your own issue is checked by work.
123 const needed = form.get("action") === "run-hosted" ? "run" : form.get("action") === "assign" || form.get("action") === "labels" ? "triage" : null;
124 const refused = needed ? await refusal(context, params, needed) : null;
125 if (refused) return { error: refused, action: String(form.get("action")) };
126
127 switch (form.get("action")) {
128 case "run-hosted": {
129 const result = await env.RUNNER.run(user, path, number, {
130 instructions: String(form.get("instructions") ?? ""),
131 });
132 return result.ok ? null : { error: result.error.message, action: "run-hosted" };
133 }
134 case "open-pull": {
135 const result = await work.openPull(user, path, {
136 issue: number,
137 agent: String(form.get("agent") ?? ""),
138 runtime: "external",
139 });
140 if (!result.ok) return { error: result.error.message };
141 throw redirect(`/${params.owner}/${params.repo}/pull/${result.value.number}`);
142 }
143 case "comment": {
144 const result = await work.addComment(user, path, number, {
145 body: String(form.get("body") ?? ""),
146 });
147 return result.ok ? null : { error: result.error.message };
148 }
149 case "assign": {
150 const result = await work.updateIssue(user, path, number, {
151 assignees: [
152 ...form.getAll("assignee").map(String),
153 ...String(form.get("others") ?? "").split(/[\s,]+/),
154 ],
155 });
156 return result.ok ? null : { error: result.error.message };
157 }
158 case "labels": {
159 const result = await work.updateIssue(user, path, number, {
160 labels: [
161 ...form.getAll("label").map(String),
162 ...String(form.get("labels") ?? "").split(","),
163 ],
164 });
165 return result.ok ? null : { error: result.error.message };
166 }
167 case "reopen": {
168 const result = await work.reopenIssue(user, path, number);
169 return result.ok ? null : { error: result.error.message };
170 }
171 default: {
172 const result = await work.closeIssue(
173 user,
174 path,
175 number,
176 form.get("action") === "close-not-planned" ? "not_planned" : "completed",
177 );
178 return result.ok ? null : { error: result.error.message };
179 }
180 }
181}
182
183/** What became of a pull request, in a few words. */
184function outcome(pull: Pull): string {
185 if (pull.status === "merged") return `Merged by ${pull.mergedBy ?? "someone"}`;
186 if (pull.supersededBy != null) return `Closed · #${pull.supersededBy} was merged instead`;
187 if (pull.status === "closed") return "Closed without merging";
188 if (pull.status === "draft") return "Draft · in progress";
189 return "Ready for review";
190}
191
192function PullRow({ pull, base }: { pull: Pull; base: string }) {
193 const merged = pull.status === "merged";
194 const opener = openedBy(pull);
195 return (
196 <li>
197 <Link
198 to={`${base}/pull/${pull.number}`}
199 className={`block rounded-xl border p-4 transition-colors ${
200 merged
201 ? "border-merged/40 bg-merged/5 hover:border-merged/70"
202 : "border-line bg-surface hover:border-line-strong"
203 } ${pull.status === "closed" ? "opacity-70" : ""}`}
204 >
205 <div className="flex flex-wrap items-center gap-x-3 gap-y-1">
206 <PullIcon status={pull.status} />
207 <span className="font-medium">
208 {pull.title} <span className="font-normal text-faint">#{pull.number}</span>
209 </span>
210 {pull.status === "draft" && (
211 <span className="size-1.5 animate-pulse rounded-full bg-accent" />
212 )}
213 <span className="ml-auto flex items-center gap-3 text-xs text-faint">
214 <ChangeSize files={pull.files} />
215 <CheckBadge status={pull.checkStatus} />
216 <span className="flex items-center gap-1 font-mono">
217 <GitCommitHorizontal size={13} />
218 {pull.headCommit?.slice(0, 7) ?? "no commits"}
219 </span>
220 <TimeAgo at={pull.updatedAt} />
221 </span>
222 </div>
223 <p className="mt-1.5 flex flex-wrap items-center gap-x-2 text-xs text-muted">
224 <span className={merged ? "font-medium text-merged" : ""}>{outcome(pull)}</span>
225 <span className="text-faint">·</span>
226 <span className="flex items-center gap-1 font-mono">
227 <Bot size={12} />
228 {pull.agent}
229 </span>
230 {opener.requestedBy ? (
231 <span className="text-faint">· requested by {opener.requestedBy}</span>
232 ) : (
233 <>
234 {pull.runtime === "hosted" && <span className="text-faint">on g1t</span>}
235 <span className="text-faint">· opened by {opener.name}</span>
236 </>
237 )}
238 </p>
239 {pull.body && (
240 <p className="mt-2 line-clamp-2 text-sm text-muted">{plainText(pull.body)}</p>
241 )}
242 </Link>
243 </li>
244 );
245}
246
247export default function IssuePage({ loaderData, actionData, params }: Route.ComponentProps) {
248 const { issue, pulls, comments, viewer, labels, agentsEnabled, members, canManage, can } = loaderData;
249
250 // Follow agents at work without a manual reload.
251 const running = pulls.some(
252 (pull) =>
253 pull.status === "draft" ||
254 pull.checkStatus === "queued" ||
255 pull.checkStatus === "running",
256 );
257 // The pull request g1t's agent has in progress for this issue, if any.
258 const assigned = [...pulls]
259 .reverse()
260 .find(
261 (pull) =>
262 pull.agent === "g1t" &&
263 pull.runtime === "hosted" &&
264 (pull.status === "draft" || pull.status === "open"),
265 );
266 useRefreshWhile(Boolean(running || assigned));
267
268 // A refusal to start g1t shows by its button; every other error below the discussion.
269 const runError = actionData && "action" in actionData && actionData.action === "run-hosted";
270 const base = `/${params.owner}/${params.repo}`;
271 const open = issue.state === "open";
272 const reference = `${params.owner}/${params.repo}#${issue.number}`;
273 const resolver = pulls.find((pull) => pull.number === issue.resolvedBy);
274 // The merged pull request first, then the ones still in play, then the rest.
275 const rank = { merged: 0, open: 1, draft: 2, closed: 3 } as const;
276 const ordered = [...pulls].sort(
277 (a, b) => rank[a.status] - rank[b.status] || a.number - b.number,
278 );
279
280 return (
281 <div className="grid gap-8 lg:grid-cols-[1fr_19rem]">
282 <div className="min-w-0">
283 <h2 className="text-2xl font-semibold tracking-tight text-balance">
284 {issue.title} <span className="font-normal text-faint">#{issue.number}</span>
285 </h2>
286 <div className="mt-3 flex flex-wrap items-center gap-x-3 gap-y-2 text-sm text-muted">
287 <IssueState issue={issue} />
288 <span className="flex items-center gap-2">
289 <Avatar name={issue.author.username} size={18} />
290 <span>
291 <PersonLink name={issue.author.username} className="font-medium text-fg hover:underline" /> opened this{" "}
292 {issue.requestedBy && (
293 <>
294 for{" "}
295 <PersonLink name={issue.requestedBy.username} className="font-medium text-fg-soft hover:underline" />{" "}
296 </>
297 )}
298 <TimeAgo at={issue.createdAt} />
299 </span>
300 </span>
301 {issue.labels.map((name) => (
302 <Label key={name} name={name} />
303 ))}
304 {open && issue.agent && <Assignee agent={issue.agent} />}
305 </div>
306
307 {issue.resolvedBy != null && (
308 <Link
309 to={`${base}/pull/${issue.resolvedBy}`}
310 className="mt-5 flex items-center gap-3 rounded-xl border border-merged/40 bg-merged/5 px-4 py-3 text-sm transition-colors hover:border-merged/70"
311 >
312 <GitMerge size={18} className="shrink-0 text-merged" />
313 <span>
314 Resolved by{" "}
315 <span className="font-medium">
316 {resolver?.title ?? "pull request"} #{issue.resolvedBy}
317 </span>
318 {resolver?.mergedBy && (
319 <span className="text-muted">
320 , merged by {resolver.mergedBy}{" "}
321 {resolver.mergedAt && <TimeAgo at={resolver.mergedAt} />}
322 </span>
323 )}
324 </span>
325 </Link>
326 )}
327
328 {issue.body && (
329 <div className="mt-5 rounded-xl border border-line bg-surface p-5">
330 <Markdown source={issue.body} repo={{ namespace: params.owner, name: params.repo }} />
331 </div>
332 )}
333
334 <div className="mt-10 flex items-baseline justify-between">
335 <h3 className="font-semibold tracking-tight">Pull requests</h3>
336 <p className="text-sm text-muted">
337 {pulls.length === 0
338 ? "None yet"
339 : `${pulls.length} for this issue${
340 pulls.some((pull) => pull.status === "merged") ? "" : ", none merged"
341 }`}
342 </p>
343 </div>
344 <div className="mt-3">
345 {pulls.length === 0 ? (
346 <EmptyState title="Nobody has worked on this yet">
347 Put g1t on it, or point your own agent at{" "}
348 <code className="font-mono">{reference}</code>.
349 </EmptyState>
350 ) : (
351 <ol className="space-y-3">
352 {ordered.map((pull) => (
353 <PullRow key={pull.id} pull={pull} base={base} />
354 ))}
355 </ol>
356 )}
357 </div>
358
359 <h3 className="mt-10 font-semibold tracking-tight">Discussion</h3>
360 <div className="mt-3">
361 <div className="space-y-4">
362 <CommentList comments={comments} base={base} />
363 <CommentForm author={viewer?.username ?? null} resetKey={comments.length} />
364 {canManage && (
365 <Form method="post" className="flex flex-wrap justify-end gap-2">
366 {open ? (
367 <>
368 <SubmitButton variant="quiet" name="action" value="close-not-planned" pending="Closing…">
369 Close as not planned
370 </SubmitButton>
371 <SubmitButton variant="quiet" name="action" value="close-completed" pending="Closing…">
372 Close issue
373 </SubmitButton>
374 </>
375 ) : (
376 <SubmitButton variant="quiet" name="action" value="reopen" pending="Reopening…">
377 Reopen issue
378 </SubmitButton>
379 )}
380 </Form>
381 )}
382 </div>
383 </div>
384 <div className="mt-2">
385 {!runError && <ErrorText>{actionData?.error}</ErrorText>}
386 </div>
387 </div>
388
389 <aside className="space-y-6">
390 {loaderData.links.length > 0 && (
391 <section>
392 <h3 className="text-sm font-medium">From outside g1t</h3>
393 <ul className="mt-2 space-y-1.5 text-sm">
394 {loaderData.links.map((link) => (
395 <li key={`${link.connectionId}-${link.key}`}>
396 <a
397 href={link.url}
398 target="_blank"
399 rel="noreferrer"
400 className="group flex items-center gap-2 rounded-lg border border-line px-2.5 py-2 transition-colors hover:border-line-strong"
401 >
402 <span className="min-w-0 grow">
403 <span className="block truncate font-medium">
404 {PROVIDERS[link.provider].label} <span className="font-mono text-muted">{link.key}</span>
405 </span>
406 <span className="block text-xs text-faint">
407 {link.count > 1 ? `Seen ${link.count} times, last ` : "Linked "}
408 <TimeAgo at={link.count > 1 ? link.lastSeen : link.firstSeen} />
409 </span>
410 </span>
411 <ExternalLink size={13} className="shrink-0 text-faint group-hover:text-fg" />
412 </a>
413 </li>
414 ))}
415 </ul>
416 </section>
417 )}
418 <section>
419 <h3 className="text-sm font-medium">Assignees</h3>
420 <ul className="mt-2 space-y-1.5 text-sm">
421 {open && assigned && (
422 <li>
423 <Link
424 to={`${base}/pull/${assigned.number}`}
425 className="flex items-center gap-2 rounded-lg border border-accent/30 bg-accent/5 px-2.5 py-2 transition-colors hover:border-accent/60"
426 >
427 <Sparkles size={15} className="shrink-0 text-accent" />
428 <span className="min-w-0 grow">
429 <span className="block font-mono text-xs font-medium">g1t</span>
430 <span className="block truncate text-xs text-muted">
431 {assigned.status === "draft"
432 ? "Making the change"
433 : "Seeing it through checks and review"}{" "}
434 · #{assigned.number}
435 </span>
436 <AgentStepLine owner={params.owner} repo={params.repo} number={assigned.number} runs={loaderData.activeRuns} />
437 </span>
438 <span className="size-1.5 shrink-0 animate-pulse rounded-full bg-accent" />
439 </Link>
440 </li>
441 )}
442 {issue.assignees.map((name) => (
443 <li key={name} className="flex items-center gap-2 px-1">
444 <Avatar name={name} size={20} />
445 <span className="grow truncate font-mono text-xs">{name}</span>
446 </li>
447 ))}
448 {open && issue.queued && !assigned && (
449 <li className="flex items-center gap-2 rounded-lg border border-line bg-surface px-2.5 py-2">
450 <Sparkles size={15} className="shrink-0 text-faint" />
451 <span className="min-w-0 grow">
452 <span className="block font-mono text-xs font-medium">g1t</span>
453 <span className="block text-xs text-muted">
454 {issue.blockedBy.length > 0
455 ? "Queued. Starts when what this depends on has merged."
456 : "Queued. Starts as soon as there is room."}
457 </span>
458 </span>
459 </li>
460 )}
461 {!open && resolver && resolver.agent === "g1t" && (
462 <li>
463 <Link
464 to={`${base}/pull/${resolver.number}`}
465 className="flex items-center gap-2 rounded-lg border border-line bg-surface px-2.5 py-2 transition-colors hover:border-line-strong"
466 >
467 <Sparkles size={15} className="shrink-0 text-merged" />
468 <span className="min-w-0 grow">
469 <span className="block font-mono text-xs font-medium">g1t</span>
470 <span className="block truncate text-xs text-muted">
471 Resolved it with #{resolver.number}
472 </span>
473 </span>
474 </Link>
475 </li>
476 )}
477 {issue.assignees.length === 0 &&
478 !(open && (assigned || issue.queued)) &&
479 !(!open && resolver?.agent === "g1t") && (
480 <li className="px-1 text-xs text-faint">No one yet.</li>
481 )}
482 </ul>
483 {issue.blockedBy.length > 0 && (
484 <p className="mt-3 text-xs text-muted">
485 Depends on{" "}
486 {issue.blockedBy.map((number, index) => (
487 <span key={number}>
488 {index > 0 && ", "}
489 <Link
490 to={`${base}/issues/${number}`}
491 className="font-medium text-fg hover:underline"
492 >
493 #{number}
494 </Link>
495 </span>
496 ))}
497 {open ? ", which has to merge first." : "."}
498 </p>
499 )}
500
501 {open && agentsEnabled && can.run && !assigned && !issue.queued && (
502 <Form method="post" className="mt-3 space-y-2">
503 <input type="hidden" name="action" value="run-hosted" />
504 <div className="*:w-full">
505 <SubmitButton variant="accent" match={{ action: "run-hosted" }} pending="Starting a sandbox…">
506 <Sparkles size={14} />
507 Assign to g1t
508 </SubmitButton>
509 </div>
510 <details>
511 <summary className="cursor-pointer text-xs text-faint hover:text-fg">
512 Add guidance for this run
513 </summary>
514 <div className="mt-2">
515 <Textarea
516 name="instructions"
517 rows={2}
518 placeholder="On top of the issue's description"
519 />
520 </div>
521 </details>
522 <p className="text-xs text-muted">
523 It opens a pull request and sees it through checks, a review by another
524 agent and fixes. You get it back ready to merge.
525 </p>
526 <ComputeNote note={loaderData.computeNote} />
527 {runError && <ErrorText>{actionData.error}</ErrorText>}
528 </Form>
529 )}
530
531 {open && !agentsEnabled && can.run && !assigned && !issue.queued && (
532 // Where g1t's agent would be, and what makes it appear.
533 <div className="mt-3 rounded-lg border border-dashed border-line p-3 text-sm">
534 <p className="flex items-center gap-1.5 font-medium">
535 <Sparkles size={14} className="text-accent" />
536 g1t
537 </p>
538 <p className="mt-1 text-xs text-muted">
539 Connect a model provider and g1t can take this issue: it opens a pull request and sees it
540 through checks, review and fixes. Agents run on a paid workspace, or on the free trial.
541 </p>
542 <Link
543 to={`/${params.owner}/-/integrations`}
544 className="mt-2 inline-block text-xs text-accent hover:underline"
545 >
546 Connect a model
547 </Link>
548 </div>
549 )}
550
551 {viewer && can.triage && open && (
552 <div className="mt-3 space-y-2">
553 {!issue.assignees.includes(viewer.username) && (
554 <Form method="post">
555 <input type="hidden" name="action" value="assign" />
556 {issue.assignees.map((name) => (
557 <input key={name} type="hidden" name="assignee" value={name} />
558 ))}
559 <input type="hidden" name="assignee" value={viewer.username} />
560 <div className="*:w-full">
561 <SubmitButton variant="quiet" name="who" value="self" pending="Assigning…">
562 Assign yourself
563 </SubmitButton>
564 </div>
565 </Form>
566 )}
567 <details className="group">
568 <summary className="cursor-pointer text-xs text-faint hover:text-fg">
569 Assign people
570 </summary>
571 <Form method="post" className="mt-2 space-y-2" key={issue.assignees.join()}>
572 <input type="hidden" name="action" value="assign" />
573 <PeoplePicker name="assignee" members={members} chosen={issue.assignees} />
574 <SubmitButton variant="quiet" name="who" value="picked" pending="Saving…">
575 Save assignees
576 </SubmitButton>
577 </Form>
578 </details>
579 </div>
580 )}
581 </section>
582
583 {/* Another way to start the work: not once a pull request is doing it. */}
584 {open && !pulls.some((pull) => pull.status === "open" || pull.status === "draft") && (
585 <section className="rounded-xl border border-line bg-surface p-4">
586 <h3 className="text-sm font-medium">Bring your own agent</h3>
587 <p className="mt-1 text-xs text-muted">
588 With g1t connected to your agent, ask it to work on this issue.
589 </p>
590 <div className="mt-3">
591 <CopyLine text={reference} />
592 </div>
593 {viewer ? (
594 <Form method="post" className="mt-4 space-y-2 border-t border-line pt-4">
595 <input type="hidden" name="action" value="open-pull" />
596 <p className="text-xs text-muted">
597 Or open a draft pull request yourself and get a fork to push to.
598 </p>
599 <Input name="agent" placeholder="Who is working, e.g. claude-code" maxLength={60} />
600 <div className="*:w-full">
601 <SubmitButton match={{ action: "open-pull" }} pending="Opening…">
602 Open pull request
603 </SubmitButton>
604 </div>
605 <p className="text-xs text-muted">
606 Already pushed a branch?{" "}
607 <Link
608 to={`${base}/pulls/new?issue=${issue.number}`}
609 className="text-fg underline underline-offset-4"
610 >
611 Open a pull request from it
612 </Link>
613 .
614 </p>
615 </Form>
616 ) : (
617 <p className="mt-4 border-t border-line pt-4 text-sm text-muted">
618 <Link to="/login" className="text-fg underline underline-offset-4">
619 Sign in
620 </Link>{" "}
621 to open a pull request.
622 </p>
623 )}
624 </section>
625 )}
626
627 {can.triage && (
628 <details className="group">
629 <summary className="cursor-pointer list-none text-sm font-medium">
630 Labels <span className="text-xs font-normal text-faint group-open:hidden">Edit</span>
631 </summary>
632 <Form method="post" className="mt-3 space-y-3" key={issue.labels.join()}>
633 <input type="hidden" name="action" value="labels" />
634 <div className="flex flex-wrap gap-x-3 gap-y-2">
635 {labels.map((name) => (
636 <CheckboxOption
637 key={name}
638 name="label"
639 value={name}
640 defaultChecked={issue.labels.includes(name)}
641 label={<Label name={name} />}
642 className="items-center gap-1.5"
643 />
644 ))}
645 </div>
646 <Input name="labels" placeholder="New labels, comma separated" />
647 <SubmitButton variant="quiet" match={{ action: "labels" }} pending="Saving…">
648 Save labels
649 </SubmitButton>
650 </Form>
651 </details>
652 )}
653
654 {viewer && (
655 <SubscriptionBox action={`${base}/notifications`} number={issue.number} kind="issue" subscription={loaderData.subscription} />
656 )}
657 </aside>
658 </div>
659 );
660}