g1t/apps/web/app/components/profile-form.tsx
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.
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 1 | import { Check } from "lucide-react"; |
| 2 | import { useState } from "react"; | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 3 | import { Form, Link } from "react-router"; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 4 | |
| 5 | import { PROFILE_LIMITS, type Profile } from "@g1t/contracts"; | |
| 6 | ||
| Merge branch 'worktree-agent-a985c01f43538af01' | 7 | import { SubmitButton, usePending } from "./ui"; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 8 | import { Field, FieldDescription, FieldError, FieldLabel } from "./ui/field"; |
| 9 | import { Input } from "./ui/input"; | |
| 10 | import { Textarea } from "./ui/textarea"; | |
| 11 | ||
| 12 | /** | |
| 13 | * The Profile section of a person's settings: what everyone sees at | |
| 14 | * `/u/<username>`. Posts `intent=profile`; identity checks every field. | |
| 15 | */ | |
| 16 | export function ProfileSection({ | |
| 17 | username, | |
| 18 | profile, | |
| 19 | error, | |
| 20 | saved, | |
| 21 | }: { | |
| 22 | username: string; | |
| 23 | profile: Profile | null; | |
| 24 | error?: string; | |
| 25 | saved: boolean; | |
| 26 | }) { | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 27 | const busy = usePending({ intent: "profile" }); |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 28 | const [bio, setBio] = useState(profile?.bio ?? ""); |
| 29 | return ( | |
| 30 | <section id="profile" className="scroll-mt-20"> | |
| 31 | <div className="flex flex-wrap items-baseline justify-between gap-2"> | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 32 | <h2 className="font-medium">Public profile</h2> |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 33 | <Link to={`/u/${username}`} className="text-sm text-muted underline-offset-4 hover:text-fg hover:underline"> |
| 34 | View your profile | |
| 35 | </Link> | |
| 36 | </div> | |
| 37 | <p className="mt-1 text-sm text-muted"> | |
| 38 | Shown to everyone at <span className="font-mono text-fg">g1t.sh/u/{username}</span>. All of it is | |
| 39 | optional; your email address is never shown. | |
| 40 | </p> | |
| 41 | <Form method="post" className="mt-4 grid gap-4 sm:grid-cols-2"> | |
| 42 | <input type="hidden" name="intent" value="profile" /> | |
| 43 | <Field> | |
| 44 | <FieldLabel htmlFor="profile-name">Name</FieldLabel> | |
| 45 | <Input | |
| 46 | id="profile-name" | |
| 47 | name="name" | |
| 48 | defaultValue={profile?.name ?? ""} | |
| 49 | maxLength={PROFILE_LIMITS.name} | |
| 50 | placeholder={username} | |
| 51 | /> | |
| 52 | </Field> | |
| 53 | <Field> | |
| 54 | <FieldLabel htmlFor="profile-pronouns">Pronouns</FieldLabel> | |
| 55 | <Input | |
| 56 | id="profile-pronouns" | |
| 57 | name="pronouns" | |
| 58 | defaultValue={profile?.pronouns ?? ""} | |
| 59 | maxLength={PROFILE_LIMITS.pronouns} | |
| 60 | placeholder="they/them" | |
| 61 | /> | |
| 62 | </Field> | |
| 63 | <Field className="sm:col-span-2"> | |
| 64 | <FieldLabel htmlFor="profile-bio">Bio</FieldLabel> | |
| 65 | <Textarea | |
| 66 | id="profile-bio" | |
| 67 | name="bio" | |
| 68 | rows={2} | |
| 69 | value={bio} | |
| 70 | onChange={(event) => setBio(event.currentTarget.value)} | |
| 71 | maxLength={PROFILE_LIMITS.bio} | |
| 72 | placeholder="What you work on, in a line or two." | |
| 73 | /> | |
| 74 | <FieldDescription> | |
| 75 | {bio.length}/{PROFILE_LIMITS.bio} characters. Also what a link to your profile says. | |
| 76 | </FieldDescription> | |
| 77 | </Field> | |
| 78 | <Field> | |
| 79 | <FieldLabel htmlFor="profile-location">Location</FieldLabel> | |
| 80 | <Input | |
| 81 | id="profile-location" | |
| 82 | name="location" | |
| 83 | defaultValue={profile?.location ?? ""} | |
| 84 | maxLength={PROFILE_LIMITS.location} | |
| 85 | placeholder="Portland, Oregon" | |
| 86 | /> | |
| 87 | </Field> | |
| 88 | <Field> | |
| 89 | <FieldLabel htmlFor="profile-website">Website</FieldLabel> | |
| 90 | <Input | |
| 91 | id="profile-website" | |
| 92 | name="website" | |
| 93 | inputMode="url" | |
| 94 | defaultValue={profile?.website ?? ""} | |
| 95 | maxLength={PROFILE_LIMITS.website} | |
| 96 | placeholder="https://example.com" | |
| 97 | /> | |
| 98 | <FieldDescription>An https:// address.</FieldDescription> | |
| 99 | </Field> | |
| 100 | <div className="flex flex-wrap items-center gap-3 sm:col-span-2"> | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 101 | <SubmitButton pending="Saving…" match={{ intent: "profile" }}> |
| 102 | Save profile | |
| 103 | </SubmitButton> | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 104 | {saved && !busy && !error && ( |
| 105 | <span className="inline-flex items-center gap-1.5 text-sm text-muted"> | |
| 106 | <Check size={14} className="text-accent" /> | |
| 107 | Saved | |
| 108 | </span> | |
| 109 | )} | |
| 110 | <FieldError>{error}</FieldError> | |
| 111 | </div> | |
| 112 | </Form> | |
| 113 | </section> | |
| 114 | ); | |
| 115 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.