34 lines
980 B
TypeScript
34 lines
980 B
TypeScript
"use client"
|
|
|
|
import {
|
|
resolveCompteSettingsSection,
|
|
type CompteSettingsSectionId,
|
|
} from "@/lib/compte-settings/settings-nav"
|
|
import { CompteHomeSection } from "@/components/compte/sections/compte-home-section"
|
|
import { ComptePersonalInfoSection } from "@/components/compte/sections/compte-personal-info-section"
|
|
import { CompteSecuritySection } from "@/components/compte/sections/compte-security-section"
|
|
|
|
const SECTIONS: Record<CompteSettingsSectionId, React.ComponentType> = {
|
|
home: CompteHomeSection,
|
|
"personal-info": ComptePersonalInfoSection,
|
|
security: CompteSecuritySection,
|
|
}
|
|
|
|
export function CompteSettingsSectionView({
|
|
sectionId,
|
|
}: {
|
|
sectionId: CompteSettingsSectionId
|
|
}) {
|
|
const Section = SECTIONS[sectionId]
|
|
return <Section />
|
|
}
|
|
|
|
export function CompteSettingsSectionFromSegments({
|
|
segments,
|
|
}: {
|
|
segments?: string[]
|
|
}) {
|
|
const sectionId = resolveCompteSettingsSection(segments)
|
|
return <CompteSettingsSectionView sectionId={sectionId} />
|
|
}
|