Update step-defaults.tsx

This commit is contained in:
Théo LAGACHE
2026-06-25 11:47:31 +02:00
parent 70a551f3e8
commit 45c82f9ef5
@@ -22,9 +22,12 @@ import { updateStorageSettingsAction } from "@/features/settings/actions/storage
export const StepDefaults = () => { export const StepDefaults = () => {
const { next, updateContext, state } = useOnboarding(); const { next, updateContext, state } = useOnboarding();
const notifiers = (state?.context.flowData.notifiers ?? []) as OnboardingChannel[]; const notifiers = (state?.context.flowData.notifiers ??
const storages = (state?.context.flowData.storages ?? []) as OnboardingChannel[]; []) as OnboardingChannel[];
const existingDefaults = (state?.context.flowData.defaults ?? {}) as OnboardingDefaultsData; const storages = (state?.context.flowData.storages ??
[]) as OnboardingChannel[];
const existingDefaults = (state?.context.flowData.defaults ??
{}) as OnboardingDefaultsData;
const [notifierId, setNotifierId] = useState<string | undefined>( const [notifierId, setNotifierId] = useState<string | undefined>(
existingDefaults.notifierId || undefined, existingDefaults.notifierId || undefined,
@@ -95,6 +98,7 @@ export const StepDefaults = () => {
</p> </p>
</div> </div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<Label>Default notifier</Label> <Label>Default notifier</Label>
<Select <Select
@@ -102,7 +106,7 @@ export const StepDefaults = () => {
onValueChange={selectNotifier} onValueChange={selectNotifier}
disabled={notifiers.length === 0} disabled={notifiers.length === 0}
> >
<SelectTrigger> <SelectTrigger className="w-full">
<SelectValue <SelectValue
placeholder={ placeholder={
notifiers.length === 0 notifiers.length === 0
@@ -129,7 +133,9 @@ export const StepDefaults = () => {
<div className="text-muted-foreground scale-90 shrink-0"> <div className="text-muted-foreground scale-90 shrink-0">
{getChannelIcon(n.provider)} {getChannelIcon(n.provider)}
</div> </div>
<span className="font-medium truncate min-w-0">{n.name}</span> <span className="font-medium truncate min-w-0">
{n.name}
</span>
<span className="text-xs text-muted-foreground ml-2 capitalize shrink-0"> <span className="text-xs text-muted-foreground ml-2 capitalize shrink-0">
({n.provider}) ({n.provider})
</span> </span>
@@ -147,7 +153,7 @@ export const StepDefaults = () => {
onValueChange={selectStorage} onValueChange={selectStorage}
disabled={storages.length === 0} disabled={storages.length === 0}
> >
<SelectTrigger> <SelectTrigger className="w-full">
<SelectValue <SelectValue
placeholder={ placeholder={
storages.length === 0 storages.length === 0
@@ -174,7 +180,9 @@ export const StepDefaults = () => {
<div className="text-muted-foreground scale-90 shrink-0"> <div className="text-muted-foreground scale-90 shrink-0">
{getChannelIcon(s.provider)} {getChannelIcon(s.provider)}
</div> </div>
<span className="font-medium truncate min-w-0">{s.name}</span> <span className="font-medium truncate min-w-0">
{s.name}
</span>
<span className="text-xs text-muted-foreground ml-2 capitalize shrink-0"> <span className="text-xs text-muted-foreground ml-2 capitalize shrink-0">
({s.provider}) ({s.provider})
</span> </span>
@@ -184,6 +192,7 @@ export const StepDefaults = () => {
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
</div>
<Button type="button" onClick={onContinue}> <Button type="button" onClick={onContinue}>
Continue Continue