2026-01-30 13:41:32 +01:00
|
|
|
'use client'
|
|
|
|
|
|
|
|
|
|
import { motion } from 'motion/react'
|
|
|
|
|
import { UseFormReturn } from 'react-hook-form'
|
|
|
|
|
import { WizardStepContent } from '@/components/forms/form-wizard'
|
|
|
|
|
import { Input } from '@/components/ui/input'
|
|
|
|
|
import { Label } from '@/components/ui/label'
|
|
|
|
|
import { Textarea } from '@/components/ui/textarea'
|
|
|
|
|
import {
|
|
|
|
|
Select,
|
|
|
|
|
SelectContent,
|
|
|
|
|
SelectItem,
|
|
|
|
|
SelectTrigger,
|
|
|
|
|
SelectValue,
|
|
|
|
|
} from '@/components/ui/select'
|
|
|
|
|
import type { ApplicationFormData } from '@/server/routers/application'
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
import { type DropdownOption, type WizardConfig, DEFAULT_OCEAN_ISSUES } from '@/types/wizard-config'
|
|
|
|
|
import { isFieldVisible, getFieldConfig } from '@/lib/wizard-config'
|
2026-01-30 13:41:32 +01:00
|
|
|
|
|
|
|
|
interface StepProjectProps {
|
|
|
|
|
form: UseFormReturn<ApplicationFormData>
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
oceanIssues?: DropdownOption[]
|
|
|
|
|
config?: WizardConfig
|
2026-01-30 13:41:32 +01:00
|
|
|
}
|
|
|
|
|
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
export function StepProject({ form, oceanIssues, config }: StepProjectProps) {
|
|
|
|
|
const issueOptions = oceanIssues ?? DEFAULT_OCEAN_ISSUES
|
2026-01-30 13:41:32 +01:00
|
|
|
const { register, formState: { errors }, setValue, watch } = form
|
|
|
|
|
const oceanIssue = watch('oceanIssue')
|
|
|
|
|
const description = watch('description') || ''
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
const showTeamName = !config || isFieldVisible(config, 'teamName')
|
|
|
|
|
const descriptionLabel = config ? getFieldConfig(config, 'description').label : undefined
|
2026-01-30 13:41:32 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<WizardStepContent
|
|
|
|
|
title="Tell us about your project"
|
|
|
|
|
description="Share the details of your ocean protection initiative."
|
|
|
|
|
>
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0 }}
|
|
|
|
|
animate={{ opacity: 1 }}
|
|
|
|
|
className="mx-auto max-w-lg space-y-6"
|
|
|
|
|
>
|
|
|
|
|
{/* Project Name */}
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label htmlFor="projectName">
|
|
|
|
|
Name of your project/startup <span className="text-destructive">*</span>
|
|
|
|
|
</Label>
|
|
|
|
|
<Input
|
|
|
|
|
id="projectName"
|
|
|
|
|
placeholder="Ocean Guardian AI"
|
|
|
|
|
{...register('projectName')}
|
|
|
|
|
className="h-12 text-base"
|
|
|
|
|
/>
|
|
|
|
|
{errors.projectName && (
|
|
|
|
|
<p className="text-sm text-destructive">{errors.projectName.message}</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Team Name (optional) */}
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
{showTeamName && (
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label htmlFor="teamName">
|
|
|
|
|
Team Name <span className="text-muted-foreground text-xs">(optional)</span>
|
|
|
|
|
</Label>
|
|
|
|
|
<Input
|
|
|
|
|
id="teamName"
|
|
|
|
|
placeholder="Blue Innovation Team"
|
|
|
|
|
{...register('teamName')}
|
|
|
|
|
className="h-12 text-base"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-01-30 13:41:32 +01:00
|
|
|
|
|
|
|
|
{/* Ocean Issue */}
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label>
|
|
|
|
|
What type of ocean issue does your project address? <span className="text-destructive">*</span>
|
|
|
|
|
</Label>
|
|
|
|
|
<Select
|
|
|
|
|
value={oceanIssue}
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
onValueChange={(value) => setValue('oceanIssue', value)}
|
2026-01-30 13:41:32 +01:00
|
|
|
>
|
|
|
|
|
<SelectTrigger className="h-12 text-base">
|
|
|
|
|
<SelectValue placeholder="Select an ocean issue" />
|
|
|
|
|
</SelectTrigger>
|
|
|
|
|
<SelectContent>
|
Add dynamic apply wizard customization with admin settings UI
- Create wizard config types, utilities, and defaults (wizard-config.ts)
- Add admin apply settings page with drag-and-drop step ordering, dropdown
option management, feature toggles, welcome message customization, and
custom field builder with select/multiselect options editor
- Build dynamic apply wizard component with animated step transitions,
mobile-first responsive design, and config-driven form validation
- Update step components to accept dynamic config (categories, ocean issues,
field visibility, feature flags)
- Replace hardcoded enum validation with string-based validation for
admin-configurable dropdown values, with safe enum casting at storage layer
- Add wizard template system (model, router, admin UI) with built-in
MOPC Classic preset
- Add program wizard config CRUD procedures to program router
- Update application router getConfig to return wizardConfig, submit handler
to store custom field data in metadataJson
- Add edition-based apply page, project pool page, and supporting routers
- Fix CSS (invalid sm:fixed-none), Enter key handler (skip textarea),
safe area insets for notched phones, buildStepsArray field visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:18:20 +01:00
|
|
|
{issueOptions.map((option) => (
|
2026-01-30 13:41:32 +01:00
|
|
|
<SelectItem key={option.value} value={option.value}>
|
|
|
|
|
{option.label}
|
|
|
|
|
</SelectItem>
|
|
|
|
|
))}
|
|
|
|
|
</SelectContent>
|
|
|
|
|
</Select>
|
|
|
|
|
{errors.oceanIssue && (
|
|
|
|
|
<p className="text-sm text-destructive">{errors.oceanIssue.message}</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Description */}
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label htmlFor="description">
|
|
|
|
|
Briefly describe your project idea and objectives <span className="text-destructive">*</span>
|
|
|
|
|
</Label>
|
|
|
|
|
<p className="text-xs text-muted-foreground">
|
|
|
|
|
Keep it brief - you'll have the opportunity to provide more details later.
|
|
|
|
|
</p>
|
|
|
|
|
<Textarea
|
|
|
|
|
id="description"
|
|
|
|
|
placeholder="Our project aims to..."
|
|
|
|
|
rows={5}
|
|
|
|
|
maxLength={2000}
|
|
|
|
|
{...register('description')}
|
|
|
|
|
className="text-base resize-none"
|
|
|
|
|
/>
|
|
|
|
|
<div className="flex justify-between text-xs text-muted-foreground">
|
|
|
|
|
<span>
|
|
|
|
|
{errors.description ? (
|
|
|
|
|
<span className="text-destructive">{errors.description.message}</span>
|
|
|
|
|
) : (
|
|
|
|
|
'Minimum 20 characters'
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
<span>{description.length} characters</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</motion.div>
|
|
|
|
|
</WizardStepContent>
|
|
|
|
|
)
|
|
|
|
|
}
|