Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 1 | import { ArrowUpRight, Check, Ellipsis, ShieldAlert, ShieldCheck, Users } from "lucide-react"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 2 | import { useState } from "react"; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 3 | import { Form, Link, data, redirect, useSearchParams, useSubmit } from "react-router"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 4 | |
| 5 | import { | |
| 6 | BASE_PERMISSIONS, | |
| 7 | BASE_PERMISSION_LABELS, | |
| 8 | type BasePermission, | |
| 9 | DEFAULT_BASE_PERMISSION, | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 10 | type Member, |
| 11 | ORG_ROLES, | |
| 12 | ORG_ROLE_LABELS, | |
| 13 | ORG_ROLE_SUMMARIES, | |
| 14 | type OrgRole, | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 15 | REPO_ROLE_LABELS, |
| 16 | } from "@g1t/contracts"; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 17 | |
| 18 | import type { Route } from "./+types/people"; | |
| Social cards for every page: og.g1t.sh | 19 | import { page } from "../../lib/meta"; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 20 | import { Avatar, Button, CopyLine, ErrorText, Field, Input, Pill, SubmitButton, TimeAgo } from "../../components/ui"; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 21 | import { Badge } from "../../components/ui/badge"; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 22 | import { |
| 23 | AlertDialog, | |
| 24 | AlertDialogCancel, | |
| 25 | AlertDialogContent, | |
| 26 | AlertDialogDescription, | |
| 27 | AlertDialogFooter, | |
| 28 | AlertDialogHeader, | |
| 29 | AlertDialogTitle, | |
| 30 | } from "../../components/ui/alert-dialog"; | |
| 31 | import { | |
| 32 | DropdownMenu, | |
| 33 | DropdownMenuContent, | |
| 34 | DropdownMenuItem, | |
| 35 | DropdownMenuLabel, | |
| 36 | DropdownMenuSeparator, | |
| 37 | DropdownMenuTrigger, | |
| 38 | } from "../../components/ui/dropdown-menu"; | |
| 39 | import { Hint } from "../../components/ui/hint"; | |
| 40 | import { forgetWorkspace } from "../../lib/workspace-choice"; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 41 | import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../components/ui/select"; |
| 42 | import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../components/ui/tabs"; | |
| 43 | import { inviteLink, inviteState, moreInvitesMailto } from "../../lib/invites"; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 44 | import { billing, identity } from "../../lib/services.server"; |
| 45 | import { StartPlanToInvite } from "../../components/start-plan"; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 46 | import { |
| 47 | assertSameOrigin, | |
| 48 | getViewer, | |
| 49 | requireUser, | |
| 50 | roleIn, | |
| 51 | unwrap, | |
| 52 | } from "../../lib/session.server"; | |
| 53 | ||
| Social cards for every page: og.g1t.sh | 54 | export function meta({ params, ...args }: Route.MetaArgs) { |
| Navigation: the workspace's own page with tabs, pins and recent in the sidebar | 55 | return page(args, { title: `People · ${params.owner} · g1t` }); |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 56 | } |
| 57 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 58 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 59 | const viewer = getViewer(context); |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 60 | const role = roleIn(viewer, params.owner); |
| 61 | // Who is in a workspace is its members' business; anyone else, including | |
| 62 | // someone a repository is shared with, gets nothing here. | |
| 63 | if (!role) throw data(null, { status: 404 }); | |
| 64 | const owner = role === "owner"; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 65 | const [members, invites, workspace, outside, teams, free] = await Promise.all([ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 66 | identity.listMembers(params.owner, viewer), |
| 67 | owner ? identity.workspaceInvites(params.owner, viewer).catch(() => null) : null, | |
| 68 | identity.getWorkspace(params.owner), | |
| 69 | owner ? identity.outsideCollaborators(viewer, params.owner).catch(() => null) : null, | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 70 | // Each member's teams, as the viewer may see them. |
| 71 | identity.teamMemberships(viewer, params.owner).catch(() => null), | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 72 | // A free workspace adds no one until it starts the plan; identity |
| 73 | // refuses it either way, so a failure here only hides the note. | |
| 74 | billing.freeWorkspaces([params.owner]).catch(() => [] as string[]), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 75 | ]); |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 76 | return { |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 77 | role, |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 78 | free: free.includes(params.owner.toLowerCase()), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 79 | members: unwrap(members), |
| 80 | invites: invites?.ok ? invites.value : [], | |
| 81 | base: workspace?.basePermission ?? DEFAULT_BASE_PERMISSION, | |
| 82 | outside: outside?.ok ? outside.value : [], | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 83 | teams: Object.fromEntries((teams?.ok ? teams.value : []).map((person) => [person.username, person.teams])), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 84 | origin: new URL(request.url).origin, |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 85 | me: viewer?.username ?? null, |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 86 | }; |
| 87 | } | |
| 88 | ||
| 89 | export async function action({ request, params, context }: Route.ActionArgs) { | |
| 90 | assertSameOrigin(request); | |
| 91 | const user = requireUser(context, request); | |
| 92 | const form = await request.formData(); | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 93 | if (form.get("action") === "revoke-invite") { |
| 94 | const result = await identity.revokeWorkspaceInvite(user, params.owner, String(form.get("id") ?? "")); | |
| 95 | return result.ok ? null : { error: result.error.message }; | |
| 96 | } | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 97 | const target = String(form.get("member") ?? "").trim(); |
| 98 | // Owner or member, and the roles that add to a member. | |
| 99 | if (form.get("action") === "role") { | |
| 100 | const role = form.get("role") === "owner" ? "owner" : "member"; | |
| 101 | const result = await identity.updateMember(user, params.owner, target, { role }); | |
| 102 | return result.ok ? { changed: target } : { error: result.error.message, row: target }; | |
| 103 | } | |
| 104 | if (form.get("action") === "org-roles") { | |
| 105 | const roles = String(form.get("org_roles") ?? "") | |
| 106 | .split(",") | |
| 107 | .filter((role): role is OrgRole => (ORG_ROLES as readonly string[]).includes(role)); | |
| 108 | const result = await identity.updateMember(user, params.owner, target, { org_roles: roles }); | |
| 109 | return result.ok ? { changed: target } : { error: result.error.message, row: target }; | |
| 110 | } | |
| 111 | if (form.get("action") === "transfer") { | |
| 112 | const result = await identity.transferOwnership(user, params.owner, target); | |
| 113 | return result.ok ? { transferred: target } : { error: result.error.message, row: target }; | |
| 114 | } | |
| 115 | if (form.get("action") === "leave") { | |
| 116 | const result = await identity.leaveWorkspace(user, params.owner); | |
| 117 | if (!result.ok) return { error: result.error.message, leaving: true }; | |
| 118 | const secure = new URL(request.url).protocol === "https:"; | |
| 119 | throw redirect("/", { headers: { "Set-Cookie": forgetWorkspace(secure) } }); | |
| 120 | } | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 121 | if (form.get("action") === "base-permission") { |
| 122 | const base = String(form.get("base") ?? ""); | |
| 123 | if (!(BASE_PERMISSIONS as readonly string[]).includes(base)) return { error: "Choose a base permission." }; | |
| 124 | const result = await identity.setBasePermission(user, params.owner, base as BasePermission); | |
| 125 | return result.ok ? { based: result.value } : { error: result.error.message, base: true }; | |
| 126 | } | |
| 127 | const member = String(form.get("member") ?? "").trim(); | |
| 128 | // An address is invited by email; a username is added at once. | |
| 129 | if (form.get("action") !== "remove" && member.includes("@")) { | |
| 130 | const result = await identity.inviteMember(user, params.owner, member); | |
| 131 | return result.ok ? { invited: result.value.email, outOfInvites: false } : { error: result.error.message, outOfInvites: result.error.code === "limit" }; | |
| 132 | } | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 133 | const result = |
| 134 | form.get("action") === "remove" | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 135 | ? await identity.removeMember(user, params.owner, member) |
| 136 | : await identity.addMember(user, params.owner, member); | |
| 137 | if (!result.ok) return { error: result.error.message, converting: form.get("action") === "convert" }; | |
| 138 | return form.get("action") === "convert" ? { converted: member } : null; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 139 | } |
| 140 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 141 | /** What the base permission means for members, in a sentence. */ |
| 142 | const BASE_MEANS: Record<BasePermission, string> = { | |
| 143 | none: "Members see only public repositories and the ones they are given a role on.", | |
| 144 | read: "Members can see and clone every repository, open issues and pull requests, and comment.", | |
| 145 | write: "Members can see every repository, manage its issues and pull requests, push, merge, and put agents to work.", | |
| 146 | admin: "Members can do everything on every repository, including its settings, webhooks, secrets and who has access. Only owners transfer or delete one.", | |
| 147 | }; | |
| 148 | ||
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 149 | /** What a member's roles say about them, as badges: owner or member, then the roles on top. */ |
| 150 | function RoleBadges({ member }: { member: Member }) { | |
| 151 | return ( | |
| 152 | <span className="flex flex-wrap justify-end gap-1"> | |
| 153 | {member.role === "owner" ? <Badge tone="accent">Owner</Badge> : <Badge>Member</Badge>} | |
| 154 | {(member.org_roles ?? []).map((role) => ( | |
| 155 | <Hint key={role} label={ORG_ROLE_SUMMARIES[role]}> | |
| 156 | <Badge tone="info" tabIndex={0}> | |
| 157 | {ORG_ROLE_LABELS[role]} | |
| 158 | </Badge> | |
| 159 | </Hint> | |
| 160 | ))} | |
| 161 | </span> | |
| 162 | ); | |
| 163 | } | |
| 164 | ||
| 165 | /** Whether a member has two-factor authentication on, for owners. */ | |
| 166 | function TwoFactorMark({ on }: { on: boolean | null | undefined }) { | |
| 167 | if (on == null) return null; | |
| 168 | return on ? ( | |
| 169 | <Hint label="Two-factor authentication is on"> | |
| 170 | <span tabIndex={0} className="inline-flex text-success" aria-label="Two-factor authentication on"> | |
| 171 | <ShieldCheck size={15} /> | |
| 172 | </span> | |
| 173 | </Hint> | |
| 174 | ) : ( | |
| 175 | <Hint label="Two-factor authentication is off"> | |
| 176 | <span tabIndex={0} className="inline-flex text-warn" aria-label="Two-factor authentication off"> | |
| 177 | <ShieldAlert size={15} /> | |
| 178 | </span> | |
| 179 | </Hint> | |
| 180 | ); | |
| 181 | } | |
| 182 | ||
| 183 | /** An owner's menu for one member: their role, the roles on top, handing over and removing. */ | |
| 184 | function MemberMenu({ member, self, owners, slug }: { member: Member; self: boolean; owners: number; slug: string }) { | |
| 185 | const submit = useSubmit(); | |
| 186 | const [confirm, setConfirm] = useState<"transfer" | "remove" | null>(null); | |
| 187 | const roles = member.org_roles ?? []; | |
| 188 | const post = (fields: Record<string, string>) => | |
| 189 | submit({ ...fields, member: member.username }, { method: "post", preventScrollReset: true }); | |
| 190 | const lastOwner = member.role === "owner" && owners <= 1; | |
| 191 | return ( | |
| 192 | <> | |
| 193 | <DropdownMenu> | |
| 194 | <DropdownMenuTrigger asChild> | |
| 195 | <button | |
| 196 | type="button" | |
| 197 | aria-label={`Manage ${member.username}`} | |
| 198 | className="rounded-md p-1.5 text-faint transition-colors hover:bg-raised hover:text-fg" | |
| 199 | > | |
| 200 | <Ellipsis size={16} /> | |
| 201 | </button> | |
| 202 | </DropdownMenuTrigger> | |
| 203 | <DropdownMenuContent align="end" className="w-64"> | |
| 204 | <DropdownMenuLabel>Role in {slug}</DropdownMenuLabel> | |
| 205 | {member.role === "member" ? ( | |
| 206 | <DropdownMenuItem onSelect={() => post({ action: "role", role: "owner" })}>Make owner</DropdownMenuItem> | |
| 207 | ) : ( | |
| 208 | <DropdownMenuItem disabled={lastOwner} onSelect={() => post({ action: "role", role: "member" })}> | |
| 209 | {lastOwner ? "The only owner" : "Make member"} | |
| 210 | </DropdownMenuItem> | |
| 211 | )} | |
| 212 | <DropdownMenuSeparator /> | |
| 213 | <DropdownMenuLabel>Also</DropdownMenuLabel> | |
| 214 | {ORG_ROLES.map((role) => { | |
| 215 | const has = roles.includes(role); | |
| 216 | const next = has ? roles.filter((other) => other !== role) : [...roles, role]; | |
| 217 | return ( | |
| 218 | <DropdownMenuItem key={role} onSelect={() => post({ action: "org-roles", org_roles: next.join(",") })}> | |
| 219 | <span className="flex size-4 items-center justify-center">{has && <Check />}</span> | |
| 220 | {ORG_ROLE_LABELS[role]} | |
| 221 | </DropdownMenuItem> | |
| 222 | ); | |
| 223 | })} | |
| 224 | {!self && ( | |
| 225 | <> | |
| 226 | <DropdownMenuSeparator /> | |
| 227 | {member.role === "member" && ( | |
| 228 | <DropdownMenuItem onSelect={() => setConfirm("transfer")}>Transfer ownership…</DropdownMenuItem> | |
| 229 | )} | |
| 230 | <DropdownMenuItem disabled={lastOwner} onSelect={() => setConfirm("remove")} className="text-danger"> | |
| 231 | Remove from {slug}… | |
| 232 | </DropdownMenuItem> | |
| 233 | </> | |
| 234 | )} | |
| 235 | </DropdownMenuContent> | |
| 236 | </DropdownMenu> | |
| 237 | <AlertDialog open={confirm !== null} onOpenChange={(open) => !open && setConfirm(null)}> | |
| 238 | <AlertDialogContent> | |
| 239 | <Form method="post" className="grid gap-4" onSubmit={() => setConfirm(null)}> | |
| 240 | <input type="hidden" name="action" value={confirm === "transfer" ? "transfer" : "remove"} /> | |
| 241 | <input type="hidden" name="member" value={member.username} /> | |
| 242 | <AlertDialogHeader> | |
| 243 | <AlertDialogTitle> | |
| 244 | {confirm === "transfer" ? `Hand ${slug} to ${member.username}?` : `Remove ${member.username} from ${slug}?`} | |
| 245 | </AlertDialogTitle> | |
| 246 | <AlertDialogDescription> | |
| 247 | {confirm === "transfer" | |
| 248 | ? `${member.username} becomes an owner and you a member. Only an owner can make you an owner again.` | |
| 249 | : `Their roles on ${slug}'s repositories and their place in its teams go too. To keep them on a repository, add them back to it as an outside collaborator.`} | |
| 250 | </AlertDialogDescription> | |
| 251 | </AlertDialogHeader> | |
| 252 | <AlertDialogFooter> | |
| 253 | <AlertDialogCancel type="button">Cancel</AlertDialogCancel> | |
| 254 | <SubmitButton variant="danger" match={{ action: confirm ?? "", member: member.username }} pending="Working…"> | |
| 255 | {confirm === "transfer" ? "Transfer ownership" : "Remove"} | |
| 256 | </SubmitButton> | |
| 257 | </AlertDialogFooter> | |
| 258 | </Form> | |
| 259 | </AlertDialogContent> | |
| 260 | </AlertDialog> | |
| 261 | </> | |
| 262 | ); | |
| 263 | } | |
| 264 | ||
| 265 | /** Leaving the workspace, for anyone in it. */ | |
| 266 | function LeaveSection({ slug, soleOwner, error }: { slug: string; soleOwner: boolean; error: string | null }) { | |
| 267 | const [open, setOpen] = useState(false); | |
| 268 | return ( | |
| 269 | <section id="leave" className="mt-10 scroll-mt-20 border-t border-line pt-8"> | |
| 270 | <h2 className="font-medium">Leave {slug}</h2> | |
| 271 | <p className="mt-1 text-sm text-muted"> | |
| 272 | {soleOwner | |
| 273 | ? `You are ${slug}'s only owner. Make another member an owner first, or delete the workspace in its settings.` | |
| 274 | : "Your roles on its repositories and your place in its teams go too. An owner can add you again."} | |
| 275 | </p> | |
| 276 | <div className="mt-4"> | |
| 277 | <Button variant="danger" type="button" disabled={soleOwner} onClick={() => setOpen(true)}> | |
| 278 | Leave {slug} | |
| 279 | </Button> | |
| 280 | </div> | |
| 281 | <ErrorText>{error}</ErrorText> | |
| 282 | <AlertDialog open={open} onOpenChange={setOpen}> | |
| 283 | <AlertDialogContent> | |
| 284 | <Form method="post" className="grid gap-4"> | |
| 285 | <input type="hidden" name="action" value="leave" /> | |
| 286 | <AlertDialogHeader> | |
| 287 | <AlertDialogTitle>Leave {slug}?</AlertDialogTitle> | |
| 288 | <AlertDialogDescription>You lose access to its private repositories at once.</AlertDialogDescription> | |
| 289 | </AlertDialogHeader> | |
| 290 | <AlertDialogFooter> | |
| 291 | <AlertDialogCancel type="button">Cancel</AlertDialogCancel> | |
| 292 | <SubmitButton variant="danger" match={{ action: "leave" }} pending="Leaving…"> | |
| 293 | Leave | |
| 294 | </SubmitButton> | |
| 295 | </AlertDialogFooter> | |
| 296 | </Form> | |
| 297 | </AlertDialogContent> | |
| 298 | </AlertDialog> | |
| 299 | </section> | |
| 300 | ); | |
| 301 | } | |
| 302 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 303 | export default function WorkspacePeople({ loaderData, actionData, params }: Route.ComponentProps) { |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 304 | const { role, members, invites, origin, base, outside, teams, free, me } = loaderData; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 305 | const owner = role === "owner"; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 306 | const owners = members.filter((member) => member.role === "owner").length; |
| 307 | const rowError = (username: string) => | |
| 308 | actionData && "row" in actionData && actionData.row === username ? (actionData.error ?? null) : null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 309 | const pending = invites.filter((invite) => invite.status === "pending"); |
| 310 | const [search, setSearch] = useSearchParams(); | |
| 311 | const tab = search.get("tab") === "outside" && owner ? "outside" : "members"; | |
| 312 | const membersTab = ( | |
| 313 | <> | |
| A catalogue of model providers, and settings that feel like settings | 314 | <ul className="divide-y divide-line rounded-xl border border-line"> |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 315 | {members.map((member) => ( |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 316 | <li key={member.username} className="flex flex-wrap items-center gap-3 px-4 py-3"> |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 317 | <Avatar name={member.username} image={member.avatar} size={28} /> |
| 318 | <div className="min-w-0 grow truncate"> | |
| 319 | <Link to={`/u/${member.username}`} className="font-mono text-sm hover:text-accent"> | |
| 320 | {member.username} | |
| 321 | </Link> | |
| 322 | {member.name && <span className="ml-2 hidden text-sm text-muted sm:inline">{member.name}</span>} | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 323 | {(teams[member.username] ?? []).length > 0 && ( |
| 324 | <div className="mt-1 flex flex-wrap gap-1"> | |
| 325 | {(teams[member.username] ?? []).slice(0, 3).map((team) => ( | |
| 326 | <Link | |
| 327 | key={team.slug} | |
| 328 | to={`/${params.owner}/-/teams/${team.slug}`} | |
| 329 | className="rounded-full border border-line px-2 py-px text-xs text-muted transition-colors hover:border-line-strong hover:text-fg" | |
| 330 | > | |
| 331 | {team.name} | |
| 332 | </Link> | |
| 333 | ))} | |
| 334 | {(teams[member.username] ?? []).length > 3 && ( | |
| 335 | <span className="px-1 text-xs text-faint">+{(teams[member.username] ?? []).length - 3} more</span> | |
| 336 | )} | |
| 337 | </div> | |
| 338 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 339 | </div> |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 340 | {/* Together, so on a narrow screen they move under the name as one. */} |
| 341 | <div className="ml-auto flex items-center gap-2"> | |
| 342 | {owner && <TwoFactorMark on={member.two_factor} />} | |
| 343 | <RoleBadges member={member} /> | |
| 344 | {owner && <MemberMenu member={member} self={member.username === me} owners={owners} slug={params.owner} />} | |
| 345 | </div> | |
| 346 | {rowError(member.username) && ( | |
| 347 | <p className="basis-full text-sm text-danger" role="alert"> | |
| 348 | {rowError(member.username)} | |
| 349 | </p> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 350 | )} |
| 351 | </li> | |
| 352 | ))} | |
| 353 | </ul> | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 354 | {owner && free && ( |
| 355 | <div className="mt-6"> | |
| 356 | <StartPlanToInvite workspace={params.owner} owner={owner} /> | |
| 357 | </div> | |
| 358 | )} | |
| 359 | {owner && !free && ( | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 360 | // Empty again once the person is on the list; kept as typed when it failed. |
| 361 | <Form | |
| 362 | method="post" | |
| 363 | key={`${members.length}:${pending.length}`} | |
| 364 | className="mt-6 flex flex-col gap-3 sm:flex-row sm:items-start" | |
| 365 | > | |
| 366 | <input type="hidden" name="action" value="add" /> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 367 | <div className="grow"> |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 368 | <Field |
| 369 | label="Add a member" | |
| 370 | hint="A g1t username joins at once, as a member. An email address gets an invite: without a g1t account, it makes one and joins in one step, using one of your invites." | |
| 371 | > | |
| 372 | <Input name="member" required maxLength={254} placeholder="username or name@example.com" /> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 373 | </Field> |
| 374 | </div> | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 375 | <div className="sm:pt-[1.625rem]"> |
| Merge branch 'worktree-agent-a985c01f43538af01' | 376 | <SubmitButton match={{ action: "add" }} pending="Adding…"> |
| 377 | Add | |
| 378 | </SubmitButton> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 379 | </div> |
| 380 | </Form> | |
| 381 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 382 | {actionData && "invited" in actionData && actionData.invited && ( |
| 383 | <p className="text-sm text-muted" role="status"> | |
| 384 | Invite sent to <span className="text-fg">{actionData.invited}</span>. | |
| 385 | </p> | |
| 386 | )} | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 387 | {actionData && "transferred" in actionData && ( |
| 388 | <p className="text-sm text-muted" role="status"> | |
| 389 | <span className="font-mono text-fg">{actionData.transferred}</span> owns {params.owner} now, and you are a member. | |
| 390 | </p> | |
| 391 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 392 | {actionData && "converted" in actionData && ( |
| 393 | <p className="text-sm text-muted" role="status"> | |
| 394 | <span className="font-mono text-fg">{actionData.converted}</span> is now a member of {params.owner}. | |
| 395 | </p> | |
| 396 | )} | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 397 | {actionData && |
| 398 | !("base" in actionData) && | |
| 399 | !("row" in actionData) && | |
| 400 | !("leaving" in actionData) && | |
| 401 | !("converting" in actionData && actionData.converting) && ( | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 402 | <ErrorText>{actionData && "error" in actionData ? actionData.error : null}</ErrorText> |
| 403 | )} | |
| 404 | {actionData && "outOfInvites" in actionData && actionData.outOfInvites && ( | |
| 405 | <p className="mt-1 text-sm text-muted"> | |
| 406 | <a href={moreInvitesMailto(params.owner)} className="text-accent underline underline-offset-4"> | |
| 407 | Ask for more invites | |
| 408 | </a>{" "} | |
| 409 | for {params.owner}. | |
| 410 | </p> | |
| 411 | )} | |
| 412 | ||
| 413 | {owner && pending.length > 0 && ( | |
| 414 | <section className="mt-8"> | |
| 415 | <h2 className="text-sm font-medium">Pending invites</h2> | |
| 416 | <ul className="mt-3 divide-y divide-line rounded-xl border border-line"> | |
| 417 | {pending.map((invite) => ( | |
| 418 | <li key={invite.id} className="space-y-2 px-4 py-3"> | |
| 419 | <div className="flex flex-wrap items-center gap-3"> | |
| 420 | <span className="min-w-0 grow truncate text-sm">{invite.email}</span> | |
| 421 | <Pill>{inviteState(invite).label}</Pill> | |
| 422 | <Form method="post"> | |
| 423 | <input type="hidden" name="action" value="revoke-invite" /> | |
| 424 | <input type="hidden" name="id" value={invite.id} /> | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 425 | <SubmitButton variant="quiet" match={{ action: "revoke-invite", id: invite.id }} pending="Revoking…"> |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 426 | Revoke |
| Merge branch 'worktree-agent-a985c01f43538af01' | 427 | </SubmitButton> |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 428 | </Form> |
| 429 | </div> | |
| 430 | <p className="text-xs text-faint"> | |
| 431 | By {invite.invitedBy ?? "g1t"} · <TimeAgo at={invite.createdAt} /> | |
| 432 | </p> | |
| 433 | {invite.code && <CopyLine text={inviteLink(invite.code, origin)} />} | |
| 434 | </li> | |
| 435 | ))} | |
| 436 | </ul> | |
| 437 | </section> | |
| 438 | )} | |
| 439 | ||
| 440 | <BasePermissionSection | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 441 | // Starts from the saved choice whenever it changes. |
| 442 | key={base} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 443 | base={base} |
| 444 | owner={owner} | |
| 445 | slug={params.owner} | |
| 446 | error={actionData && "base" in actionData && "error" in actionData ? (actionData.error ?? null) : null} | |
| 447 | saved={Boolean(actionData && "based" in actionData)} | |
| 448 | /> | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 449 | |
| 450 | <LeaveSection | |
| 451 | slug={params.owner} | |
| 452 | soleOwner={owner && owners <= 1} | |
| 453 | error={actionData && "leaving" in actionData ? (actionData.error ?? null) : null} | |
| 454 | /> | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 455 | </> |
| 456 | ); | |
| 457 | return ( | |
| 458 | <div className="max-w-2xl"> | |
| 459 | {owner ? ( | |
| 460 | <Tabs | |
| 461 | value={tab} | |
| 462 | onValueChange={(value) => { | |
| 463 | const next = new URLSearchParams(search); | |
| 464 | if (value === "outside") next.set("tab", "outside"); | |
| 465 | else next.delete("tab"); | |
| 466 | setSearch(next, { replace: true, preventScrollReset: true }); | |
| 467 | }} | |
| 468 | > | |
| 469 | <TabsList className="mb-3"> | |
| 470 | <TabsTrigger value="members">Members · {members.length}</TabsTrigger> | |
| 471 | <TabsTrigger value="outside">Outside collaborators · {outside.length}</TabsTrigger> | |
| 472 | </TabsList> | |
| 473 | <TabsContent value="members">{membersTab}</TabsContent> | |
| 474 | <TabsContent value="outside"> | |
| 475 | <OutsideCollaborators | |
| 476 | people={outside} | |
| 477 | slug={params.owner} | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 478 | free={free} |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 479 | error={actionData && "converting" in actionData && actionData.converting ? actionData.error : null} |
| 480 | /> | |
| 481 | </TabsContent> | |
| 482 | </Tabs> | |
| 483 | ) : ( | |
| 484 | membersTab | |
| 485 | )} | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 486 | </div> |
| 487 | ); | |
| 488 | } | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 489 | |
| 490 | /** What members get on every repository, which owners choose. */ | |
| 491 | function BasePermissionSection({ | |
| 492 | base, | |
| 493 | owner, | |
| 494 | slug, | |
| 495 | error, | |
| 496 | saved, | |
| 497 | }: { | |
| 498 | base: BasePermission; | |
| 499 | owner: boolean; | |
| 500 | slug: string; | |
| 501 | error: string | null; | |
| 502 | saved: boolean; | |
| 503 | }) { | |
| 504 | const [chosen, setChosen] = useState<BasePermission>(base); | |
| 505 | return ( | |
| 506 | <section id="base-permission" className="mt-10 scroll-mt-20 border-t border-line pt-8"> | |
| 507 | <h2 className="font-medium">Base permission</h2> | |
| 508 | <p className="mt-1 text-sm text-muted"> | |
| 509 | The role every member has on each of {slug}'s repositories. Owners are Admins on all of them, and a role given to | |
| 510 | someone on one repository adds to this; it never takes away. | |
| 511 | </p> | |
| 512 | {owner ? ( | |
| 513 | <Form method="post" className="mt-4 rounded-xl border border-line bg-surface p-4"> | |
| 514 | <input type="hidden" name="action" value="base-permission" /> | |
| 515 | <div className="flex flex-col gap-3 sm:flex-row sm:items-center"> | |
| 516 | <Select name="base" value={chosen} onValueChange={(value) => setChosen(value as BasePermission)}> | |
| 517 | <SelectTrigger aria-label="Base permission" className="sm:max-w-48"> | |
| 518 | <SelectValue /> | |
| 519 | </SelectTrigger> | |
| 520 | <SelectContent> | |
| 521 | {BASE_PERMISSIONS.map((value) => ( | |
| 522 | <SelectItem key={value} value={value} description={BASE_MEANS[value]}> | |
| 523 | {BASE_PERMISSION_LABELS[value]} | |
| 524 | </SelectItem> | |
| 525 | ))} | |
| 526 | </SelectContent> | |
| 527 | </Select> | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 528 | <SubmitButton variant="quiet" match={{ action: "base-permission" }} pending="Saving…" disabled={chosen === base}> |
| 529 | Save | |
| 530 | </SubmitButton> | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 531 | {saved && chosen === base && <span className="text-sm text-muted">Saved.</span>} |
| 532 | </div> | |
| 533 | <p className="mt-3 text-sm text-muted">{BASE_MEANS[chosen]}</p> | |
| 534 | <ErrorText>{error}</ErrorText> | |
| 535 | </Form> | |
| 536 | ) : ( | |
| 537 | <div className="mt-4 rounded-xl border border-line bg-surface p-4 text-sm"> | |
| 538 | <p> | |
| 539 | <span className="font-medium">{BASE_PERMISSION_LABELS[base]}.</span>{" "} | |
| 540 | <span className="text-muted">{BASE_MEANS[base]}</span> | |
| 541 | </p> | |
| 542 | <p className="mt-2 text-xs text-faint">Owners of the workspace choose it.</p> | |
| 543 | </div> | |
| 544 | )} | |
| 545 | </section> | |
| 546 | ); | |
| 547 | } | |
| 548 | ||
| 549 | /** People with a role on some of the workspace's repositories who are not members of it. */ | |
| 550 | function OutsideCollaborators({ | |
| 551 | people, | |
| 552 | slug, | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 553 | free, |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 554 | error, |
| 555 | }: { | |
| 556 | people: Route.ComponentProps["loaderData"]["outside"]; | |
| 557 | slug: string; | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 558 | free: boolean; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 559 | error: string | null | undefined; |
| 560 | }) { | |
| 561 | return ( | |
| 562 | <> | |
| 563 | <p className="mb-4 text-sm text-muted"> | |
| 564 | People given a role on one or more of {slug}'s repositories without being members. They see only those | |
| 565 | repositories. Change or take away a role on the repository's Access settings. | |
| 566 | </p> | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 567 | {free && ( |
| 568 | <div className="mb-4"> | |
| 569 | <StartPlanToInvite workspace={slug} owner /> | |
| 570 | </div> | |
| 571 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 572 | {people.length === 0 ? ( |
| 573 | <div className="rounded-xl border border-dashed border-line px-6 py-10 text-center"> | |
| 574 | <Users size={18} className="mx-auto text-faint" /> | |
| 575 | <p className="mt-2 text-sm font-medium">No outside collaborators</p> | |
| 576 | <p className="mt-1 text-sm text-muted">Add someone to a single repository from its Settings → Access.</p> | |
| 577 | </div> | |
| 578 | ) : ( | |
| 579 | <ul className="divide-y divide-line rounded-xl border border-line"> | |
| 580 | {people.map((person) => ( | |
| 581 | <li key={person.username} className="px-4 py-3"> | |
| 582 | <div className="flex flex-wrap items-center gap-x-3 gap-y-2"> | |
| 583 | <Avatar name={person.username} image={person.avatar} size={28} /> | |
| 584 | <div className="min-w-0 grow basis-32"> | |
| 585 | <Link to={`/u/${person.username}`} className="font-mono text-sm hover:text-accent"> | |
| 586 | {person.username} | |
| 587 | </Link> | |
| 588 | {person.name && <span className="ml-2 text-sm text-muted">{person.name}</span>} | |
| 589 | </div> | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 590 | {!free && ( |
| 591 | <Form method="post"> | |
| 592 | <input type="hidden" name="action" value="convert" /> | |
| 593 | <input type="hidden" name="member" value={person.username} /> | |
| 594 | <SubmitButton variant="quiet" match={{ action: "convert", member: person.username }} pending="Converting…"> | |
| 595 | Convert to member | |
| 596 | </SubmitButton> | |
| 597 | </Form> | |
| 598 | )} | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 599 | </div> |
| 600 | <ul className="mt-2 flex flex-wrap gap-1.5 pl-10"> | |
| 601 | {person.repos.map((grant) => ( | |
| 602 | <li key={grant.repo}> | |
| 603 | <Link | |
| 604 | to={`/${grant.repo}/settings/access`} | |
| 605 | className="group inline-flex items-center gap-1.5 rounded-full border border-line px-2 py-0.5 text-xs transition-colors hover:border-line-strong hover:bg-surface" | |
| 606 | > | |
| 607 | <span className="font-mono text-fg/90">{grant.repo}</span> | |
| 608 | <span className="text-muted">{REPO_ROLE_LABELS[grant.role]}</span> | |
| 609 | <ArrowUpRight size={11} className="text-faint group-hover:text-fg" /> | |
| 610 | </Link> | |
| 611 | </li> | |
| 612 | ))} | |
| 613 | </ul> | |
| 614 | </li> | |
| 615 | ))} | |
| 616 | </ul> | |
| 617 | )} | |
| 618 | <ErrorText>{error}</ErrorText> | |
| 619 | </> | |
| 620 | ); | |
| 621 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.