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,140 @@
|
|
|
1
|
+
import { type QueryClient, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { type ReactNode, useRef } from 'react';
|
|
3
|
+
import { toast } from 'sonner';
|
|
4
|
+
|
|
5
|
+
import { cn } from '#/lib/cn';
|
|
6
|
+
|
|
7
|
+
import type { AvatarOf } from '../components/avatar-url.ts';
|
|
8
|
+
import { Alert, AlertDescription } from '../components/ui/alert.tsx';
|
|
9
|
+
import { Button } from '../components/ui/button.tsx';
|
|
10
|
+
import {
|
|
11
|
+
Card,
|
|
12
|
+
CardContent,
|
|
13
|
+
CardDescription,
|
|
14
|
+
CardHeader,
|
|
15
|
+
CardTitle,
|
|
16
|
+
} from '../components/ui/card.tsx';
|
|
17
|
+
import { avatarState, deleteAvatar, putAvatar } from './avatar.ts';
|
|
18
|
+
|
|
19
|
+
/** What the section's checks allow, which its description says after its own words. */
|
|
20
|
+
const allowed = 'PNG, JPEG or WebP, up to 1 MB and 1024 by 1024 pixels.';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An avatar's section, the same for a person, an org and a repo (Q757): its preview, Upload, which
|
|
24
|
+
* takes a PNG, JPEG or WebP the route checks by its bytes, and Remove while one is set. Either
|
|
25
|
+
* calls `onShown` with the new hash, or `null` once it's removed, so each avatar of it on the page
|
|
26
|
+
* shows the change at once.
|
|
27
|
+
*/
|
|
28
|
+
export function AvatarSection({
|
|
29
|
+
place,
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
preview,
|
|
33
|
+
onShown,
|
|
34
|
+
refusal,
|
|
35
|
+
className,
|
|
36
|
+
heading: Heading = 'h3',
|
|
37
|
+
}: {
|
|
38
|
+
readonly place: AvatarOf;
|
|
39
|
+
/** The section's heading, which its toasts and its file input's label name too. */
|
|
40
|
+
readonly title: string;
|
|
41
|
+
readonly description: ReactNode;
|
|
42
|
+
readonly preview: ReactNode;
|
|
43
|
+
readonly onShown: (client: QueryClient, hash: string | null) => void;
|
|
44
|
+
/** Why the viewer can't change it, said in place of Upload and Remove, or none when they can. */
|
|
45
|
+
readonly refusal?: string | undefined;
|
|
46
|
+
readonly className?: string | undefined;
|
|
47
|
+
/** Its heading's level: `h3` under a settings page's `h2`, `h2` as an account page's own. */
|
|
48
|
+
readonly heading?: 'h2' | 'h3';
|
|
49
|
+
}) {
|
|
50
|
+
const client = useQueryClient();
|
|
51
|
+
const picker = useRef<HTMLInputElement>(null);
|
|
52
|
+
// Only a viewer who changes it needs to know whether one is set, for Remove.
|
|
53
|
+
const state = useQuery({ ...avatarState(place), enabled: refusal === undefined });
|
|
54
|
+
const shown = (hash: string | null) => {
|
|
55
|
+
client.setQueryData(avatarState(place).queryKey, hash);
|
|
56
|
+
onShown(client, hash);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const uploaded = useMutation({
|
|
60
|
+
mutationFn: (file: File) => putAvatar(place, file),
|
|
61
|
+
onSuccess: (hash) => {
|
|
62
|
+
shown(hash);
|
|
63
|
+
toast.success(`${title} set`);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const removed = useMutation({
|
|
67
|
+
mutationFn: () => deleteAvatar(place),
|
|
68
|
+
onSuccess: () => {
|
|
69
|
+
shown(null);
|
|
70
|
+
toast.success(`${title} removed`);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
const busy = uploaded.isPending || removed.isPending;
|
|
74
|
+
// The last one tried's refusal, or none once it's gone through.
|
|
75
|
+
const error = (uploaded.submittedAt >= removed.submittedAt ? uploaded : removed).error;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<section aria-label={title} className={cn('max-w-xl', className)}>
|
|
79
|
+
<Card>
|
|
80
|
+
<CardHeader>
|
|
81
|
+
<CardTitle>
|
|
82
|
+
<Heading>{title}</Heading>
|
|
83
|
+
</CardTitle>
|
|
84
|
+
<CardDescription>
|
|
85
|
+
{description} {allowed}
|
|
86
|
+
</CardDescription>
|
|
87
|
+
</CardHeader>
|
|
88
|
+
<CardContent className="flex flex-col gap-3">
|
|
89
|
+
<div className="flex items-center gap-4">
|
|
90
|
+
{preview}
|
|
91
|
+
{refusal === undefined ? (
|
|
92
|
+
<>
|
|
93
|
+
<input
|
|
94
|
+
ref={picker}
|
|
95
|
+
type="file"
|
|
96
|
+
accept="image/png,image/jpeg,image/webp"
|
|
97
|
+
aria-label={`${title} file`}
|
|
98
|
+
hidden
|
|
99
|
+
onChange={(event) => {
|
|
100
|
+
const file = event.target.files?.[0];
|
|
101
|
+
event.target.value = '';
|
|
102
|
+
|
|
103
|
+
if (file !== undefined) uploaded.mutate(file);
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
<div className="flex flex-wrap gap-2">
|
|
107
|
+
<Button
|
|
108
|
+
variant="outline"
|
|
109
|
+
size="sm"
|
|
110
|
+
disabled={busy}
|
|
111
|
+
onClick={() => picker.current?.click()}
|
|
112
|
+
>
|
|
113
|
+
Upload
|
|
114
|
+
</Button>
|
|
115
|
+
{(state.data ?? null) !== null && (
|
|
116
|
+
<Button
|
|
117
|
+
variant="destructive"
|
|
118
|
+
size="sm"
|
|
119
|
+
disabled={busy}
|
|
120
|
+
onClick={() => removed.mutate()}
|
|
121
|
+
>
|
|
122
|
+
Remove
|
|
123
|
+
</Button>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
</>
|
|
127
|
+
) : (
|
|
128
|
+
<p className="text-sm text-muted-foreground">{refusal}</p>
|
|
129
|
+
)}
|
|
130
|
+
</div>
|
|
131
|
+
{error !== null && (
|
|
132
|
+
<Alert variant="destructive">
|
|
133
|
+
<AlertDescription>{error.message}</AlertDescription>
|
|
134
|
+
</Alert>
|
|
135
|
+
)}
|
|
136
|
+
</CardContent>
|
|
137
|
+
</Card>
|
|
138
|
+
</section>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
+
import * as Option from 'effect/Option';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
|
|
5
|
+
import { type AvatarOf, avatarUrl } from '../components/avatar-url.ts';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* An avatar, as its settings read, set and remove it: a person's, an org's or a repo's, straight
|
|
9
|
+
* from the page to the avatar's route, `/icons/{login}` or `/icons/{owner}/{repo}`, which holds the
|
|
10
|
+
* person's session and checks the bytes.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const Refusal = Schema.Struct({ message: Schema.String });
|
|
14
|
+
|
|
15
|
+
const refusal = Schema.decodeUnknownOption(Refusal);
|
|
16
|
+
|
|
17
|
+
/** The route's refusal, as its message, or its status when it sent none. */
|
|
18
|
+
const refusalOf = async (answer: Response) => {
|
|
19
|
+
const body: unknown = await answer.json().catch(() => undefined);
|
|
20
|
+
const said = Option.match(refusal(body), {
|
|
21
|
+
onNone: () => `The picture wasn't saved: ${answer.status}`,
|
|
22
|
+
onSome: (each) => each.message,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return new Error(said);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** The hash of the avatar, or `null` while there's none: the avatar's ETag, revalidated. */
|
|
29
|
+
export const avatarState = (place: AvatarOf) =>
|
|
30
|
+
queryOptions({
|
|
31
|
+
queryKey: ['avatar-state', place.owner, place.repo ?? null],
|
|
32
|
+
queryFn: async (): Promise<string | null> => {
|
|
33
|
+
const answer = await fetch(avatarUrl(place), { cache: 'no-cache' });
|
|
34
|
+
await answer.body?.cancel();
|
|
35
|
+
|
|
36
|
+
if (answer.status === 404) return null;
|
|
37
|
+
|
|
38
|
+
if (!answer.ok) throw new Error(`The picture didn't load: ${answer.status}`);
|
|
39
|
+
|
|
40
|
+
return answer.headers.get('etag')?.replaceAll('"', '') ?? null;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const uploaded = Schema.decodeUnknownSync(Schema.Struct({ hash: Schema.String }));
|
|
45
|
+
|
|
46
|
+
/** Sets `file` as the avatar, answering its hash, or throws the route's refusal. */
|
|
47
|
+
export const putAvatar = async (place: AvatarOf, file: Blob): Promise<string> => {
|
|
48
|
+
const answer = await fetch(avatarUrl(place), { method: 'PUT', body: file });
|
|
49
|
+
if (!answer.ok) throw await refusalOf(answer);
|
|
50
|
+
|
|
51
|
+
return uploaded(await answer.json()).hash;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Removes the avatar, or throws the route's refusal. */
|
|
55
|
+
export const deleteAvatar = async (place: AvatarOf) => {
|
|
56
|
+
const answer = await fetch(avatarUrl(place), { method: 'DELETE' });
|
|
57
|
+
if (!answer.ok) throw await refusalOf(answer);
|
|
58
|
+
};
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
3
|
+
import { LockIcon } from 'lucide-react';
|
|
4
|
+
import { type FormEvent, type ReactNode, useState } from 'react';
|
|
5
|
+
import { toast } from 'sonner';
|
|
6
|
+
|
|
7
|
+
import type { RepoPlace } from '../code/places.ts';
|
|
8
|
+
import { ConfirmAction } from '../components/confirm-action.tsx';
|
|
9
|
+
import { setIconHash } from '../components/repos/icon-hashes.ts';
|
|
10
|
+
import { RepoIcon } from '../components/repos/repo-icon.tsx';
|
|
11
|
+
import { InputGroupSaveButton, SaveButton } from '../components/save-button.tsx';
|
|
12
|
+
import { LoadFailed } from '../components/states/states.tsx';
|
|
13
|
+
import { Alert, AlertDescription } from '../components/ui/alert.tsx';
|
|
14
|
+
import { Button } from '../components/ui/button.tsx';
|
|
15
|
+
import {
|
|
16
|
+
Card,
|
|
17
|
+
CardContent,
|
|
18
|
+
CardDescription,
|
|
19
|
+
CardFooter,
|
|
20
|
+
CardHeader,
|
|
21
|
+
CardTitle,
|
|
22
|
+
} from '../components/ui/card.tsx';
|
|
23
|
+
import { Checkbox } from '../components/ui/checkbox.tsx';
|
|
24
|
+
import { Field, FieldDescription, FieldGroup, FieldLabel } from '../components/ui/field.tsx';
|
|
25
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '../components/ui/input-group.tsx';
|
|
26
|
+
import {
|
|
27
|
+
Combobox,
|
|
28
|
+
ComboboxContent,
|
|
29
|
+
ComboboxEmpty,
|
|
30
|
+
ComboboxInput,
|
|
31
|
+
ComboboxItem,
|
|
32
|
+
ComboboxList,
|
|
33
|
+
} from '../components/ui/combobox.tsx';
|
|
34
|
+
import {
|
|
35
|
+
Item,
|
|
36
|
+
ItemActions,
|
|
37
|
+
ItemContent,
|
|
38
|
+
ItemDescription,
|
|
39
|
+
ItemGroup,
|
|
40
|
+
ItemSeparator,
|
|
41
|
+
ItemTitle,
|
|
42
|
+
} from '../components/ui/item.tsx';
|
|
43
|
+
import { Skeleton } from '../components/ui/skeleton.tsx';
|
|
44
|
+
import { useAllowed } from '../hooks/allowed.ts';
|
|
45
|
+
import { useDraft } from '../hooks/draft.ts';
|
|
46
|
+
import { repoProblem } from '../names/repos.ts';
|
|
47
|
+
import { deleteRepo, type General, generalSettings, updateRepo } from './general.ts';
|
|
48
|
+
import { AvatarSection } from './avatar-section.tsx';
|
|
49
|
+
|
|
50
|
+
/** The switches General shows, each a setting the drop-in keeps, by its label. */
|
|
51
|
+
const switches = [
|
|
52
|
+
['hasIssues', 'Issues'],
|
|
53
|
+
['allowMergeCommit', 'Allow merge commits'],
|
|
54
|
+
['allowSquashMerge', 'Allow squash merging'],
|
|
55
|
+
['allowRebaseMerge', 'Allow rebase merging'],
|
|
56
|
+
['deleteBranchOnMerge', 'Automatically delete head branches'],
|
|
57
|
+
] as const;
|
|
58
|
+
|
|
59
|
+
/** What the Features and pull requests form changes, and nothing else of the repo's. */
|
|
60
|
+
type Switches = Pick<General, (typeof switches)[number][0]>;
|
|
61
|
+
|
|
62
|
+
/** A failed save's reason. */
|
|
63
|
+
function Refused({ error }: { readonly error: Error | null }) {
|
|
64
|
+
if (error === null) return null;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Alert variant="destructive">
|
|
68
|
+
<AlertDescription>{error.message}</AlertDescription>
|
|
69
|
+
</Alert>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* One of General's sections: a Card holding a form that saves what it holds, from `footer`, and
|
|
75
|
+
* says what's set now in `description`. A submit, by its button or Enter, sends nothing until the
|
|
76
|
+
* form holds a change.
|
|
77
|
+
*/
|
|
78
|
+
function Section({
|
|
79
|
+
title,
|
|
80
|
+
description,
|
|
81
|
+
onSave,
|
|
82
|
+
changed,
|
|
83
|
+
saving,
|
|
84
|
+
error,
|
|
85
|
+
footer,
|
|
86
|
+
children,
|
|
87
|
+
}: {
|
|
88
|
+
readonly title: string;
|
|
89
|
+
readonly description?: ReactNode;
|
|
90
|
+
readonly onSave: () => void;
|
|
91
|
+
readonly changed: boolean;
|
|
92
|
+
readonly saving: boolean;
|
|
93
|
+
readonly error: Error | null;
|
|
94
|
+
readonly footer?: ReactNode;
|
|
95
|
+
readonly children: ReactNode;
|
|
96
|
+
}) {
|
|
97
|
+
const submit = (event: FormEvent<HTMLFormElement>) => {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
|
|
100
|
+
if (changed && !saving) onSave();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Card className="max-w-xl">
|
|
105
|
+
{/* The form holds the Card's parts, laid out as the Card's own children. */}
|
|
106
|
+
<form aria-label={title} onSubmit={submit} className="contents">
|
|
107
|
+
<CardHeader>
|
|
108
|
+
<CardTitle>
|
|
109
|
+
<h3>{title}</h3>
|
|
110
|
+
</CardTitle>
|
|
111
|
+
{description !== undefined && <CardDescription>{description}</CardDescription>}
|
|
112
|
+
</CardHeader>
|
|
113
|
+
<CardContent className="flex flex-col gap-3">
|
|
114
|
+
<FieldGroup>{children}</FieldGroup>
|
|
115
|
+
<Refused error={error} />
|
|
116
|
+
</CardContent>
|
|
117
|
+
{footer !== undefined && <CardFooter className="justify-end">{footer}</CardFooter>}
|
|
118
|
+
</form>
|
|
119
|
+
</Card>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A repo's General settings, as GitHub's page: its name, default branch, features and merge
|
|
125
|
+
* buttons, then the danger zone. Each is changed as the viewer, through the host's sign-in.
|
|
126
|
+
*/
|
|
127
|
+
export function GeneralSettings({ place }: { readonly place: RepoPlace }) {
|
|
128
|
+
const allowed = useAllowed(place);
|
|
129
|
+
const asked = useQuery(generalSettings(place));
|
|
130
|
+
|
|
131
|
+
if (!allowed.has('repo.update')) {
|
|
132
|
+
return (
|
|
133
|
+
<Alert>
|
|
134
|
+
<LockIcon />
|
|
135
|
+
<AlertDescription>
|
|
136
|
+
You can't change {place.owner}/{place.repo}'s general settings.
|
|
137
|
+
</AlertDescription>
|
|
138
|
+
</Alert>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (asked.data === undefined) {
|
|
143
|
+
return asked.error === null ? (
|
|
144
|
+
<Skeleton className="h-64" />
|
|
145
|
+
) : (
|
|
146
|
+
<LoadFailed message="The settings didn't load" />
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<GeneralForms
|
|
152
|
+
key={JSON.stringify(asked.data.general)}
|
|
153
|
+
place={place}
|
|
154
|
+
general={asked.data.general}
|
|
155
|
+
branches={asked.data.branches}
|
|
156
|
+
deletes={allowed.has('repo.delete')}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function GeneralForms({
|
|
162
|
+
place,
|
|
163
|
+
general,
|
|
164
|
+
branches,
|
|
165
|
+
deletes,
|
|
166
|
+
}: {
|
|
167
|
+
readonly place: RepoPlace;
|
|
168
|
+
readonly general: General;
|
|
169
|
+
readonly branches: readonly string[];
|
|
170
|
+
readonly deletes: boolean;
|
|
171
|
+
}) {
|
|
172
|
+
const client = useQueryClient();
|
|
173
|
+
const navigate = useNavigate();
|
|
174
|
+
const name = useDraft({ name: general.name });
|
|
175
|
+
const branch = useDraft({ branch: general.defaultBranch });
|
|
176
|
+
const [typed, setTyped] = useState(general.defaultBranch);
|
|
177
|
+
// A branch past the first page the drop-in lists can still be the default: what's typed is
|
|
178
|
+
// offered too, for the drop-in to take or refuse.
|
|
179
|
+
const offered = typed === '' || branches.includes(typed) ? branches : [...branches, typed];
|
|
180
|
+
// Only the switches this form shows: a stale copy of the rest, such as visibility, is never sent.
|
|
181
|
+
const features = useDraft<Switches>({
|
|
182
|
+
hasIssues: general.hasIssues,
|
|
183
|
+
allowMergeCommit: general.allowMergeCommit,
|
|
184
|
+
allowSquashMerge: general.allowSquashMerge,
|
|
185
|
+
allowRebaseMerge: general.allowRebaseMerge,
|
|
186
|
+
deleteBranchOnMerge: general.deleteBranchOnMerge,
|
|
187
|
+
});
|
|
188
|
+
const saved = async () => {
|
|
189
|
+
await client.invalidateQueries({ queryKey: ['general', place.owner, place.repo] });
|
|
190
|
+
await client.invalidateQueries({ queryKey: ['repo', place.owner, place.repo] });
|
|
191
|
+
toast.success('Saved');
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const renamed = useMutation({
|
|
195
|
+
mutationFn: () => updateRepo(place, { name: name.fields.name }),
|
|
196
|
+
onSuccess: async (now) => {
|
|
197
|
+
await client.invalidateQueries({ queryKey: ['repos'] });
|
|
198
|
+
toast.success(`Renamed to ${place.owner}/${now}`);
|
|
199
|
+
await navigate({ href: `/${place.owner}/${now}/settings` });
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
const rebased = useMutation({
|
|
203
|
+
mutationFn: () => updateRepo(place, { defaultBranch: branch.fields.branch }),
|
|
204
|
+
onSuccess: saved,
|
|
205
|
+
});
|
|
206
|
+
const switched = useMutation({
|
|
207
|
+
mutationFn: () => updateRepo(place, features.fields),
|
|
208
|
+
onSuccess: saved,
|
|
209
|
+
});
|
|
210
|
+
const problem = repoProblem(name.fields.name);
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<section aria-label="General" className="flex flex-col gap-4">
|
|
214
|
+
<h2 className="text-lg font-semibold">General</h2>
|
|
215
|
+
<Section
|
|
216
|
+
title="Repository name"
|
|
217
|
+
description={
|
|
218
|
+
<>
|
|
219
|
+
This repository is named <strong className="text-foreground">{general.name}</strong>.
|
|
220
|
+
</>
|
|
221
|
+
}
|
|
222
|
+
onSave={() => renamed.mutate()}
|
|
223
|
+
changed={name.changed && problem === undefined}
|
|
224
|
+
saving={renamed.isPending}
|
|
225
|
+
error={renamed.error}
|
|
226
|
+
>
|
|
227
|
+
<Field data-invalid={problem !== undefined}>
|
|
228
|
+
<InputGroup>
|
|
229
|
+
<InputGroupInput
|
|
230
|
+
id="repo-name"
|
|
231
|
+
aria-label="Repository name"
|
|
232
|
+
aria-invalid={problem !== undefined}
|
|
233
|
+
value={name.fields.name}
|
|
234
|
+
onChange={(event) => name.set({ name: event.target.value })}
|
|
235
|
+
/>
|
|
236
|
+
<InputGroupAddon align="inline-end">
|
|
237
|
+
<InputGroupSaveButton
|
|
238
|
+
changed={name.changed && problem === undefined}
|
|
239
|
+
pending={renamed.isPending}
|
|
240
|
+
>
|
|
241
|
+
Rename
|
|
242
|
+
</InputGroupSaveButton>
|
|
243
|
+
</InputGroupAddon>
|
|
244
|
+
</InputGroup>
|
|
245
|
+
{problem !== undefined && <FieldDescription>{problem}</FieldDescription>}
|
|
246
|
+
</Field>
|
|
247
|
+
</Section>
|
|
248
|
+
<IconSection place={place} />
|
|
249
|
+
<Section
|
|
250
|
+
title="Default branch"
|
|
251
|
+
description={
|
|
252
|
+
<>
|
|
253
|
+
The default branch is{' '}
|
|
254
|
+
<strong className="text-foreground">{general.defaultBranch}</strong>.
|
|
255
|
+
</>
|
|
256
|
+
}
|
|
257
|
+
onSave={() => rebased.mutate()}
|
|
258
|
+
changed={branch.changed}
|
|
259
|
+
saving={rebased.isPending}
|
|
260
|
+
error={rebased.error}
|
|
261
|
+
>
|
|
262
|
+
<Field>
|
|
263
|
+
<Combobox
|
|
264
|
+
items={offered}
|
|
265
|
+
value={branch.fields.branch}
|
|
266
|
+
onValueChange={(picked: string | null) =>
|
|
267
|
+
branch.set({ branch: picked ?? general.defaultBranch })
|
|
268
|
+
}
|
|
269
|
+
inputValue={typed}
|
|
270
|
+
onInputValueChange={setTyped}
|
|
271
|
+
autoHighlight
|
|
272
|
+
>
|
|
273
|
+
<ComboboxInput id="default-branch" aria-label="Default branch">
|
|
274
|
+
<InputGroupAddon align="inline-end">
|
|
275
|
+
<InputGroupSaveButton changed={branch.changed} pending={rebased.isPending}>
|
|
276
|
+
Update
|
|
277
|
+
</InputGroupSaveButton>
|
|
278
|
+
</InputGroupAddon>
|
|
279
|
+
</ComboboxInput>
|
|
280
|
+
<ComboboxContent>
|
|
281
|
+
<ComboboxEmpty>No branches yet.</ComboboxEmpty>
|
|
282
|
+
<ComboboxList>
|
|
283
|
+
{(name: string) => (
|
|
284
|
+
<ComboboxItem key={name} value={name}>
|
|
285
|
+
{name}
|
|
286
|
+
</ComboboxItem>
|
|
287
|
+
)}
|
|
288
|
+
</ComboboxList>
|
|
289
|
+
</ComboboxContent>
|
|
290
|
+
</Combobox>
|
|
291
|
+
</Field>
|
|
292
|
+
</Section>
|
|
293
|
+
<Section
|
|
294
|
+
title="Features and pull requests"
|
|
295
|
+
onSave={() => switched.mutate()}
|
|
296
|
+
changed={features.changed}
|
|
297
|
+
saving={switched.isPending}
|
|
298
|
+
error={switched.error}
|
|
299
|
+
footer={
|
|
300
|
+
<SaveButton changed={features.changed} pending={switched.isPending}>
|
|
301
|
+
Save
|
|
302
|
+
</SaveButton>
|
|
303
|
+
}
|
|
304
|
+
>
|
|
305
|
+
{switches.map(([key, label]) => (
|
|
306
|
+
<Field key={key} orientation="horizontal">
|
|
307
|
+
<Checkbox
|
|
308
|
+
id={key}
|
|
309
|
+
checked={features.fields[key]}
|
|
310
|
+
onCheckedChange={(checked) => features.set({ [key]: checked })}
|
|
311
|
+
/>
|
|
312
|
+
<FieldLabel htmlFor={key}>{label}</FieldLabel>
|
|
313
|
+
</Field>
|
|
314
|
+
))}
|
|
315
|
+
</Section>
|
|
316
|
+
<DangerZone place={place} general={general} deletes={deletes} onChanged={saved} />
|
|
317
|
+
</section>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* The repo's icon, as the shared avatar section sets it: each upload's hash, or a removal's `null`,
|
|
323
|
+
* is what every `RepoIcon` of the repo on the page shows at once.
|
|
324
|
+
*/
|
|
325
|
+
function IconSection({ place }: { readonly place: RepoPlace }) {
|
|
326
|
+
return (
|
|
327
|
+
<AvatarSection
|
|
328
|
+
place={place}
|
|
329
|
+
title="Icon"
|
|
330
|
+
description="Shown in a circle beside the repository's name."
|
|
331
|
+
preview={<RepoIcon owner={place.owner} repo={place.repo} size="xl" />}
|
|
332
|
+
onShown={(client, hash) => setIconHash(client, place, hash)}
|
|
333
|
+
/>
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** The repo's visibility, and its deletion, which asks for its full name typed first. */
|
|
338
|
+
function DangerZone({
|
|
339
|
+
place,
|
|
340
|
+
general,
|
|
341
|
+
deletes,
|
|
342
|
+
onChanged,
|
|
343
|
+
}: {
|
|
344
|
+
readonly place: RepoPlace;
|
|
345
|
+
readonly general: General;
|
|
346
|
+
readonly deletes: boolean;
|
|
347
|
+
readonly onChanged: () => Promise<void>;
|
|
348
|
+
}) {
|
|
349
|
+
const client = useQueryClient();
|
|
350
|
+
const navigate = useNavigate();
|
|
351
|
+
const fullName = `${place.owner}/${place.repo}`;
|
|
352
|
+
const flipped = useMutation({
|
|
353
|
+
mutationFn: () => updateRepo(place, { private: !general.private }),
|
|
354
|
+
onSuccess: onChanged,
|
|
355
|
+
});
|
|
356
|
+
const deleted = useMutation({
|
|
357
|
+
mutationFn: () => deleteRepo(place),
|
|
358
|
+
onSuccess: async () => {
|
|
359
|
+
client.removeQueries({ queryKey: ['repo', place.owner, place.repo] });
|
|
360
|
+
await client.invalidateQueries({ queryKey: ['repos'] });
|
|
361
|
+
await navigate({ to: '/$owner', params: { owner: place.owner } });
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
const error = flipped.error ?? deleted.error;
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<section aria-label="Danger zone" className="max-w-xl">
|
|
368
|
+
<Card className="ring-destructive/40">
|
|
369
|
+
<CardHeader>
|
|
370
|
+
<CardTitle className="text-destructive">
|
|
371
|
+
<h3>Danger zone</h3>
|
|
372
|
+
</CardTitle>
|
|
373
|
+
<CardDescription>These change who sees the repository, or remove it.</CardDescription>
|
|
374
|
+
</CardHeader>
|
|
375
|
+
<CardContent className="flex flex-col gap-3">
|
|
376
|
+
<ItemGroup className="gap-0">
|
|
377
|
+
<Item size="sm" className="px-0">
|
|
378
|
+
<ItemContent className="min-w-48">
|
|
379
|
+
<ItemTitle>Change visibility</ItemTitle>
|
|
380
|
+
<ItemDescription className="line-clamp-none">
|
|
381
|
+
This repository is{' '}
|
|
382
|
+
<strong className="text-foreground">
|
|
383
|
+
{general.private ? 'private' : 'public'}
|
|
384
|
+
</strong>
|
|
385
|
+
.
|
|
386
|
+
</ItemDescription>
|
|
387
|
+
</ItemContent>
|
|
388
|
+
<ItemActions>
|
|
389
|
+
{general.private ? (
|
|
390
|
+
<ConfirmAction
|
|
391
|
+
label="Make public"
|
|
392
|
+
title={`Make ${fullName} public?`}
|
|
393
|
+
description="Anyone will see its code, its issues and its pull requests. You can make it private again."
|
|
394
|
+
mustType={{ text: fullName, typedId: 'confirm-public' }}
|
|
395
|
+
disabled={flipped.isPending}
|
|
396
|
+
onConfirm={() => flipped.mutate()}
|
|
397
|
+
/>
|
|
398
|
+
) : (
|
|
399
|
+
<Button
|
|
400
|
+
variant="outline"
|
|
401
|
+
size="sm"
|
|
402
|
+
disabled={flipped.isPending}
|
|
403
|
+
onClick={() => flipped.mutate()}
|
|
404
|
+
>
|
|
405
|
+
Make private
|
|
406
|
+
</Button>
|
|
407
|
+
)}
|
|
408
|
+
</ItemActions>
|
|
409
|
+
</Item>
|
|
410
|
+
{deletes && (
|
|
411
|
+
<>
|
|
412
|
+
<ItemSeparator />
|
|
413
|
+
<Item size="sm" className="px-0">
|
|
414
|
+
<ItemContent className="min-w-48">
|
|
415
|
+
<ItemTitle>Delete this repository</ItemTitle>
|
|
416
|
+
<ItemDescription className="line-clamp-none">
|
|
417
|
+
Once deleted, it's gone: there is no going back.
|
|
418
|
+
</ItemDescription>
|
|
419
|
+
</ItemContent>
|
|
420
|
+
<ItemActions>
|
|
421
|
+
<ConfirmAction
|
|
422
|
+
label="Delete repository"
|
|
423
|
+
title={`Delete ${fullName}?`}
|
|
424
|
+
description="It's permanent: its code, issues, pull requests and releases are deleted with it."
|
|
425
|
+
mustType={{ text: fullName, typedId: 'confirm-delete' }}
|
|
426
|
+
disabled={deleted.isPending}
|
|
427
|
+
onConfirm={() => deleted.mutate()}
|
|
428
|
+
/>
|
|
429
|
+
</ItemActions>
|
|
430
|
+
</Item>
|
|
431
|
+
</>
|
|
432
|
+
)}
|
|
433
|
+
</ItemGroup>
|
|
434
|
+
<Refused error={error} />
|
|
435
|
+
</CardContent>
|
|
436
|
+
</Card>
|
|
437
|
+
</section>
|
|
438
|
+
);
|
|
439
|
+
}
|