feat: add help panel to SwotQuadrant component for enhanced user guidance and update exports in swot index
This commit is contained in:
@@ -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<HTMLDivElement, SwotQuadrantProps>(
|
||||
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<HTMLDivElement, SwotQuadrantProps>(
|
||||
{...props}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="mb-4 flex items-center justify-between">
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-xl">{icon}</span>
|
||||
<h3 className={`font-semibold ${styles.text}`}>{title}</h3>
|
||||
<button
|
||||
onClick={() => setShowHelp(!showHelp)}
|
||||
className={`
|
||||
flex h-5 w-5 items-center justify-center rounded-full
|
||||
text-xs font-medium transition-all
|
||||
${showHelp
|
||||
? 'bg-foreground/20 text-foreground'
|
||||
: 'bg-foreground/5 text-muted hover:bg-foreground/10 hover:text-foreground'
|
||||
}
|
||||
`}
|
||||
aria-label="Aide"
|
||||
aria-expanded={showHelp}
|
||||
>
|
||||
{showHelp ? '×' : '?'}
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setIsAdding(true)}
|
||||
@@ -100,6 +117,9 @@ export const SwotQuadrant = forwardRef<HTMLDivElement, SwotQuadrantProps>(
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Help Panel */}
|
||||
<QuadrantHelpPanel category={category} isOpen={showHelp} />
|
||||
|
||||
{/* Items */}
|
||||
<div className="space-y-2">
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user