feat(workshop): refactor achievements section for improved layout.

This commit is contained in:
shay
2026-04-20 14:38:29 -04:00
parent 599c1ed672
commit b66f966adb
@@ -553,6 +553,7 @@ export function WorkshopScreen({
)} )}
{w.id === 'achievements' && ( {w.id === 'achievements' && (
<div className="flex flex-col gap-2.5">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<span className="text-[10px] text-gray-500">Max shown</span> <span className="text-[10px] text-gray-500">Max shown</span>
<NumberStepper <NumberStepper
@@ -561,29 +562,16 @@ export function WorkshopScreen({
onChange={v => updateWidgetSetting('achievements', 'max_items', v)} onChange={v => updateWidgetSetting('achievements', 'max_items', v)}
/> />
</div> </div>
)}
</div>
)}
</div>
)
})}
</div>
</div>
{/* Achievements editor */}
{settings.widgets.includes('achievements') && (
<div className="mb-5">
<div className="text-[10px] uppercase tracking-wider text-gray-400 font-medium mb-3">Achievements</div>
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
{settings.achievements.map((ach, idx) => ( {settings.achievements.map((ach, aidx) => (
<div key={idx} className="p-2.5 rounded-lg border border-gray-100 bg-gray-50/50"> <div key={aidx} className="p-2.5 rounded-lg border border-gray-100 bg-white">
<div className="flex items-center gap-1.5 mb-2"> <div className="flex items-center gap-1.5 mb-2">
{ICONS.map(ic => { {ICONS.map(ic => {
const selected = ach.icon === ic.id const selected = ach.icon === ic.id
return ( return (
<button <button
key={ic.id} key={ic.id}
onClick={() => updateAchievement(idx, 'icon', ic.id)} onClick={() => updateAchievement(aidx, 'icon', ic.id)}
className={`w-8 h-8 rounded-md flex items-center justify-center transition-colors ${ className={`w-8 h-8 rounded-md flex items-center justify-center transition-colors ${
selected selected
? 'bg-gray-800 text-white border border-gray-800' ? 'bg-gray-800 text-white border border-gray-800'
@@ -598,7 +586,7 @@ export function WorkshopScreen({
})} })}
<div className="flex-1" /> <div className="flex-1" />
<button <button
onClick={() => removeAchievement(idx)} onClick={() => removeAchievement(aidx)}
className="text-gray-300 hover:text-red-400 transition-colors text-xs px-1" className="text-gray-300 hover:text-red-400 transition-colors text-xs px-1"
title="Remove" title="Remove"
> >
@@ -608,21 +596,21 @@ export function WorkshopScreen({
<input <input
type="text" type="text"
value={ach.title} value={ach.title}
onChange={e => updateAchievement(idx, 'title', e.target.value)} onChange={e => updateAchievement(aidx, 'title', e.target.value)}
placeholder="Title (e.g. Hackathon Winner)" placeholder="Title (e.g. Hackathon Winner)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5" className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/> />
<input <input
type="text" type="text"
value={ach.subtitle} value={ach.subtitle}
onChange={e => updateAchievement(idx, 'subtitle', e.target.value)} onChange={e => updateAchievement(aidx, 'subtitle', e.target.value)}
placeholder="Subtitle (e.g. 1st Place · AI Track)" placeholder="Subtitle (e.g. 1st Place · AI Track)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5" className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300 mb-1.5"
/> />
<input <input
type="text" type="text"
value={ach.event_date} value={ach.event_date}
onChange={e => updateAchievement(idx, 'event_date', e.target.value)} onChange={e => updateAchievement(aidx, 'event_date', e.target.value)}
placeholder="Date (e.g. 2025-01)" placeholder="Date (e.g. 2025-01)"
className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300" className="w-full px-2 py-1.5 rounded-md border border-gray-200 bg-white text-xs text-gray-800 placeholder:text-gray-300 focus:outline-none focus:ring-1 focus:ring-gray-300"
/> />
@@ -637,6 +625,13 @@ export function WorkshopScreen({
</div> </div>
</div> </div>
)} )}
</div>
)}
</div>
)
})}
</div>
</div>
{/* Spacer */} {/* Spacer */}
<div className="flex-1 min-h-4" /> <div className="flex-1 min-h-4" />