"use client" /** * A configurable choice step: whichever question the active flow put here. * * Picking an app, picking a role, and anything else authored in the flow builder * are the same interaction with different words, so one component renders them * all from the step's data. Each option is its own button that commits on * activation, the way an account chooser works, rather than a radio group plus a * Continue. A chooser has no primary option by design: making one of several * peers look primary would be a recommendation nobody asked for, and the extra * confirm click only asks "are you sure" about a decision that is one click to * reverse. */ import * as React from "react" import { Button } from "@/components/ui/button" import { visibleOptions, type ChoiceOption, type ChoiceStep, type FlowRunContext, } from "@/lib/login-flow" export function LoginChoiceStep({ step, context, identifier, onChoose, onBack, }: { step: ChoiceStep context: FlowRunContext identifier: string onChoose: (option: ChoiceOption) => void onBack: () => void }) { const firstOptionRef = React.useRef(null) // An option whose condition fails is absent, not disabled. A greyed-out door is // an invitation to wonder what you did wrong on a screen with no way to ask. const options = visibleOptions(step, context) // The step swap replaces the whole form, so focus has to be placed or a // keyboard user restarts from the top of the document. React.useEffect(() => { firstOptionRef.current?.focus() }, [step.id]) return ( <>

{step.heading}

Signed in as {identifier}