From 15ea89f477a1db4b41fdb1cc697c459237547733 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Thu, 27 Nov 2025 13:42:17 +0100 Subject: [PATCH] feat: add help panel to SwotQuadrant component for enhanced user guidance and update exports in swot index --- dev.db | Bin 122880 -> 131072 bytes src/components/swot/QuadrantHelp.tsx | 161 +++++++++++++++++++++++++++ src/components/swot/SwotQuadrant.tsx | 22 +++- src/components/swot/index.ts | 1 + 4 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 src/components/swot/QuadrantHelp.tsx diff --git a/dev.db b/dev.db index 26e613cec59eca4d3a448fec59f9dcf121977aec..c7b9a98e8b83bc07e25f905dbeb17c88a59d819c 100644 GIT binary patch delta 7162 zcmeHMTWB0r7~XA~WG{0`(xz#mX}ggkRl7NJp9#oPG}e^H+8V@y+U{oW_si_g&PqvF zd=af$0xo?J5e4ak4-&A5FM<^DsSjGjm-ayfeGqR{9|Y?;vopJA-IHy!k7gex@c%jI z|IYcp`Oo*CIsfVC`SYGP?isGST&@Eb4}{#+56`|=*ys0N8)6OSccx1JLPh*H{LlEl z_B~B~@4e@eBWOHg_=pm^oL2GjnKWC6?h*f|0gnern~^ z;uA+#9v@ymd3(Awf78vLvBD^twt1M2v$>P@gzmu>kZn`}01Xtz)KVa;R4UQ-&k3}% z6X>9}z{^2V1DgbDJ2#$e>>mog6q>}M#A_mqqN6B=m~Lc?l^6_D=@0RMw!o=DNfb8; zfjKvRIybQ+0CVVPuDIB5*{kgP?91#tJI?&ZTxYJZ8Frbu#Jm6#cbaKs-gbKxQnuLH zp^)3oW&e&d$h&^FF}?oPYvyeCUkSUmk$$~(c8hS1?S9$h@XxU%@@3v($wmRpL>EzGqS zPRP#Oxjwe?T#)B%DmMeWdqc($i|Qz(8qONLRMo7I`AtI_5jdcR2GpW*F(L3NQb-V# zB%5u`rClDh%I5v{GUEnXrh%qNi%B(;H%%+%+9RhHj}Vthi22amY9X)3@;clM#K<{l z2v$VN1fkE2?%R;;+L2OloEe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/QuadrantHelp.tsx b/src/components/swot/QuadrantHelp.tsx new file mode 100644 index 0000000..12aca74 --- /dev/null +++ b/src/components/swot/QuadrantHelp.tsx @@ -0,0 +1,161 @@ +'use client'; + +import { useState } from 'react'; +import type { SwotCategory } from '@prisma/client'; + +interface HelpContent { + description: string; + examples: string[]; + questions: string[]; +} + +const HELP_CONTENT: Record = { + STRENGTH: { + description: + 'Les atouts internes et qualités qui distinguent positivement.', + examples: [ + 'Expertise technique solide', + 'Excellentes capacités de communication', + 'Leadership naturel', + 'Rigueur et organisation', + ], + questions: [ + 'Qu\'est-ce qui le/la distingue ?', + 'Quels retours positifs reçoit-il/elle ?', + ], + }, + WEAKNESS: { + description: + 'Les axes d\'amélioration et points à travailler.', + examples: [ + 'Difficulté à déléguer', + 'Gestion du stress à améliorer', + 'Communication écrite perfectible', + 'Manque de visibilité en réunion', + ], + questions: [ + 'Quels feedbacks constructifs a-t-il/elle reçus ?', + 'Quelles situations le/la mettent en difficulté ?', + ], + }, + OPPORTUNITY: { + description: + 'Les facteurs externes favorables à saisir.', + examples: [ + 'Nouveau projet stratégique', + 'Formation disponible', + 'Poste ouvert en interne', + 'Mentor potentiel identifié', + ], + questions: [ + 'Quelles évolutions pourraient l\'aider ?', + 'Quelles ressources sont disponibles ?', + ], + }, + THREAT: { + description: + 'Les risques externes à anticiper.', + examples: [ + 'Réorganisation menaçant le poste', + 'Compétences devenant obsolètes', + 'Concurrence interne forte', + 'Budget formation réduit', + ], + questions: [ + 'Quels changements pourraient impacter négativement ?', + 'Quels risques sont à anticiper ?', + ], + }, +}; + +interface QuadrantHelpProps { + category: SwotCategory; +} + +export function QuadrantHelp({ category }: QuadrantHelpProps) { + const [isOpen, setIsOpen] = useState(false); + const content = HELP_CONTENT[category]; + + return ( + + ); +} + +interface QuadrantHelpPanelProps { + category: SwotCategory; + isOpen: boolean; +} + +export function QuadrantHelpPanel({ category, isOpen }: QuadrantHelpPanelProps) { + const content = HELP_CONTENT[category]; + + return ( +
+
+
+ {/* Description */} +

+ {content.description} +

+ +
+ {/* Examples */} +
+

+ 📝 Exemples +

+
    + {content.examples.map((example, i) => ( +
  • + + {example} +
  • + ))} +
+
+ + {/* Questions */} +
+

+ 💡 Questions +

+
    + {content.questions.map((question, i) => ( +
  • + {question} +
  • + ))} +
+
+
+
+
+
+ ); +} + diff --git a/src/components/swot/SwotQuadrant.tsx b/src/components/swot/SwotQuadrant.tsx index d1cc41c..492fa21 100644 --- a/src/components/swot/SwotQuadrant.tsx +++ b/src/components/swot/SwotQuadrant.tsx @@ -3,6 +3,7 @@ import { forwardRef, useState, useTransition, ReactNode } from 'react'; import type { SwotCategory } from '@prisma/client'; import { createSwotItem } from '@/actions/swot'; +import { QuadrantHelpPanel } from './QuadrantHelp'; interface SwotQuadrantProps { category: SwotCategory; @@ -41,6 +42,7 @@ export const SwotQuadrant = forwardRef( const [isAdding, setIsAdding] = useState(false); const [newContent, setNewContent] = useState(''); const [isPending, startTransition] = useTransition(); + const [showHelp, setShowHelp] = useState(false); const styles = categoryStyles[category]; @@ -81,10 +83,25 @@ export const SwotQuadrant = forwardRef( {...props} > {/* Header */} -
+
{icon}

{title}

+
+ {/* Help Panel */} + + {/* Items */}
{children} diff --git a/src/components/swot/index.ts b/src/components/swot/index.ts index 907dc01..340652d 100644 --- a/src/components/swot/index.ts +++ b/src/components/swot/index.ts @@ -2,4 +2,5 @@ export { SwotBoard } from './SwotBoard'; export { SwotQuadrant } from './SwotQuadrant'; export { SwotCard } from './SwotCard'; export { ActionPanel } from './ActionPanel'; +export { QuadrantHelp } from './QuadrantHelp';