All files / apps/web/src/components FeatureHelpButton.jsx

0% Statements 0/7
0% Branches 0/4
0% Functions 0/1
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                                                       
import { useLocation } from 'react-router-dom'
import { HelpCircle } from 'lucide-react'
import { useOrganizationStore } from '../store/organizationStore'
import { getGuideHref } from '../utils/navigationMapping'
 
/**
 * Bouton d'aide autonome pour une page de fonctionnalité : calcule lui-même
 * le lien vers la page du guide correspondante (à partir de la route courante).
 * Affiche rien si pas de fonctionnalité mappée.
 */
export default function FeatureHelpButton() {
  const location = useLocation()
  const { currentOrganization } = useOrganizationStore()
  const orgId = currentOrganization?.id
  const href = orgId ? getGuideHref(location.pathname, orgId) : null
  if (!href) return null
  return (
    <a
      href={href}
      target="_blank"
      rel="noopener noreferrer"
      className="flex items-center justify-center p-2 text-gray-600 rounded-lg hover:bg-gray-100 transition-colors"
      title="Aide"
    >
      <HelpCircle className="w-5 h-5" />
    </a>
  )
}