NewIssue.tsx
| 1 | import type { RepositoryRow } from "../../db/index.ts"; |
| 2 | import type { SessionUser } from "../../middleware/session.ts"; |
| 3 | import { Layout } from "../layout.tsx"; |
| 4 | import { RepoHeader } from "../repos/RepoHeader.tsx"; |
| 5 | import { RepoNav } from "../repos/RepoNav.tsx"; |
| 6 | |
| 7 | interface NewIssueProps { |
| 8 | user: SessionUser; |
| 9 | repo: RepositoryRow; |
| 10 | error?: string; |
| 11 | template?: string; |
| 12 | } |
| 13 | |
| 14 | export function NewIssue({ user, repo, error, template }: NewIssueProps) { |
| 15 | return ( |
| 16 | <Layout user={user} title={`New issue — ${repo.name}`}> |
| 17 | <div class="container"> |
| 18 | <RepoHeader repo={repo} /> |
| 19 | <RepoNav repo={repo} active="issues" user={user} /> |
| 20 | <h2 class="section-title">New issue</h2> |
| 21 | {error && <p class="form-error">{error}</p>} |
| 22 | <form |
| 23 | method="POST" |
| 24 | action={`/${repo.name}/issues`} |
| 25 | class="form-card" |
| 26 | > |
| 27 | <div class="form-group"> |
| 28 | <label for="title">Title</label> |
| 29 | <input |
| 30 | id="title" |
| 31 | name="title" |
| 32 | type="text" |
| 33 | required |
| 34 | placeholder="Short, descriptive title" |
| 35 | /> |
| 36 | </div> |
| 37 | <div class="form-group"> |
| 38 | <label for="body"> |
| 39 | Description{" "} |
| 40 | <span class="text-muted"> |
| 41 | (Markdown supported, optional) |
| 42 | </span> |
| 43 | </label> |
| 44 | <textarea |
| 45 | id="body" |
| 46 | name="body" |
| 47 | rows="10" |
| 48 | placeholder="Describe the issue..." |
| 49 | > |
| 50 | {template ?? ""} |
| 51 | </textarea> |
| 52 | </div> |
| 53 | <div class="form-actions"> |
| 54 | <button type="submit" class="btn btn-primary"> |
| 55 | Submit issue |
| 56 | </button> |
| 57 | <a href={`/${repo.name}/issues`} class="btn"> |
| 58 | Cancel |
| 59 | </a> |
| 60 | </div> |
| 61 | </form> |
| 62 | </div> |
| 63 | </Layout> |
| 64 | ); |
| 65 | } |
| 66 |