From 52318d5130a09c15b5a2151bb59c707c96969fa0 Mon Sep 17 00:00:00 2001 From: Kawa Date: Mon, 30 Mar 2026 09:38:25 +0200 Subject: [PATCH] feat(05-01): wire BackendSelectionStep to registry and remove dead export - Replace hardcoded BACKENDS array with Object.entries(BACKEND_REGISTRY) - Import BACKEND_REGISTRY in BackendSelectionStep.tsx - Remove BackendFormValues export from schemas/index.ts (dead code TECH-04) - TypeScript compiles with zero errors --- .../wizard/BackendSelectionStep.tsx | 30 +++++-------------- src/schemas/index.ts | 3 -- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/components/wizard/BackendSelectionStep.tsx b/src/components/wizard/BackendSelectionStep.tsx index 1bceaed..0d99da3 100644 --- a/src/components/wizard/BackendSelectionStep.tsx +++ b/src/components/wizard/BackendSelectionStep.tsx @@ -4,6 +4,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import { useWizard } from '../../store/context'; import type { BackendType } from '../../store/types'; +import { BACKEND_REGISTRY } from '../../schemas/registry'; import { BackendCard } from '../ui/BackendCard'; const remoteNameSchema = z.object({ @@ -18,23 +19,6 @@ const remoteNameSchema = z.object({ type RemoteNameFormValues = z.infer; -const BACKENDS: { type: BackendType; name: string; description: string }[] = [ - { - type: 'azureblob', - name: 'Azure Blob Storage', - description: 'Microsoft Azure cloud storage', - }, - { - type: 's3', - name: 'Amazon S3', - description: 'AWS Simple Storage Service', - }, - { - type: 's3-compatible', - name: 'S3-Compatible', - description: 'Wasabi, MinIO, Cloudflare R2, and others', - }, -]; export function BackendSelectionStep() { const { state, dispatch } = useWizard(); @@ -77,13 +61,13 @@ export function BackendSelectionStep() { )}
- {BACKENDS.map((backend) => ( + {Object.entries(BACKEND_REGISTRY).map(([type, entry]) => ( handleCardClick(backend.type)} + key={type} + name={entry.displayName} + description={entry.description} + selected={state.remote.backendType === type} + onClick={() => handleCardClick(type as BackendType)} /> ))}
diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 5f9f5ff..238fd1e 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -23,6 +23,3 @@ export const BACKEND_SCHEMAS = { 's3-compatible': buildZodSchema('s3-compatible'), } as const; -// Utility type: infer TypeScript type from a backend's Zod schema -export type BackendFormValues = - z.infer;