({
isPrimary,
form,
}: {
isPrimary: boolean;
form: ReturnType<typeof useCreateOrganizationForm>;
})
| 250 | // --------------------------------------------------------------------------- |
| 251 | |
| 252 | const CreateOrgSection = ({ |
| 253 | isPrimary, |
| 254 | form, |
| 255 | }: { |
| 256 | isPrimary: boolean; |
| 257 | form: ReturnType<typeof useCreateOrganizationForm>; |
| 258 | }) => { |
| 259 | const [expanded, setExpanded] = useState(isPrimary); |
| 260 | |
| 261 | if (!isPrimary && !expanded) { |
| 262 | return ( |
| 263 | <div className="text-center text-xs text-muted-foreground"> |
| 264 | {/* oxlint-disable-next-line react/forbid-elements */} |
| 265 | <button |
| 266 | type="button" |
| 267 | onClick={() => setExpanded(true)} |
| 268 | className="underline-offset-4 transition-colors hover:text-foreground hover:underline" |
| 269 | > |
| 270 | Or create a new organization |
| 271 | </button> |
| 272 | </div> |
| 273 | ); |
| 274 | } |
| 275 | |
| 276 | return ( |
| 277 | <section aria-label="Create organization" className="flex flex-col gap-3"> |
| 278 | <CreateOrganizationFields |
| 279 | name={form.name} |
| 280 | onNameChange={(name) => { |
| 281 | form.setName(name); |
| 282 | if (form.error) form.setError(null); |
| 283 | }} |
| 284 | error={form.error} |
| 285 | onSubmit={() => void form.submit()} |
| 286 | /> |
| 287 | <div className="flex justify-end"> |
| 288 | <Button |
| 289 | size="sm" |
| 290 | onClick={() => void form.submit()} |
| 291 | disabled={!form.canSubmit || form.creating} |
| 292 | > |
| 293 | {form.creating ? "Creating…" : "Create organization"} |
| 294 | </Button> |
| 295 | </div> |
| 296 | </section> |
| 297 | ); |
| 298 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected