Files
cobble/src/components/general/google-auth-button.tsx
T
tbenandClaude Opus 5.5 694c83346f Make Cobble a local install: setup flow, bots-first admin, settings
Local, password-only auth:
- No public pages; everything outside /admin and /auth redirects in
- First run (no users) sends every page to /auth/signup, which creates
  the super admin (user #1) once and then locks
- Login is email/username + password; removed the emailed-code flow,
  /auth/sso and email password reset
- Google login kept for existing accounts only, never creates them
- seed-super-admin now requires SEED_SUPER_ADMIN_PASSWORD

Bots-first admin:
- /admin and closed sections (people, logs, backups) redirect to
  /admin/bots; only bots and settings are live (AdminSections)
- Removed the old admin layout; every /admin page uses the bots rail
- Coordinator bot created at signup/seed and by /admin/bots
  (ensureCoordinatorBot), which redirects to its chat
- bots.system_prompt (markdown) with a default coordinator prompt
- seed-bots reuses the existing coordinator

Settings:
- Sub pages general (default), profile, change-password, listed in the
  rail with a back link; unknown settings paths redirect to general
- Redesigned settings UI: pane header, grouped rows, sticky save bar
- General: System/Light/Dark theme, saved per device

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 17:49:25 +01:00

61 lines
2.0 KiB
TypeScript

import Button from "@moduletrace/twui/layout/Button";
import Img from "@moduletrace/twui/layout/Img";
import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import type useFormInit from "@/src/hooks/use-form-init";
import { twMerge } from "tailwind-merge";
import useGoogleAuth from "@/src/hooks/use-google-auth";
type Props = Pick<
ReturnType<typeof useFormInit>,
"loading" | "setLoading" | "setStatus"
>;
/**
* Themed button with Google's own (transparent) button laid over it. Once
* Google's button is ready it takes keyboard focus and clicks, and the
* themed button below is hidden from assistive tech.
*/
export default function GoogleAuthButton({
loading,
setLoading,
setStatus,
}: Props) {
const { handleButtonClick, googleButtonRef, googleReady } = useGoogleAuth({
loading,
setLoading,
setStatus,
});
const overlayActive = googleReady && !loading;
const label = "Log in with Google";
return (
<Row className="w-full relative justify-center rounded-default focus-within:ring-2 focus-within:ring-primary/70">
<Button
title={label}
type="button"
variant="outlined"
color="gray"
className="w-full py-3 relative"
disabled={loading}
onClick={handleButtonClick}
tabIndex={overlayActive ? -1 : undefined}
aria-hidden={overlayActive || undefined}
>
<Img alt="" src={`/icons/google.png`} size={17} />
<Span>{label}</Span>
</Button>
<div
ref={googleButtonRef}
className={twMerge(
"absolute inset-0 z-10 opacity-0",
overlayActive
? "pointer-events-auto"
: "pointer-events-none",
)}
/>
</Row>
);
}