ref0-git 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/apps/github/.dev.vars.example +6 -0
- package/app/apps/github/README.md +70 -0
- package/app/apps/github/THIRD_PARTY_NOTICES.md +214 -0
- package/app/apps/github/components.json +25 -0
- package/app/apps/github/generated/git-rest.ts +10444 -0
- package/app/apps/github/generated/routeTree.gen.ts +1242 -0
- package/app/apps/github/migrations/postgres/0001_auth.sql +46 -0
- package/app/apps/github/migrations/sql/0001_auth.sql +19 -0
- package/app/apps/github/migrations/sql/0002_passkeys.sql +9 -0
- package/app/apps/github/migrations/sql/0003_orgs.sql +22 -0
- package/app/apps/github/migrations/sql/0004_avatars.sql +6 -0
- package/app/apps/github/package.json +80 -0
- package/app/apps/github/src/branches/branch-list.tsx +385 -0
- package/app/apps/github/src/branches/branches.ts +55 -0
- package/app/apps/github/src/clients/allowed.ts +213 -0
- package/app/apps/github/src/clients/at-most.ts +17 -0
- package/app/apps/github/src/clients/avatars.ts +410 -0
- package/app/apps/github/src/clients/cached.ts +65 -0
- package/app/apps/github/src/clients/calls.ts +160 -0
- package/app/apps/github/src/clients/clients.ts +82 -0
- package/app/apps/github/src/clients/graphql.ts +50 -0
- package/app/apps/github/src/clients/host-answer.ts +28 -0
- package/app/apps/github/src/clients/host-calls.ts +382 -0
- package/app/apps/github/src/clients/icon-bytes.ts +203 -0
- package/app/apps/github/src/clients/proxy.ts +59 -0
- package/app/apps/github/src/clients/session-ended.ts +18 -0
- package/app/apps/github/src/clients/transfers.ts +212 -0
- package/app/apps/github/src/code/breadcrumbs.tsx +50 -0
- package/app/apps/github/src/code/code-page.tsx +147 -0
- package/app/apps/github/src/code/code-tree.tsx +338 -0
- package/app/apps/github/src/code/controls.tsx +230 -0
- package/app/apps/github/src/code/file-view.tsx +450 -0
- package/app/apps/github/src/code/files.ts +332 -0
- package/app/apps/github/src/code/folder-list.tsx +122 -0
- package/app/apps/github/src/code/go-to-file.tsx +131 -0
- package/app/apps/github/src/code/highlighted.tsx +58 -0
- package/app/apps/github/src/code/lines.ts +46 -0
- package/app/apps/github/src/code/load.ts +147 -0
- package/app/apps/github/src/code/markdown-files.ts +58 -0
- package/app/apps/github/src/code/places.ts +88 -0
- package/app/apps/github/src/code/ref-pages.ts +179 -0
- package/app/apps/github/src/code/ref-switcher.tsx +203 -0
- package/app/apps/github/src/code/refs.ts +142 -0
- package/app/apps/github/src/code/repo-home.tsx +240 -0
- package/app/apps/github/src/code/repo.ts +105 -0
- package/app/apps/github/src/code/saved-reads.ts +199 -0
- package/app/apps/github/src/code/saved.ts +110 -0
- package/app/apps/github/src/code/tree-fold.ts +186 -0
- package/app/apps/github/src/code/trees.ts +136 -0
- package/app/apps/github/src/components/avatar-picture.ts +53 -0
- package/app/apps/github/src/components/avatar-url.ts +16 -0
- package/app/apps/github/src/components/confirm-action.tsx +100 -0
- package/app/apps/github/src/components/count.tsx +24 -0
- package/app/apps/github/src/components/create-button.tsx +38 -0
- package/app/apps/github/src/components/file-icons/file-icons.css +225 -0
- package/app/apps/github/src/components/file-icons/file-icons.tsx +138 -0
- package/app/apps/github/src/components/filter.tsx +35 -0
- package/app/apps/github/src/components/hotkeys/hotkeys.tsx +255 -0
- package/app/apps/github/src/components/item-list.tsx +65 -0
- package/app/apps/github/src/components/language-dot.tsx +29 -0
- package/app/apps/github/src/components/list-toolbar.tsx +82 -0
- package/app/apps/github/src/components/markdown/editor.tsx +57 -0
- package/app/apps/github/src/components/markdown/markdown.css +177 -0
- package/app/apps/github/src/components/markdown/markdown.tsx +82 -0
- package/app/apps/github/src/components/owner-card.tsx +196 -0
- package/app/apps/github/src/components/pull-status.tsx +34 -0
- package/app/apps/github/src/components/recent.ts +41 -0
- package/app/apps/github/src/components/relative-time.tsx +78 -0
- package/app/apps/github/src/components/repos/icon-hashes.ts +91 -0
- package/app/apps/github/src/components/repos/new-repo-form.tsx +196 -0
- package/app/apps/github/src/components/repos/repo-icon.tsx +47 -0
- package/app/apps/github/src/components/repos/repo-list.tsx +528 -0
- package/app/apps/github/src/components/repos/your-repos.tsx +124 -0
- package/app/apps/github/src/components/review-state.tsx +75 -0
- package/app/apps/github/src/components/route-dialog.tsx +137 -0
- package/app/apps/github/src/components/save-button.tsx +58 -0
- package/app/apps/github/src/components/shell/app-shell.tsx +164 -0
- package/app/apps/github/src/components/shell/create-org-dialog.tsx +118 -0
- package/app/apps/github/src/components/shell/create-row.tsx +49 -0
- package/app/apps/github/src/components/shell/link-menu.tsx +94 -0
- package/app/apps/github/src/components/shell/nav-user.tsx +97 -0
- package/app/apps/github/src/components/shell/owner-repos.tsx +247 -0
- package/app/apps/github/src/components/shell/owner-switcher.tsx +104 -0
- package/app/apps/github/src/components/shell/repo-switcher.tsx +179 -0
- package/app/apps/github/src/components/shell/sections.ts +31 -0
- package/app/apps/github/src/components/shell/submenu-chevron.ts +147 -0
- package/app/apps/github/src/components/signin/device-card.tsx +139 -0
- package/app/apps/github/src/components/signin/login-form.tsx +88 -0
- package/app/apps/github/src/components/signin/signin-page.tsx +33 -0
- package/app/apps/github/src/components/signin/signup-form.tsx +106 -0
- package/app/apps/github/src/components/states/live-status.tsx +42 -0
- package/app/apps/github/src/components/states/states.tsx +126 -0
- package/app/apps/github/src/components/tab-indicator.tsx +143 -0
- package/app/apps/github/src/components/theme-choice.tsx +108 -0
- package/app/apps/github/src/components/theme-provider.tsx +126 -0
- package/app/apps/github/src/components/tones.ts +23 -0
- package/app/apps/github/src/components/ui/alert-dialog.tsx +187 -0
- package/app/apps/github/src/components/ui/alert.tsx +78 -0
- package/app/apps/github/src/components/ui/avatar.tsx +106 -0
- package/app/apps/github/src/components/ui/badge.tsx +51 -0
- package/app/apps/github/src/components/ui/breadcrumb.tsx +124 -0
- package/app/apps/github/src/components/ui/button-group.tsx +87 -0
- package/app/apps/github/src/components/ui/button.tsx +61 -0
- package/app/apps/github/src/components/ui/calendar.tsx +221 -0
- package/app/apps/github/src/components/ui/card.tsx +102 -0
- package/app/apps/github/src/components/ui/checkbox.tsx +26 -0
- package/app/apps/github/src/components/ui/collapsible.tsx +19 -0
- package/app/apps/github/src/components/ui/combobox.tsx +304 -0
- package/app/apps/github/src/components/ui/command.tsx +208 -0
- package/app/apps/github/src/components/ui/dialog.tsx +156 -0
- package/app/apps/github/src/components/ui/dropdown-menu.tsx +290 -0
- package/app/apps/github/src/components/ui/empty.tsx +100 -0
- package/app/apps/github/src/components/ui/field.tsx +236 -0
- package/app/apps/github/src/components/ui/hover-card.tsx +48 -0
- package/app/apps/github/src/components/ui/input-group.tsx +163 -0
- package/app/apps/github/src/components/ui/input.tsx +19 -0
- package/app/apps/github/src/components/ui/item.tsx +201 -0
- package/app/apps/github/src/components/ui/kbd.tsx +27 -0
- package/app/apps/github/src/components/ui/label.tsx +33 -0
- package/app/apps/github/src/components/ui/popover.tsx +87 -0
- package/app/apps/github/src/components/ui/radio-group.tsx +35 -0
- package/app/apps/github/src/components/ui/select.tsx +198 -0
- package/app/apps/github/src/components/ui/separator.tsx +22 -0
- package/app/apps/github/src/components/ui/sheet.tsx +138 -0
- package/app/apps/github/src/components/ui/sidebar.tsx +724 -0
- package/app/apps/github/src/components/ui/skeleton.tsx +13 -0
- package/app/apps/github/src/components/ui/sonner.tsx +47 -0
- package/app/apps/github/src/components/ui/styles.css +242 -0
- package/app/apps/github/src/components/ui/table.tsx +113 -0
- package/app/apps/github/src/components/ui/tabs.tsx +79 -0
- package/app/apps/github/src/components/ui/textarea.tsx +17 -0
- package/app/apps/github/src/components/ui/title.ts +6 -0
- package/app/apps/github/src/components/ui/toggle-group.tsx +89 -0
- package/app/apps/github/src/components/ui/toggle.tsx +42 -0
- package/app/apps/github/src/components/ui/tooltip.tsx +63 -0
- package/app/apps/github/src/components/user-avatar.tsx +145 -0
- package/app/apps/github/src/components/view-tabs.tsx +42 -0
- package/app/apps/github/src/context/context.ts +133 -0
- package/app/apps/github/src/diffs/blobs.ts +94 -0
- package/app/apps/github/src/diffs/diff-view.tsx +155 -0
- package/app/apps/github/src/diffs/files.ts +121 -0
- package/app/apps/github/src/diffs/hunks.tsx +454 -0
- package/app/apps/github/src/diffs/patch.ts +131 -0
- package/app/apps/github/src/diffs/rows.ts +137 -0
- package/app/apps/github/src/history/commit-diff.ts +54 -0
- package/app/apps/github/src/history/commit-list.tsx +207 -0
- package/app/apps/github/src/history/commit-page.tsx +147 -0
- package/app/apps/github/src/history/history.ts +129 -0
- package/app/apps/github/src/hooks/allowed.ts +31 -0
- package/app/apps/github/src/hooks/answers.ts +65 -0
- package/app/apps/github/src/hooks/avatars.ts +54 -0
- package/app/apps/github/src/hooks/draft.ts +38 -0
- package/app/apps/github/src/hooks/open-counts.ts +127 -0
- package/app/apps/github/src/hooks/profiles.ts +120 -0
- package/app/apps/github/src/hooks/repos.ts +440 -0
- package/app/apps/github/src/hooks/use-mobile.ts +19 -0
- package/app/apps/github/src/hooks/viewer.ts +39 -0
- package/app/apps/github/src/inbox/count.ts +70 -0
- package/app/apps/github/src/inbox/inbox-item.tsx +66 -0
- package/app/apps/github/src/inbox/inbox-page.tsx +572 -0
- package/app/apps/github/src/inbox/marks.ts +130 -0
- package/app/apps/github/src/inbox/release-tags.ts +65 -0
- package/app/apps/github/src/inbox/search.ts +97 -0
- package/app/apps/github/src/inbox/subjects.ts +184 -0
- package/app/apps/github/src/inbox/subscription-controls.tsx +184 -0
- package/app/apps/github/src/inbox/subscriptions.ts +189 -0
- package/app/apps/github/src/inbox/threads.ts +198 -0
- package/app/apps/github/src/issues/changes.ts +332 -0
- package/app/apps/github/src/issues/counts.ts +62 -0
- package/app/apps/github/src/issues/issue-list.tsx +682 -0
- package/app/apps/github/src/issues/issue-page.tsx +533 -0
- package/app/apps/github/src/issues/issues.ts +566 -0
- package/app/apps/github/src/issues/label-dialog.tsx +310 -0
- package/app/apps/github/src/issues/labels-page.tsx +119 -0
- package/app/apps/github/src/issues/new-issue.tsx +79 -0
- package/app/apps/github/src/issues/parts.tsx +71 -0
- package/app/apps/github/src/issues/picker.tsx +298 -0
- package/app/apps/github/src/issues/search.ts +238 -0
- package/app/apps/github/src/issues/sidebar.tsx +236 -0
- package/app/apps/github/src/lib/cn.ts +8 -0
- package/app/apps/github/src/lib/highlighting.ts +13 -0
- package/app/apps/github/src/live/follow.ts +129 -0
- package/app/apps/github/src/live/sse.ts +74 -0
- package/app/apps/github/src/live/use-follow.ts +37 -0
- package/app/apps/github/src/markdown/README.md +53 -0
- package/app/apps/github/src/markdown/allowed-html.ts +69 -0
- package/app/apps/github/src/markdown/context.ts +206 -0
- package/app/apps/github/src/markdown/images.ts +81 -0
- package/app/apps/github/src/markdown/lookup.ts +122 -0
- package/app/apps/github/src/markdown/patches.ts +299 -0
- package/app/apps/github/src/markdown/query.ts +25 -0
- package/app/apps/github/src/markdown/references.ts +158 -0
- package/app/apps/github/src/markdown/render.ts +103 -0
- package/app/apps/github/src/names/owners.ts +51 -0
- package/app/apps/github/src/names/repos.ts +24 -0
- package/app/apps/github/src/palette/palette.tsx +547 -0
- package/app/apps/github/src/palette/recent.ts +116 -0
- package/app/apps/github/src/palette/rows.tsx +455 -0
- package/app/apps/github/src/palette/server.ts +104 -0
- package/app/apps/github/src/palette/targets.ts +306 -0
- package/app/apps/github/src/policy.ts +600 -0
- package/app/apps/github/src/private-repos.ts +47 -0
- package/app/apps/github/src/pulls/compare-page.tsx +342 -0
- package/app/apps/github/src/pulls/files-tab.tsx +776 -0
- package/app/apps/github/src/pulls/live.ts +124 -0
- package/app/apps/github/src/pulls/merge-box.tsx +367 -0
- package/app/apps/github/src/pulls/merge-button.ts +86 -0
- package/app/apps/github/src/pulls/pull-list.tsx +235 -0
- package/app/apps/github/src/pulls/pull-page.tsx +474 -0
- package/app/apps/github/src/pulls/pull.ts +468 -0
- package/app/apps/github/src/pulls/pulls.ts +318 -0
- package/app/apps/github/src/pulls/review.ts +350 -0
- package/app/apps/github/src/pulls/search.ts +130 -0
- package/app/apps/github/src/queue/queue-page.tsx +405 -0
- package/app/apps/github/src/queue/queue.ts +231 -0
- package/app/apps/github/src/releases/latest-release.tsx +55 -0
- package/app/apps/github/src/releases/overview.tsx +30 -0
- package/app/apps/github/src/releases/release-form.tsx +353 -0
- package/app/apps/github/src/releases/release-list.tsx +173 -0
- package/app/apps/github/src/releases/release-view.tsx +183 -0
- package/app/apps/github/src/releases/releases.ts +308 -0
- package/app/apps/github/src/releases/tag-list.tsx +134 -0
- package/app/apps/github/src/router.tsx +46 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +33 -0
- package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/_code.tsx +11 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/_releases.tsx +23 -0
- package/app/apps/github/src/routes/$owner/$repo/branches.tsx +39 -0
- package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +34 -0
- package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +42 -0
- package/app/apps/github/src/routes/$owner/$repo/compare/$.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/index.tsx +24 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +50 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +53 -0
- package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +43 -0
- package/app/apps/github/src/routes/$owner/$repo/labels.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/checks.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/commits.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/files.tsx +15 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/index.tsx +19 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +52 -0
- package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +48 -0
- package/app/apps/github/src/routes/$owner/$repo/queue.tsx +22 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +58 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +40 -0
- package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +35 -0
- package/app/apps/github/src/routes/$owner/$repo/route.tsx +102 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/access.tsx +9 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +16 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/new.tsx +25 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +17 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/route.tsx +28 -0
- package/app/apps/github/src/routes/$owner/$repo/settings/rules.tsx +12 -0
- package/app/apps/github/src/routes/$owner/$repo/tokens.tsx +16 -0
- package/app/apps/github/src/routes/$owner/index.tsx +45 -0
- package/app/apps/github/src/routes/-nav.tsx +293 -0
- package/app/apps/github/src/routes/-root-testing.ts +107 -0
- package/app/apps/github/src/routes/__root.tsx +225 -0
- package/app/apps/github/src/routes/api.auth.$.ts +18 -0
- package/app/apps/github/src/routes/downloads/$owner/$repo/$asset.tsx +10 -0
- package/app/apps/github/src/routes/file-icons[.]svg.ts +21 -0
- package/app/apps/github/src/routes/icons/$owner/$repo.tsx +14 -0
- package/app/apps/github/src/routes/icons/$owner/index.tsx +14 -0
- package/app/apps/github/src/routes/icons/index.tsx +12 -0
- package/app/apps/github/src/routes/index.tsx +48 -0
- package/app/apps/github/src/routes/login.tsx +24 -0
- package/app/apps/github/src/routes/login_.code.tsx +31 -0
- package/app/apps/github/src/routes/new.tsx +91 -0
- package/app/apps/github/src/routes/notifications.tsx +20 -0
- package/app/apps/github/src/routes/orgs/$owner/issues.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/pulls.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/releases.tsx +8 -0
- package/app/apps/github/src/routes/orgs/$owner/route.tsx +25 -0
- package/app/apps/github/src/routes/orgs/$owner/settings.tsx +30 -0
- package/app/apps/github/src/routes/orgs/$owner/tokens.tsx +15 -0
- package/app/apps/github/src/routes/settings.tsx +54 -0
- package/app/apps/github/src/routes/signup.tsx +24 -0
- package/app/apps/github/src/routes/uploads/$owner/$repo/$release.tsx +10 -0
- package/app/apps/github/src/seed/acme.ts +498 -0
- package/app/apps/github/src/seed/licenses.ts +114 -0
- package/app/apps/github/src/seed/seed.ts +538 -0
- package/app/apps/github/src/server.ts +97 -0
- package/app/apps/github/src/settings/account-avatar.tsx +43 -0
- package/app/apps/github/src/settings/avatar-section.tsx +140 -0
- package/app/apps/github/src/settings/avatar.ts +58 -0
- package/app/apps/github/src/settings/general-settings.tsx +439 -0
- package/app/apps/github/src/settings/general.ts +73 -0
- package/app/apps/github/src/settings/hook-form.tsx +195 -0
- package/app/apps/github/src/settings/hook-list.tsx +166 -0
- package/app/apps/github/src/settings/hooks.ts +87 -0
- package/app/apps/github/src/settings/org-settings.tsx +228 -0
- package/app/apps/github/src/settings/orgs.ts +116 -0
- package/app/apps/github/src/settings/rule-list.tsx +72 -0
- package/app/apps/github/src/settings/rules.ts +27 -0
- package/app/apps/github/src/settings/settings-layout.tsx +114 -0
- package/app/apps/github/src/signin/approval.ts +186 -0
- package/app/apps/github/src/signin/auth-client.ts +127 -0
- package/app/apps/github/src/signin/auth.ts +753 -0
- package/app/apps/github/src/signin/avatars.ts +126 -0
- package/app/apps/github/src/signin/client-ip.ts +39 -0
- package/app/apps/github/src/signin/credentials.ts +26 -0
- package/app/apps/github/src/signin/device-code.ts +95 -0
- package/app/apps/github/src/signin/device-prompt.ts +125 -0
- package/app/apps/github/src/signin/errors.ts +135 -0
- package/app/apps/github/src/signin/host-session.ts +68 -0
- package/app/apps/github/src/signin/orgs.ts +283 -0
- package/app/apps/github/src/signin/owner-names.ts +183 -0
- package/app/apps/github/src/signin/person-lock.ts +104 -0
- package/app/apps/github/src/signin/seal.ts +88 -0
- package/app/apps/github/src/signin/seed-people.ts +92 -0
- package/app/apps/github/src/signin/session.ts +48 -0
- package/app/apps/github/src/signin/unborn.ts +110 -0
- package/app/apps/github/src/signin/viewer-orgs.ts +47 -0
- package/app/apps/github/src/signin/viewer.ts +74 -0
- package/app/apps/github/src/signin/with-headers.ts +14 -0
- package/app/apps/github/src/tokens/tokens-page.tsx +529 -0
- package/app/apps/github/src/tokens/tokens.ts +54 -0
- package/app/apps/github/tsconfig.json +25 -0
- package/app/apps/github/tsconfig.worker.json +24 -0
- package/app/apps/github/vite.config.ts +21 -0
- package/app/pnpm-workspace.yaml +216 -0
- package/app/tsconfig.base.json +127 -0
- package/dist/LICENSE +202 -0
- package/dist/cli/child.mjs +42 -0
- package/dist/cli/commands.mjs +23 -0
- package/dist/cli/credentials.mjs +84 -0
- package/dist/cli/documents.mjs +214 -0
- package/dist/cli/events.mjs +55 -0
- package/dist/cli/failure.mjs +105 -0
- package/dist/cli/folders.mjs +32 -0
- package/dist/cli/git-remote-ref0.d.mts +1 -0
- package/dist/cli/git-remote-ref0.mjs +29 -0
- package/dist/cli/git.mjs +48 -0
- package/dist/cli/helpers.mjs +51 -0
- package/dist/cli/hosts.mjs +127 -0
- package/dist/cli/node.mjs +15 -0
- package/dist/cli/output.mjs +135 -0
- package/dist/cli/prompt.mjs +35 -0
- package/dist/cli/queue.mjs +215 -0
- package/dist/cli/ref0-git.d.mts +1 -0
- package/dist/cli/ref0-git.mjs +144 -0
- package/dist/cli/repos.mjs +162 -0
- package/dist/cli/resources.mjs +131 -0
- package/dist/cli/run-end.mjs +57 -0
- package/dist/cli/runtime.mjs +50 -0
- package/dist/cli/setup.mjs +1410 -0
- package/dist/cli/sign-in.mjs +162 -0
- package/dist/cli/sign-ins.mjs +79 -0
- package/dist/cli/sqlite.mjs +28 -0
- package/dist/cli/tokens.mjs +141 -0
- package/dist/cli/vendor.mjs +123 -0
- package/dist/init/app.mjs +231 -0
- package/dist/init/astro.mjs +49 -0
- package/dist/init/choices.mjs +497 -0
- package/dist/init/cloudflare.mjs +324 -0
- package/dist/init/create.mjs +151 -0
- package/dist/init/detect.mjs +297 -0
- package/dist/init/files.mjs +75 -0
- package/dist/init/frameworks.mjs +248 -0
- package/dist/init/git-module.mjs +49 -0
- package/dist/init/github-routes.mjs +66 -0
- package/dist/init/jsonc.mjs +143 -0
- package/dist/init/metadata.mjs +48 -0
- package/dist/init/mounts.mjs +109 -0
- package/dist/init/next.mjs +205 -0
- package/dist/init/node-app.mjs +189 -0
- package/dist/init/node.mjs +458 -0
- package/dist/init/nuxt.mjs +115 -0
- package/dist/init/output.mjs +21 -0
- package/dist/init/plan.mjs +82 -0
- package/dist/init/range-major.mjs +257 -0
- package/dist/init/react-router.mjs +59 -0
- package/dist/init/routes.mjs +148 -0
- package/dist/init/shell.mjs +4 -0
- package/dist/init/stores.mjs +51 -0
- package/dist/init/sveltekit.mjs +139 -0
- package/dist/init/template.mjs +142 -0
- package/dist/init/templates.mjs +343 -0
- package/dist/init/vercel.mjs +383 -0
- package/dist/init/versions.mjs +32 -0
- package/dist/init/workspace.mjs +20 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { useInfiniteQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useRouteContext } from '@tanstack/react-router';
|
|
3
|
+
import {
|
|
4
|
+
CircleCheckIcon,
|
|
5
|
+
CircleDotIcon,
|
|
6
|
+
EllipsisIcon,
|
|
7
|
+
GitPullRequestClosedIcon,
|
|
8
|
+
GitPullRequestIcon,
|
|
9
|
+
PencilIcon,
|
|
10
|
+
} from 'lucide-react';
|
|
11
|
+
import { Fragment, useState, type ReactNode } from 'react';
|
|
12
|
+
|
|
13
|
+
import { day } from '../code/controls.tsx';
|
|
14
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
15
|
+
import { Markdown } from '../components/markdown/markdown.tsx';
|
|
16
|
+
import { RelativeTime } from '../components/relative-time.tsx';
|
|
17
|
+
import { ReviewState, type ReviewStanding } from '../components/review-state.tsx';
|
|
18
|
+
import { SaveButton } from '../components/save-button.tsx';
|
|
19
|
+
import { signInHref } from '../components/states/states.tsx';
|
|
20
|
+
import { Alert, AlertDescription } from '../components/ui/alert.tsx';
|
|
21
|
+
import { Badge } from '../components/ui/badge.tsx';
|
|
22
|
+
import { Button } from '../components/ui/button.tsx';
|
|
23
|
+
import { Card, CardAction, CardContent, CardHeader, CardTitle } from '../components/ui/card.tsx';
|
|
24
|
+
import {
|
|
25
|
+
DropdownMenu,
|
|
26
|
+
DropdownMenuContent,
|
|
27
|
+
DropdownMenuItem,
|
|
28
|
+
DropdownMenuTrigger,
|
|
29
|
+
} from '../components/ui/dropdown-menu.tsx';
|
|
30
|
+
import { Input } from '../components/ui/input.tsx';
|
|
31
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../components/ui/tooltip.tsx';
|
|
32
|
+
import { OwnerCard } from '../components/owner-card.tsx';
|
|
33
|
+
import { UserAvatar } from '../components/user-avatar.tsx';
|
|
34
|
+
import type { PageOperation } from '../clients/allowed.ts';
|
|
35
|
+
import { useAllowed } from '../hooks/allowed.ts';
|
|
36
|
+
import { useDraft } from '../hooks/draft.ts';
|
|
37
|
+
import { issueHref } from './issue-list.tsx';
|
|
38
|
+
import {
|
|
39
|
+
addComment,
|
|
40
|
+
changeIssue,
|
|
41
|
+
commentsOf,
|
|
42
|
+
editComment,
|
|
43
|
+
issueAt,
|
|
44
|
+
type Issue,
|
|
45
|
+
type IssueChange,
|
|
46
|
+
type Numbered,
|
|
47
|
+
} from './issues.ts';
|
|
48
|
+
import { HotkeyHint, hotkeys } from '../components/hotkeys/hotkeys.tsx';
|
|
49
|
+
import { MarkdownEditor } from '../components/markdown/editor.tsx';
|
|
50
|
+
import { issueHolding, stateChange, useChange, useShown, type Holding } from './changes.ts';
|
|
51
|
+
import { Sidebar } from './sidebar.tsx';
|
|
52
|
+
import { fills, tones } from '../components/tones.ts';
|
|
53
|
+
|
|
54
|
+
/** A failed write's message, beside the control that made it. */
|
|
55
|
+
export function Failed({ error }: { readonly error: Error | null }) {
|
|
56
|
+
if (error === null) return null;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Alert variant="destructive">
|
|
60
|
+
<AlertDescription>{error.message}</AlertDescription>
|
|
61
|
+
</Alert>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A comment, a review, or the issue's own text: who wrote it when, rendered, and its editor for
|
|
67
|
+
* those allowed.
|
|
68
|
+
*/
|
|
69
|
+
export function Comment({
|
|
70
|
+
repo,
|
|
71
|
+
author,
|
|
72
|
+
upload,
|
|
73
|
+
did = 'commented',
|
|
74
|
+
standing,
|
|
75
|
+
created,
|
|
76
|
+
body,
|
|
77
|
+
save,
|
|
78
|
+
}: {
|
|
79
|
+
readonly repo: string;
|
|
80
|
+
readonly author: string;
|
|
81
|
+
/** The author's uploaded picture, as the answer named it, for `UserAvatar`. */
|
|
82
|
+
readonly upload: string | null | undefined;
|
|
83
|
+
/** What the author did, as its header says it: `commented`, or a review's decision. */
|
|
84
|
+
readonly did?: string;
|
|
85
|
+
/** A review's standing, whose icon goes first, before the words that say it. */
|
|
86
|
+
readonly standing?: ReviewStanding | undefined;
|
|
87
|
+
readonly created: string;
|
|
88
|
+
readonly body: string;
|
|
89
|
+
/** Saves new text, for a viewer the drop-in lets edit it. */
|
|
90
|
+
readonly save: ((body: string) => Promise<void>) | undefined;
|
|
91
|
+
}) {
|
|
92
|
+
const [editing, setEditing] = useState(false);
|
|
93
|
+
const draft = useDraft({ body }, (fields) => ({ body: fields.body.trim() }));
|
|
94
|
+
const saved = useMutation({
|
|
95
|
+
mutationFn: async (text: string) => {
|
|
96
|
+
await save?.(text);
|
|
97
|
+
},
|
|
98
|
+
onSuccess: () => setEditing(false),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<article aria-label={`${author}'s comment`}>
|
|
103
|
+
<Card size="sm">
|
|
104
|
+
<CardHeader className="border-b">
|
|
105
|
+
<CardTitle className="flex items-center gap-2 font-normal">
|
|
106
|
+
{standing !== undefined && <ReviewState standing={standing} said />}
|
|
107
|
+
<OwnerCard login={author} beside className="rounded-full">
|
|
108
|
+
<UserAvatar login={author} upload={upload} size="sm" account="user" />
|
|
109
|
+
</OwnerCard>
|
|
110
|
+
<span>
|
|
111
|
+
<OwnerCard login={author} className="font-semibold">
|
|
112
|
+
{author}
|
|
113
|
+
</OwnerCard>{' '}
|
|
114
|
+
<span className="text-muted-foreground">
|
|
115
|
+
{did} <RelativeTime at={created} />
|
|
116
|
+
</span>
|
|
117
|
+
</span>
|
|
118
|
+
</CardTitle>
|
|
119
|
+
{save !== undefined && !editing && (
|
|
120
|
+
<CardAction>
|
|
121
|
+
<DropdownMenu>
|
|
122
|
+
<DropdownMenuTrigger
|
|
123
|
+
render={<Button variant="ghost" size="icon-sm" aria-label="Comment actions" />}
|
|
124
|
+
>
|
|
125
|
+
<EllipsisIcon />
|
|
126
|
+
</DropdownMenuTrigger>
|
|
127
|
+
<DropdownMenuContent align="end">
|
|
128
|
+
<DropdownMenuItem
|
|
129
|
+
onClick={() => {
|
|
130
|
+
draft.reset();
|
|
131
|
+
setEditing(true);
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
Edit
|
|
135
|
+
</DropdownMenuItem>
|
|
136
|
+
</DropdownMenuContent>
|
|
137
|
+
</DropdownMenu>
|
|
138
|
+
</CardAction>
|
|
139
|
+
)}
|
|
140
|
+
</CardHeader>
|
|
141
|
+
<CardContent>
|
|
142
|
+
{!editing ? (
|
|
143
|
+
body.trim() === '' ? (
|
|
144
|
+
<p className="text-sm text-muted-foreground">No description provided.</p>
|
|
145
|
+
) : (
|
|
146
|
+
<Markdown text={body} context={{ kind: 'comment', repo }} />
|
|
147
|
+
)
|
|
148
|
+
) : (
|
|
149
|
+
<form
|
|
150
|
+
aria-label="Edit comment"
|
|
151
|
+
className="flex flex-col gap-2"
|
|
152
|
+
data-hotkey-box
|
|
153
|
+
onSubmit={(event) => {
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
|
|
156
|
+
if (draft.changed && !saved.isPending) saved.mutate(draft.fields.body);
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<MarkdownEditor
|
|
160
|
+
repo={repo}
|
|
161
|
+
label="Comment"
|
|
162
|
+
value={draft.fields.body}
|
|
163
|
+
onChange={(next) => draft.set({ body: next })}
|
|
164
|
+
/>
|
|
165
|
+
<div className="flex justify-end gap-2">
|
|
166
|
+
<Button type="button" variant="ghost" onClick={() => setEditing(false)}>
|
|
167
|
+
Cancel
|
|
168
|
+
</Button>
|
|
169
|
+
<SaveButton
|
|
170
|
+
changed={draft.changed}
|
|
171
|
+
pending={saved.isPending}
|
|
172
|
+
data-hotkey={hotkeys.submit}
|
|
173
|
+
>
|
|
174
|
+
Update comment
|
|
175
|
+
<HotkeyHint keys={hotkeys.submit} />
|
|
176
|
+
</SaveButton>
|
|
177
|
+
</div>
|
|
178
|
+
<Failed error={saved.error} />
|
|
179
|
+
</form>
|
|
180
|
+
)}
|
|
181
|
+
</CardContent>
|
|
182
|
+
</Card>
|
|
183
|
+
</article>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** The issue's or pull request's title, and its editor for those allowed. */
|
|
188
|
+
export function Title({
|
|
189
|
+
issue,
|
|
190
|
+
save,
|
|
191
|
+
}: {
|
|
192
|
+
readonly issue: Issue;
|
|
193
|
+
readonly save: ((title: string) => Promise<void>) | undefined;
|
|
194
|
+
}) {
|
|
195
|
+
const [editing, setEditing] = useState(false);
|
|
196
|
+
const draft = useDraft({ title: issue.title }, (fields) => ({ title: fields.title.trim() }));
|
|
197
|
+
const saved = useMutation({
|
|
198
|
+
mutationFn: async (title: string) => {
|
|
199
|
+
await save?.(title);
|
|
200
|
+
},
|
|
201
|
+
onSuccess: () => setEditing(false),
|
|
202
|
+
});
|
|
203
|
+
const title = draft.fields.title.trim();
|
|
204
|
+
|
|
205
|
+
if (editing) {
|
|
206
|
+
return (
|
|
207
|
+
<form
|
|
208
|
+
className="flex flex-col gap-2"
|
|
209
|
+
onSubmit={(event) => {
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
|
|
212
|
+
if (draft.changed && title !== '' && !saved.isPending) saved.mutate(title);
|
|
213
|
+
}}
|
|
214
|
+
>
|
|
215
|
+
<div className="flex gap-2">
|
|
216
|
+
<Input
|
|
217
|
+
aria-label="Title"
|
|
218
|
+
value={draft.fields.title}
|
|
219
|
+
onChange={(event) => draft.set({ title: event.target.value })}
|
|
220
|
+
/>
|
|
221
|
+
<SaveButton changed={draft.changed} pending={saved.isPending} disabled={title === ''}>
|
|
222
|
+
Save
|
|
223
|
+
</SaveButton>
|
|
224
|
+
<Button type="button" variant="ghost" onClick={() => setEditing(false)}>
|
|
225
|
+
Cancel
|
|
226
|
+
</Button>
|
|
227
|
+
</div>
|
|
228
|
+
<Failed error={saved.error} />
|
|
229
|
+
</form>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
// The pencil follows the title's last word, so it sits beside the number on a wrapped title too.
|
|
235
|
+
// Top-aligned and moved 2px, it centres on the 24px text without growing the 32px line.
|
|
236
|
+
<div>
|
|
237
|
+
<h1 className="inline text-2xl">
|
|
238
|
+
{issue.title} <span className="text-muted-foreground">#{issue.number}</span>
|
|
239
|
+
</h1>
|
|
240
|
+
{save !== undefined && (
|
|
241
|
+
<Tooltip>
|
|
242
|
+
<TooltipTrigger
|
|
243
|
+
render={
|
|
244
|
+
<Button
|
|
245
|
+
variant="ghost"
|
|
246
|
+
size="icon-sm"
|
|
247
|
+
aria-label="Edit title"
|
|
248
|
+
className="relative top-0.5 ms-1 align-top text-muted-foreground"
|
|
249
|
+
onClick={() => {
|
|
250
|
+
draft.reset();
|
|
251
|
+
setEditing(true);
|
|
252
|
+
}}
|
|
253
|
+
/>
|
|
254
|
+
}
|
|
255
|
+
>
|
|
256
|
+
<PencilIcon aria-hidden />
|
|
257
|
+
</TooltipTrigger>
|
|
258
|
+
<TooltipContent>Edit title</TooltipContent>
|
|
259
|
+
</Tooltip>
|
|
260
|
+
)}
|
|
261
|
+
</div>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Something on a conversation besides a comment, such as a review, placed among them by time. */
|
|
266
|
+
export interface TimelineEvent {
|
|
267
|
+
readonly key: string;
|
|
268
|
+
readonly at: string;
|
|
269
|
+
readonly node: ReactNode;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* An issue's or pull request's conversation: its text, its comments and `events` in order, what
|
|
274
|
+
* comes before the comment box, and the box, which closes or reopens it for those allowed. Closing
|
|
275
|
+
* and reopening show at once, after any comment sent with them (G8).
|
|
276
|
+
*/
|
|
277
|
+
export function Conversation({
|
|
278
|
+
place,
|
|
279
|
+
issue,
|
|
280
|
+
allowed,
|
|
281
|
+
noun,
|
|
282
|
+
href,
|
|
283
|
+
change,
|
|
284
|
+
holding,
|
|
285
|
+
events = [],
|
|
286
|
+
settled = false,
|
|
287
|
+
children,
|
|
288
|
+
}: {
|
|
289
|
+
readonly place: RepoPlace;
|
|
290
|
+
readonly issue: Issue;
|
|
291
|
+
readonly allowed: ReadonlySet<PageOperation>;
|
|
292
|
+
/** What the conversation is on, as its close button names it. */
|
|
293
|
+
readonly noun: 'issue' | 'pull request';
|
|
294
|
+
/** Where signing in comes back to. */
|
|
295
|
+
readonly href: string;
|
|
296
|
+
/** Changes its title or text. */
|
|
297
|
+
readonly change: (asked: IssueChange) => Promise<void>;
|
|
298
|
+
/** Where the page holds it, for a close or a reopen to show in at once. */
|
|
299
|
+
readonly holding: Holding;
|
|
300
|
+
readonly events?: readonly TimelineEvent[];
|
|
301
|
+
/** Whether its state is for good, as a merged pull request's: no one closes or reopens it. */
|
|
302
|
+
readonly settled?: boolean;
|
|
303
|
+
/** What shows between the conversation and the comment box, such as a pull request's merge box. */
|
|
304
|
+
readonly children?: ReactNode;
|
|
305
|
+
}) {
|
|
306
|
+
const client = useQueryClient();
|
|
307
|
+
const { viewer } = useRouteContext({ from: '__root__' });
|
|
308
|
+
const comments = useInfiniteQuery(commentsOf(place, issue.number));
|
|
309
|
+
const repo = `${place.owner}/${place.repo}`;
|
|
310
|
+
const [draft, setDraft] = useState('');
|
|
311
|
+
const { commit, changing } = useChange(place, issue.number, holding);
|
|
312
|
+
|
|
313
|
+
const refreshComments = () =>
|
|
314
|
+
client.invalidateQueries({ queryKey: commentsOf(place, issue.number).queryKey });
|
|
315
|
+
|
|
316
|
+
const commented = useMutation({
|
|
317
|
+
mutationFn: async (close: boolean) => {
|
|
318
|
+
if (draft.trim() !== '') await addComment(place, issue.number, draft);
|
|
319
|
+
|
|
320
|
+
if (close) commit(stateChange(changing, issue.state === 'open' ? 'closed' : 'open'));
|
|
321
|
+
else await refreshComments();
|
|
322
|
+
},
|
|
323
|
+
onSuccess: async () => {
|
|
324
|
+
setDraft('');
|
|
325
|
+
await refreshComments();
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
const canUpdate = allowed.has('issue.update');
|
|
330
|
+
const open = issue.state === 'open';
|
|
331
|
+
const loaded = comments.data?.pages.flatMap((page) => page.comments) ?? [];
|
|
332
|
+
// While more comments wait on a page, an event after the last one loaded waits with them.
|
|
333
|
+
const last = loaded.at(-1);
|
|
334
|
+
const until =
|
|
335
|
+
comments.hasNextPage && last !== undefined
|
|
336
|
+
? Date.parse(last.created)
|
|
337
|
+
: Number.POSITIVE_INFINITY;
|
|
338
|
+
const timeline = [
|
|
339
|
+
...loaded.map((comment) => ({
|
|
340
|
+
key: `comment-${comment.id}`,
|
|
341
|
+
at: comment.created,
|
|
342
|
+
node: (
|
|
343
|
+
<Comment
|
|
344
|
+
key={`comment-${comment.id}`}
|
|
345
|
+
repo={repo}
|
|
346
|
+
author={comment.author}
|
|
347
|
+
upload={comment.pictures.get(comment.author)}
|
|
348
|
+
created={comment.created}
|
|
349
|
+
body={comment.body}
|
|
350
|
+
save={
|
|
351
|
+
allowed.has('comment.update')
|
|
352
|
+
? async (body) => {
|
|
353
|
+
await editComment(place, comment.id, body);
|
|
354
|
+
await refreshComments();
|
|
355
|
+
}
|
|
356
|
+
: undefined
|
|
357
|
+
}
|
|
358
|
+
/>
|
|
359
|
+
),
|
|
360
|
+
})),
|
|
361
|
+
...events.filter((event) => Date.parse(event.at) <= until),
|
|
362
|
+
].toSorted((a, b) => Date.parse(a.at) - Date.parse(b.at));
|
|
363
|
+
|
|
364
|
+
return (
|
|
365
|
+
// The body, the timeline and the comment box are the page's groups, a section's gap apart;
|
|
366
|
+
// the timeline's items are 12px apart inside it.
|
|
367
|
+
<div className="flex min-w-0 flex-col gap-section">
|
|
368
|
+
<Comment
|
|
369
|
+
repo={repo}
|
|
370
|
+
author={issue.author}
|
|
371
|
+
upload={issue.pictures.get(issue.author)}
|
|
372
|
+
created={issue.created}
|
|
373
|
+
body={issue.body}
|
|
374
|
+
save={canUpdate ? (body) => change({ body }) : undefined}
|
|
375
|
+
/>
|
|
376
|
+
{(timeline.length > 0 ||
|
|
377
|
+
comments.error !== null ||
|
|
378
|
+
comments.hasNextPage ||
|
|
379
|
+
(children !== undefined && children !== null && children !== false)) && (
|
|
380
|
+
<div className="flex flex-col gap-3">
|
|
381
|
+
{timeline.map((item) => (
|
|
382
|
+
<Fragment key={item.key}>{item.node}</Fragment>
|
|
383
|
+
))}
|
|
384
|
+
{comments.error !== null && <Failed error={comments.error} />}
|
|
385
|
+
{comments.hasNextPage && (
|
|
386
|
+
<Button
|
|
387
|
+
variant="outline"
|
|
388
|
+
className="self-center"
|
|
389
|
+
disabled={comments.isFetchingNextPage}
|
|
390
|
+
onClick={() => void comments.fetchNextPage()}
|
|
391
|
+
>
|
|
392
|
+
{comments.isFetchingNextPage ? 'Loading…' : 'More comments'}
|
|
393
|
+
</Button>
|
|
394
|
+
)}
|
|
395
|
+
{children}
|
|
396
|
+
</div>
|
|
397
|
+
)}
|
|
398
|
+
{viewer === null ? (
|
|
399
|
+
<Alert>
|
|
400
|
+
<AlertDescription>
|
|
401
|
+
<a className="text-link hover:underline" href={signInHref(href)}>
|
|
402
|
+
Sign in
|
|
403
|
+
</a>{' '}
|
|
404
|
+
to join this conversation.
|
|
405
|
+
</AlertDescription>
|
|
406
|
+
</Alert>
|
|
407
|
+
) : (
|
|
408
|
+
allowed.has('issue.comment') && (
|
|
409
|
+
<section aria-label="Add a comment" className="flex flex-col gap-2" data-hotkey-box>
|
|
410
|
+
<MarkdownEditor
|
|
411
|
+
repo={repo}
|
|
412
|
+
label="Comment"
|
|
413
|
+
value={draft}
|
|
414
|
+
onChange={setDraft}
|
|
415
|
+
placeholder="Leave a comment"
|
|
416
|
+
/>
|
|
417
|
+
<div className="flex justify-end gap-2">
|
|
418
|
+
{canUpdate && !settled && (
|
|
419
|
+
<Button
|
|
420
|
+
variant="outline"
|
|
421
|
+
disabled={commented.isPending}
|
|
422
|
+
onClick={() => commented.mutate(true)}
|
|
423
|
+
>
|
|
424
|
+
<ShutIcon noun={noun} open={open} />
|
|
425
|
+
{`${open ? 'Close' : 'Reopen'} ${draft.trim() === '' ? noun : 'with comment'}`}
|
|
426
|
+
</Button>
|
|
427
|
+
)}
|
|
428
|
+
<Button
|
|
429
|
+
disabled={commented.isPending || draft.trim() === ''}
|
|
430
|
+
onClick={() => commented.mutate(false)}
|
|
431
|
+
data-hotkey={hotkeys.submit}
|
|
432
|
+
>
|
|
433
|
+
Comment
|
|
434
|
+
<HotkeyHint keys={hotkeys.submit} />
|
|
435
|
+
</Button>
|
|
436
|
+
</div>
|
|
437
|
+
<Failed error={commented.error} />
|
|
438
|
+
</section>
|
|
439
|
+
)
|
|
440
|
+
)}
|
|
441
|
+
</div>
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* The Close or Reopen button's icon, in the colour the issue or pull request turns: a closed
|
|
447
|
+
* issue's purple, a pull request closed unmerged red, and green for either reopened.
|
|
448
|
+
*/
|
|
449
|
+
function ShutIcon({
|
|
450
|
+
noun,
|
|
451
|
+
open,
|
|
452
|
+
}: {
|
|
453
|
+
readonly noun: 'issue' | 'pull request';
|
|
454
|
+
readonly open: boolean;
|
|
455
|
+
}) {
|
|
456
|
+
if (!open) {
|
|
457
|
+
const Icon = noun === 'issue' ? CircleDotIcon : GitPullRequestIcon;
|
|
458
|
+
|
|
459
|
+
return <Icon aria-hidden data-icon="inline-start" className={tones.open} />;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const Icon = noun === 'issue' ? CircleCheckIcon : GitPullRequestClosedIcon;
|
|
463
|
+
|
|
464
|
+
return (
|
|
465
|
+
<Icon
|
|
466
|
+
aria-hidden
|
|
467
|
+
data-icon="inline-start"
|
|
468
|
+
className={noun === 'issue' ? tones.closed : tones.unmerged}
|
|
469
|
+
/>
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* An issue's page, as GitHub's shows it: its title and state, its conversation, and its
|
|
475
|
+
* assignees, labels and milestone beside it. Each control shows only to a viewer the drop-in
|
|
476
|
+
* would let use it.
|
|
477
|
+
*/
|
|
478
|
+
export function IssuePage({
|
|
479
|
+
place,
|
|
480
|
+
issue: held,
|
|
481
|
+
}: {
|
|
482
|
+
readonly place: RepoPlace;
|
|
483
|
+
readonly issue: Issue;
|
|
484
|
+
}) {
|
|
485
|
+
const client = useQueryClient();
|
|
486
|
+
const issue = useShown(place, held);
|
|
487
|
+
const allowed = useAllowed(place, issue.number);
|
|
488
|
+
const holding = issueHolding(client, place, issue.number);
|
|
489
|
+
|
|
490
|
+
const change = async (asked: IssueChange) => {
|
|
491
|
+
const changed = await changeIssue(place, issue.number, asked);
|
|
492
|
+
const numbered: Numbered = { kind: 'issue', issue: changed };
|
|
493
|
+
client.setQueryData(issueAt(place, issue.number).queryKey, numbered);
|
|
494
|
+
await client.invalidateQueries({ queryKey: ['issues', place.owner, place.repo] });
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const canUpdate = allowed.has('issue.update');
|
|
498
|
+
const open = issue.state === 'open';
|
|
499
|
+
const StateIcon = open ? CircleDotIcon : CircleCheckIcon;
|
|
500
|
+
|
|
501
|
+
return (
|
|
502
|
+
<div className="flex flex-col gap-section">
|
|
503
|
+
<div className="flex flex-col gap-2 border-b pb-3">
|
|
504
|
+
<Title issue={issue} save={canUpdate ? (title) => change({ title }) : undefined} />
|
|
505
|
+
<div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
|
|
506
|
+
<Badge className={open ? fills.open : fills.closed}>
|
|
507
|
+
<StateIcon data-icon="inline-start" />
|
|
508
|
+
{open ? 'Open' : 'Closed'}
|
|
509
|
+
</Badge>
|
|
510
|
+
<span>
|
|
511
|
+
<OwnerCard login={issue.author} className="font-medium text-foreground">
|
|
512
|
+
{issue.author}
|
|
513
|
+
</OwnerCard>{' '}
|
|
514
|
+
opened this issue on {day.format(new Date(issue.created))} · {issue.comments}{' '}
|
|
515
|
+
{issue.comments === 1 ? 'comment' : 'comments'}
|
|
516
|
+
</span>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
<div className="grid gap-6 md:grid-cols-[1fr_16rem]">
|
|
520
|
+
<Conversation
|
|
521
|
+
place={place}
|
|
522
|
+
issue={issue}
|
|
523
|
+
allowed={allowed}
|
|
524
|
+
noun="issue"
|
|
525
|
+
href={issueHref(place, issue.number)}
|
|
526
|
+
change={change}
|
|
527
|
+
holding={holding}
|
|
528
|
+
/>
|
|
529
|
+
<Sidebar place={place} issue={issue} allowed={allowed} holding={holding} />
|
|
530
|
+
</div>
|
|
531
|
+
</div>
|
|
532
|
+
);
|
|
533
|
+
}
|