Skip to content
83 linesCodeBlameRaw

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 workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)1import { Link } from "react-router";
2
3import type { Route } from "./+types/invitations";
4import { InvitationList } from "../components/invitation-list";
5import { answerInvitation, loadInvitations } from "../lib/invitations.server";
6import { declinedLine } from "../lib/invitations";
7import { page } from "../lib/meta";
8import { assertSameOrigin, nextPath, requireUser } from "../lib/session.server";
The site is built from its shared components: one Button with its variants and sizes, one Badge, Card for every panel, Alert for notices, Kbd for keys, Table for the security tables, and Avatar, Command, Progress, ScrollArea, ToggleGroup, Collapsible and Accordion in the kit; raw buttons, hand-drawn cards and pills and per-file button class lists are gone, outline buttons stand the same height as filled ones, and the phone's Ask g1t loses its tile. Every page was compared pixel by pixel before and after.9import { Card } from "../components/ui/card";
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)10
11export function meta(args: Route.MetaArgs) {
12 return page(args, { title: "Invitations · g1t" });
13}
14
15/**
16 * The workspace invitations waiting for the signed-in person's answer.
17 * Nobody joins a workspace without saying yes here (or on the invite's own
18 * page). Linked from the inbox item and the invitation email.
19 */
20export async function loader({ request, context }: Route.LoaderArgs) {
21 const user = requireUser(context, request);
22 const next = nextPath(request);
23 return {
24 invitations: await loadInvitations(user),
25 hasWorkspace: (user.workspaces ?? []).length > 0,
26 next: next === "/" ? null : next,
27 };
28}
29
30export async function action({ request, context }: Route.ActionArgs) {
31 assertSameOrigin(request);
32 const user = requireUser(context, request);
33 return (await answerInvitation(user, await request.formData(), request)) ?? null;
34}
35
36export default function Invitations({ loaderData, actionData }: Route.ComponentProps) {
37 const { invitations, hasWorkspace, next } = loaderData;
38 return (
39 <main className="mx-auto max-w-2xl px-4 py-12">
40 <h1 className="text-xl font-semibold">Invitations</h1>
41 <p className="mt-2 text-sm text-muted">
42 Workspaces you are invited to join. You join one only when you accept; declining tells whoever invited you.
43 </p>
44 {actionData?.declined !== undefined && (
45 <p className="mt-4 text-sm text-muted" role="status">
46 {declinedLine(actionData.declined)}
47 </p>
48 )}
49 <div className="mt-6">
50 {invitations.length > 0 ? (
51 <InvitationList
52 invitations={invitations}
53 error={actionData?.invitationError}
54 errorFor={actionData?.invitationId}
55 next={next}
56 />
57 ) : (
The site is built from its shared components: one Button with its variants and sizes, one Badge, Card for every panel, Alert for notices, Kbd for keys, Table for the security tables, and Avatar, Command, Progress, ScrollArea, ToggleGroup, Collapsible and Accordion in the kit; raw buttons, hand-drawn cards and pills and per-file button class lists are gone, outline buttons stand the same height as filled ones, and the phone's Ask g1t loses its tile. Every page was compared pixel by pixel before and after.58 <Card tone="plain" className="border-dashed px-6 py-10 text-center">
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)59 <p className="text-sm font-medium">No invitations waiting</p>
60 <p className="mt-1 text-sm text-muted">
61 {hasWorkspace ? (
62 <>
63 When someone invites you to a workspace, it shows here and in your{" "}
g1t is described as the product it is in alpha, and its shell takes the new shape: the README, the docs home and docs/PLAN.md label every feature Live, Preview or Coming; a floating dock with the g1t mark, Today, Chat, Notifications, Agents, Code, Artifacts, your pinned apps and the Apps launcher, with People, Workspace and the account menu (now holding help) at its foot; the workspace's logo and switcher heading a flat sidebar that folds away with Ctrl B, or leading the header's breadcrumbs where there is none; the page in a rounded panel with a full-width header; Today as the front page, with first-time acceptance of agents' pull requests, what needs you and what's at stake, spend today and one item to start with, every number from a service; Notifications in place of the Inbox at /notifications; a bottom bar and More sheet on phones; and sign-in, sign-up, two-factor, reset, invites and choosing a workspace on standalone pages with no app around them.64 <Link to="/notifications" className="underline underline-offset-4 hover:text-fg">
65 notifications
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)66 </Link>
67 .
68 </>
69 ) : (
70 <>
71 <Link to="/workspaces/new" className="underline underline-offset-4 hover:text-fg">
72 Create your workspace
73 </Link>
74 , or ask a workspace's owners to invite you by your username.
75 </>
76 )}
77 </p>
The site is built from its shared components: one Button with its variants and sizes, one Badge, Card for every panel, Alert for notices, Kbd for keys, Table for the security tables, and Avatar, Command, Progress, ScrollArea, ToggleGroup, Collapsible and Accordion in the kit; raw buttons, hand-drawn cards and pills and per-file button class lists are gone, outline buttons stand the same height as filled ones, and the phone's Ask g1t loses its tile. Every page was compared pixel by pixel before and after.78 </Card>
Merge workspace invitations: nobody joins a workspace without saying yes, people are found by username, your own invites can bring someone in, and nobody is left without a workspace (identity 0040)79 )}
80 </div>
81 </main>
82 );
83}

This file's history is long; its oldest lines are credited to the oldest commit read.