fix: Move preset selector from company-profile to SDK dashboard
Presets now shown on the SDK start page (/sdk) as a card grid
between header and stats — only when companyName is empty.
Click navigates to /sdk/company-profile?preset={id}.
Reverted company-profile/page.tsx to original state (no preset
logic there — the dashboard is the right place for discovery).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import React, { useState } from 'react'
|
||||
import React from 'react'
|
||||
import { useCompanyProfileForm } from './_hooks/useCompanyProfileForm'
|
||||
import { STEP_EXPLANATIONS } from './_components/constants'
|
||||
import { StepBasicInfo } from './_components/StepBasicInfo'
|
||||
@@ -11,8 +11,6 @@ import { StepDataProtection } from './_components/StepDataProtection'
|
||||
import { StepLegalFramework } from './_components/StepLegalFramework'
|
||||
import { StepMachineBuilder } from './_components/StepMachineBuilder'
|
||||
import { ProfileSummary } from './_components/ProfileSummary'
|
||||
import { PresetSelector } from './_components/PresetSelector'
|
||||
import { COMPANY_PROFILE_PRESETS } from '@/lib/sdk/company-profile-presets'
|
||||
|
||||
export default function CompanyProfilePage() {
|
||||
const {
|
||||
@@ -23,35 +21,6 @@ export default function CompanyProfilePage() {
|
||||
isDeleting, goToNextStep,
|
||||
} = useCompanyProfileForm()
|
||||
|
||||
const [showPresets, setShowPresets] = useState(!formData.companyName)
|
||||
|
||||
// Preset selection view (before wizard)
|
||||
if (showPresets && currentStep !== 99) {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 py-8">
|
||||
<div className="max-w-6xl mx-auto px-4">
|
||||
<PresetSelector
|
||||
onSelect={(preset) => {
|
||||
updateFormData({
|
||||
legalForm: preset.profile.legalForm as never,
|
||||
industry: preset.profile.industry,
|
||||
businessModel: preset.profile.businessModel as never,
|
||||
companySize: preset.profile.companySize as never,
|
||||
employeeCount: preset.profile.employeeCount,
|
||||
headquartersCountry: preset.profile.headquartersCountry,
|
||||
targetMarkets: preset.profile.targetMarkets as never[],
|
||||
isDataController: preset.profile.isDataController,
|
||||
isDataProcessor: preset.profile.isDataProcessor,
|
||||
})
|
||||
setShowPresets(false)
|
||||
}}
|
||||
onSkip={() => setShowPresets(false)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// Summary view (step 99)
|
||||
if (currentStep === 99) {
|
||||
return (
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
import React from 'react'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useSDK, SDK_PACKAGES, getStepsForPackage } from '@/lib/sdk'
|
||||
import { ProjectSelector } from '@/components/sdk/ProjectSelector/ProjectSelector'
|
||||
import { RegulatoryNewsFeed } from '@/components/sdk/regulatory-news/RegulatoryNewsFeed'
|
||||
import { COMPANY_PROFILE_PRESETS, type CompanyProfilePreset } from '@/lib/sdk/company-profile-presets'
|
||||
import type { SDKPackageId } from '@/lib/sdk/types'
|
||||
|
||||
// =============================================================================
|
||||
@@ -223,6 +225,29 @@ export default function SDKDashboard() {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Industry Presets — shown when company profile is empty */}
|
||||
{!state.companyProfile?.companyName && (
|
||||
<div className="bg-gradient-to-br from-purple-50 to-white rounded-xl border border-purple-200 p-6">
|
||||
<h2 className="text-lg font-bold text-gray-900 mb-1">Schnellstart: Welcher Unternehmenstyp sind Sie?</h2>
|
||||
<p className="text-sm text-gray-500 mb-4">
|
||||
Waehlen Sie Ihre Branche — wir befuellen alle Felder vor und empfehlen die passenden Dokumente.
|
||||
</p>
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-3">
|
||||
{COMPANY_PROFILE_PRESETS.map((preset) => (
|
||||
<Link
|
||||
key={preset.id}
|
||||
href={projectId ? `/sdk/company-profile?project=${projectId}&preset=${preset.id}` : `/sdk/company-profile?preset=${preset.id}`}
|
||||
className="flex flex-col items-center gap-2 p-3 bg-white border border-gray-200 rounded-xl hover:border-purple-400 hover:shadow-md transition-all text-center group"
|
||||
>
|
||||
<span className="text-2xl">{preset.icon}</span>
|
||||
<span className="text-xs font-medium text-gray-900 group-hover:text-purple-700">{preset.label}</span>
|
||||
<span className="text-[10px] text-gray-400 leading-tight">{preset.description}</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Stats Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<StatCard
|
||||
|
||||
Reference in New Issue
Block a user