| 1 | import { useRouteLoaderData } from "react-router"; |
| 2 | |
| 3 | import { signUpCopy } from "./invites"; |
| 4 | |
| 5 | /** |
| 6 | * Whether g1t.sh is invite-only, from the root loader. Invite-only when the |
| 7 | * root loader has not answered: no page should offer an open sign-up that |
| 8 | * is not there. |
| 9 | */ |
| 10 | export function useInviteOnly(): boolean { |
| 11 | const root = useRouteLoaderData("root") as { inviteOnly?: boolean } | undefined; |
| 12 | return root?.inviteOnly ?? true; |
| 13 | } |
| 14 | |
| 15 | /** What the sign-up buttons say on this page. */ |
| 16 | export function useSignUpCopy() { |
| 17 | return signUpCopy(useInviteOnly()); |
| 18 | } |