Skip to content

Commit 6431a16

Browse files
committed
Make My Avatar page more abstract and fix validation
- Remove color display from first question - only show philosophy keywords and descriptions - Replace animation style with working style (iterative, detail-oriented, etc.) - Make keywords 2 and 3 optional (only first keyword is mandatory) - Add proper form validation - Complete button only enabled when all required fields filled - Update XML generation to include working style instead of animation style - Clean up unused ANIMATION_OPTIONS constant
1 parent 1f9f3d1 commit 6431a16

File tree

1 file changed

+59
-32
lines changed

1 file changed

+59
-32
lines changed

src/app/my-avatar/page.tsx

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface AvatarData {
1010
primaryColor: string;
1111
secondaryColor: string;
1212
philosophy: string;
13-
animationStyle: string;
13+
workingStyle: string;
1414

1515
// Role information
1616
role: string;
@@ -66,22 +66,47 @@ const DESIGN_PHILOSOPHY_OPTIONS = [
6666
},
6767
];
6868

69-
const ANIMATION_OPTIONS = [
70-
{ name: 'Quick & Snappy', style: 'quick', description: 'Fast, responsive animations' },
71-
{ name: 'Slow & Smooth', style: 'slow', description: 'Gentle, flowing movements' },
72-
{ name: 'Wavy & Organic', style: 'wavy', description: 'Natural, wave-like motion' },
73-
{ name: 'Springy & Bouncy', style: 'springy', description: 'Energetic, elastic feel' },
74-
{ name: 'Minimal & Subtle', style: 'minimal', description: 'Understated, refined motion' },
75-
{ name: 'Dynamic & Bold', style: 'dynamic', description: 'Strong, impactful animations' },
69+
const WORKING_STYLE_OPTIONS = [
70+
{
71+
name: 'Iterative',
72+
description: 'Building and refining through continuous cycles',
73+
style: 'iterative'
74+
},
75+
{
76+
name: 'Detail-Oriented',
77+
description: 'Focusing on precision and attention to every element',
78+
style: 'detail-oriented'
79+
},
80+
{
81+
name: 'Big Picture',
82+
description: 'Thinking strategically about overall user experience',
83+
style: 'big-picture'
84+
},
85+
{
86+
name: 'Collaborative',
87+
description: 'Working closely with cross-functional teams',
88+
style: 'collaborative'
89+
},
90+
{
91+
name: 'Experimental',
92+
description: 'Testing new approaches and pushing boundaries',
93+
style: 'experimental'
94+
},
95+
{
96+
name: 'Systematic',
97+
description: 'Following structured processes and methodologies',
98+
style: 'systematic'
99+
},
76100
];
77101

102+
78103
export default function MyAvatarPage() {
79104
const [currentStep, setCurrentStep] = useState(0);
80105
const [avatarData, setAvatarData] = useState<AvatarData>({
81106
primaryColor: '',
82107
secondaryColor: '',
83108
philosophy: '',
84-
animationStyle: '',
109+
workingStyle: '',
85110
role: 'Product Designer',
86111
organizationDescription: '',
87112
keywords: ['', '', ''],
@@ -91,6 +116,16 @@ export default function MyAvatarPage() {
91116
setAvatarData(prev => ({ ...prev, [field]: value }));
92117
};
93118

119+
const isFormComplete = () => {
120+
return (
121+
avatarData.philosophy &&
122+
avatarData.workingStyle &&
123+
avatarData.role &&
124+
avatarData.organizationDescription &&
125+
avatarData.keywords[0]?.trim()
126+
);
127+
};
128+
94129
const nextStep = () => {
95130
if (currentStep < STEPS.length - 1) {
96131
setCurrentStep(currentStep + 1);
@@ -110,15 +145,15 @@ export default function MyAvatarPage() {
110145
<primaryColor>${avatarData.primaryColor}</primaryColor>
111146
<secondaryColor>${avatarData.secondaryColor}</secondaryColor>
112147
<philosophy>${avatarData.philosophy}</philosophy>
113-
<animationStyle>${avatarData.animationStyle}</animationStyle>
148+
<workingStyle>${avatarData.workingStyle}</workingStyle>
114149
</style>
115150
<role>
116151
<title>${avatarData.role}</title>
117152
<organizationDescription>${avatarData.organizationDescription}</organizationDescription>
118153
</role>
119154
<expertise>
120155
<keywords>
121-
${avatarData.keywords.map(keyword => `<keyword>${keyword}</keyword>`).join('\n ')}
156+
${avatarData.keywords.filter(k => k.trim()).map(keyword => `<keyword>${keyword}</keyword>`).join('\n ')}
122157
</keywords>
123158
</expertise>
124159
</avatar>`;
@@ -161,16 +196,7 @@ export default function MyAvatarPage() {
161196
: 'border-border hover:border-accent/50'
162197
}`}
163198
>
164-
<div className="flex space-x-2 mb-4">
165-
{option.colors.map((color, i) => (
166-
<div
167-
key={i}
168-
className="w-8 h-8 rounded-full"
169-
style={{ backgroundColor: color }}
170-
/>
171-
))}
172-
</div>
173-
<h3 className="font-semibold text-foreground mb-2">{option.name}</h3>
199+
<h3 className="font-semibold text-foreground mb-3">{option.name}</h3>
174200
<p className="text-muted-foreground text-sm">{option.description}</p>
175201
</motion.button>
176202
))}
@@ -182,19 +208,19 @@ export default function MyAvatarPage() {
182208
return (
183209
<div className="space-y-8">
184210
<div className="text-center">
185-
<h2 className="text-3xl font-bold text-foreground mb-4">Animation Style</h2>
186-
<p className="text-muted-foreground text-lg">How should your avatar move and interact?</p>
211+
<h2 className="text-3xl font-bold text-foreground mb-4">How do you approach your work?</h2>
212+
<p className="text-muted-foreground text-lg">Select the working style that best describes your process</p>
187213
</div>
188214

189215
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
190-
{ANIMATION_OPTIONS.map((option, index) => (
216+
{WORKING_STYLE_OPTIONS.map((option, index) => (
191217
<motion.button
192218
key={index}
193219
whileHover={{ scale: 1.02 }}
194220
whileTap={{ scale: 0.98 }}
195-
onClick={() => updateAvatarData('animationStyle', option.style)}
221+
onClick={() => updateAvatarData('workingStyle', option.style)}
196222
className={`p-6 rounded-2xl border-2 transition-all text-left ${
197-
avatarData.animationStyle === option.style
223+
avatarData.workingStyle === option.style
198224
? 'border-accent bg-accent/10'
199225
: 'border-border hover:border-accent/50'
200226
}`}
@@ -250,14 +276,15 @@ export default function MyAvatarPage() {
250276
<div className="space-y-8">
251277
<div className="text-center">
252278
<h2 className="text-3xl font-bold text-foreground mb-4">Your Expertise</h2>
253-
<p className="text-muted-foreground text-lg">Add 3 keywords that define what you do best</p>
279+
<p className="text-muted-foreground text-lg">Add keywords that define what you do best (at least 1 required)</p>
254280
</div>
255281

256282
<div className="max-w-2xl mx-auto space-y-4">
257283
{[0, 1, 2].map((index) => (
258284
<div key={index}>
259285
<label className="block text-sm font-medium text-foreground mb-2">
260-
Keyword {index + 1}
286+
Keyword {index + 1} {index === 0 && <span className="text-accent">*</span>}
287+
{index > 0 && <span className="text-muted-foreground text-xs ml-2">(optional)</span>}
261288
</label>
262289
<input
263290
type="text"
@@ -268,7 +295,7 @@ export default function MyAvatarPage() {
268295
updateAvatarData('keywords', newKeywords);
269296
}}
270297
className="w-full px-4 py-3 rounded-lg border border-border bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-accent"
271-
placeholder={`Expertise ${index + 1}...`}
298+
placeholder={index === 0 ? "Your primary expertise..." : `Additional expertise ${index}...`}
272299
/>
273300
</div>
274301
))}
@@ -334,7 +361,7 @@ export default function MyAvatarPage() {
334361
/>
335362
</div>
336363
<span className="text-sm text-muted-foreground capitalize">
337-
{avatarData.animationStyle} motion
364+
{avatarData.workingStyle.replace('-', ' ')} approach
338365
</span>
339366
</div>
340367
</div>
@@ -403,9 +430,9 @@ export default function MyAvatarPage() {
403430
whileHover={{ scale: 1.02 }}
404431
whileTap={{ scale: 0.98 }}
405432
onClick={nextStep}
406-
disabled={currentStep === STEPS.length - 1}
433+
disabled={currentStep === STEPS.length - 1 || !isFormComplete()}
407434
className={`flex items-center space-x-2 px-6 py-3 rounded-lg font-medium transition-colors ${
408-
currentStep === STEPS.length - 1
435+
currentStep === STEPS.length - 1 || !isFormComplete()
409436
? 'text-muted-foreground cursor-not-allowed'
410437
: 'bg-accent text-white hover:bg-accent/90'
411438
}`}

0 commit comments

Comments
 (0)