11'use client' ;
22
33import { useState } from 'react' ;
4+ import { Sparkles } from 'lucide-react' ;
45import { NameSection } from './sections/NameSection' ;
56import { DescriptionSection } from './sections/DescriptionSection' ;
67import { TechnologiesSection } from './sections/TechnologiesSection' ;
@@ -11,6 +12,7 @@ import { ContributionGraphSection } from './sections/ContributionGraphSection';
1112import { ArticlesSection } from './sections/ArticlesSection' ;
1213import { GitHubImportModal } from './GitHubImportModal' ;
1314import { FaGithub } from 'react-icons/fa' ;
15+ import { PROFILE_PRESETS } from '../data/presets' ;
1416import type { GeneratorState } from '../types' ;
1517import type { ImportedData } from '../utils/githubMapper' ;
1618
@@ -38,6 +40,7 @@ export interface EditorPanelProps {
3840 onArticlesPlatformChange ?: ( v : 'devto' | 'hashnode' ) => void ;
3941 onArticlesUsernameChange ?: ( v : string ) => void ;
4042 onApplyImport : ( data : ImportedData ) => void ;
43+ onApplyPreset ?: ( presetState : Partial < GeneratorState > ) => void ;
4144}
4245
4346export function EditorPanel ( {
@@ -59,6 +62,7 @@ export function EditorPanel({
5962 onArticlesPlatformChange = ( ) => { } ,
6063 onArticlesUsernameChange = ( ) => { } ,
6164 onApplyImport,
65+ onApplyPreset,
6266} : EditorPanelProps ) {
6367 const [ isImportModalOpen , setIsImportModalOpen ] = useState ( false ) ;
6468
@@ -69,6 +73,7 @@ export function EditorPanel({
6973 className = "flex flex-col gap-4"
7074 onSubmit = { ( e ) => e . preventDefault ( ) }
7175 >
76+ { /* GitHub Import */ }
7277 < button
7378 type = "button"
7479 onClick = { ( ) => setIsImportModalOpen ( true ) }
@@ -81,20 +86,67 @@ export function EditorPanel({
8186 </ span >
8287 </ button >
8388
89+ { /* Profile Presets Selector */ }
90+ < div className = "p-4 rounded-2xl bg-white dark:bg-[#111111] border border-gray-200 dark:border-white/10 shadow-sm" >
91+ < div className = "flex items-center justify-between mb-2" >
92+ < div className = "flex items-center gap-2" >
93+ < Sparkles size = { 16 } className = "text-emerald-500" />
94+ < h3 className = "text-xs font-bold text-gray-900 dark:text-white uppercase tracking-wider" >
95+ Profile Presets
96+ </ h3 >
97+ </ div >
98+ < span className = "text-[10px] text-gray-400 dark:text-white/40" >
99+ 1-click template setup
100+ </ span >
101+ </ div >
102+ < div className = "grid grid-cols-2 gap-2 mt-3" >
103+ { PROFILE_PRESETS . map ( ( preset ) => (
104+ < button
105+ key = { preset . id }
106+ type = "button"
107+ onClick = { ( ) => onApplyPreset ?.( preset . state ) }
108+ className = "flex flex-col text-left p-2.5 rounded-xl bg-gray-50 dark:bg-white/5 border border-gray-200/60 dark:border-white/5 hover:border-emerald-500/40 dark:hover:border-emerald-500/40 hover:bg-emerald-500/5 transition-all group"
109+ >
110+ < div className = "flex items-center justify-between w-full mb-1" >
111+ < span className = "text-sm select-none" > { preset . icon } </ span >
112+ < span className = "text-[9px] font-bold px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" >
113+ { preset . badge }
114+ </ span >
115+ </ div >
116+ < span className = "text-xs font-semibold text-gray-900 dark:text-white group-hover:text-emerald-600 dark:group-hover:text-emerald-400 transition-colors" >
117+ { preset . name }
118+ </ span >
119+ < span className = "text-[10px] text-gray-500 dark:text-white/40 truncate mt-0.5" >
120+ { preset . description }
121+ </ span >
122+ </ button >
123+ ) ) }
124+ </ div >
125+ </ div >
126+
84127 < GitHubImportModal
85128 isOpen = { isImportModalOpen }
86129 onClose = { ( ) => setIsImportModalOpen ( false ) }
87130 onApply = { onApplyImport }
88131 />
89132
90- < NameSection value = { state . name } onChange = { onNameChange } />
91- < DescriptionSection value = { state . description } onChange = { onDescriptionChange } />
92- < TechnologiesSection selected = { state . selectedTechs } onChange = { onTechsChange } />
133+ < NameSection value = { state . name } onChange = { onNameChange } onReset = { ( ) => onNameChange ( '' ) } />
134+ < DescriptionSection
135+ value = { state . description }
136+ onChange = { onDescriptionChange }
137+ onReset = { ( ) => onDescriptionChange ( '' ) }
138+ />
139+ < TechnologiesSection
140+ selected = { state . selectedTechs }
141+ onChange = { onTechsChange }
142+ onReset = { ( ) => onTechsChange ( [ ] ) }
143+ />
93144 < SocialsSection
94145 selected = { state . selectedSocials }
95146 socialLinks = { state . socialLinks }
96147 onSelectedChange = { onSocialsChange }
97148 onLinkChange = { onSocialLinkChange }
149+ onReset = { ( ) => onSocialsChange ( [ ] ) }
98150 />
99151 < CommitPulseSection
100152 githubUsername = { state . githubUsername }
@@ -103,6 +155,10 @@ export function EditorPanel({
103155 onGithubUsernameChange = { onGithubUsernameChange }
104156 onShowCommitPulseChange = { onShowCommitPulseChange }
105157 onCommitPulseAccentChange = { onCommitPulseAccentChange }
158+ onReset = { ( ) => {
159+ onShowCommitPulseChange ( false ) ;
160+ onCommitPulseAccentChange ( '' ) ;
161+ } }
106162 />
107163 < ContributionGraphSection
108164 githubUsername = { state . githubUsername }
@@ -113,6 +169,11 @@ export function EditorPanel({
113169 onShowSnakeGraphChange = { onShowSnakeGraphChange }
114170 onShowPacmanGraphChange = { onShowPacmanGraphChange }
115171 onGraphPlacementChange = { onGraphPlacementChange }
172+ onReset = { ( ) => {
173+ onShowSnakeGraphChange ( false ) ;
174+ onShowPacmanGraphChange ( false ) ;
175+ onGraphPlacementChange ( 'bottom' ) ;
176+ } }
116177 />
117178 < RepoSpotlightSection
118179 githubUsername = { state . githubUsername }
@@ -121,6 +182,10 @@ export function EditorPanel({
121182 commitPulseAccent = { state . commitPulseAccent }
122183 onShowRepoSpotlightChange = { onShowRepoSpotlightChange }
123184 onSpotlightRepoChange = { onSpotlightRepoChange }
185+ onReset = { ( ) => {
186+ onShowRepoSpotlightChange ( false ) ;
187+ onSpotlightRepoChange ( '' ) ;
188+ } }
124189 />
125190 < ArticlesSection
126191 showArticles = { state . showArticles ?? false }
@@ -129,6 +194,11 @@ export function EditorPanel({
129194 onShowArticlesChange = { onShowArticlesChange }
130195 onArticlesPlatformChange = { onArticlesPlatformChange }
131196 onArticlesUsernameChange = { onArticlesUsernameChange }
197+ onReset = { ( ) => {
198+ onShowArticlesChange ( false ) ;
199+ onArticlesPlatformChange ( 'devto' ) ;
200+ onArticlesUsernameChange ( '' ) ;
201+ } }
132202 />
133203 </ form >
134204 ) ;
0 commit comments