|
| 1 | +import React from 'react'; |
| 2 | +import { useTranslation } from 'react-i18next'; |
| 3 | +import { X, UploadCloud, Settings2, LineChart, GitCompare } from 'lucide-react'; |
| 4 | + |
| 5 | +export function GuideModal({ isOpen, onClose }) { |
| 6 | + const { t } = useTranslation(); |
| 7 | + |
| 8 | + if (!isOpen) return null; |
| 9 | + |
| 10 | + const sections = [ |
| 11 | + { |
| 12 | + icon: UploadCloud, |
| 13 | + title: t('guide.upload.title'), |
| 14 | + desc: t('guide.upload.desc'), |
| 15 | + bullets: [ |
| 16 | + t('guide.upload.bullet1'), |
| 17 | + t('guide.upload.bullet2'), |
| 18 | + t('guide.upload.bullet3') |
| 19 | + ] |
| 20 | + }, |
| 21 | + { |
| 22 | + icon: Settings2, |
| 23 | + title: t('guide.configure.title'), |
| 24 | + desc: t('guide.configure.desc'), |
| 25 | + bullets: [ |
| 26 | + t('guide.configure.bullet1'), |
| 27 | + t('guide.configure.bullet2'), |
| 28 | + t('guide.configure.bullet3') |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + icon: LineChart, |
| 33 | + title: t('guide.visualize.title'), |
| 34 | + desc: t('guide.visualize.desc'), |
| 35 | + bullets: [ |
| 36 | + t('guide.visualize.bullet1'), |
| 37 | + t('guide.visualize.bullet2'), |
| 38 | + t('guide.visualize.bullet3') |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + icon: GitCompare, |
| 43 | + title: t('guide.compare.title'), |
| 44 | + desc: t('guide.compare.desc'), |
| 45 | + bullets: [ |
| 46 | + t('guide.compare.bullet1'), |
| 47 | + t('guide.compare.bullet2'), |
| 48 | + t('guide.compare.bullet3') |
| 49 | + ] |
| 50 | + } |
| 51 | + ]; |
| 52 | + |
| 53 | + return ( |
| 54 | + <div |
| 55 | + className="fixed inset-0 z-50 flex items-start justify-center px-4 py-8 bg-black/50 overflow-y-auto" |
| 56 | + role="dialog" |
| 57 | + aria-modal="true" |
| 58 | + aria-label={t('guide.title')} |
| 59 | + > |
| 60 | + <div className="bg-white dark:bg-gray-900 rounded-2xl shadow-2xl w-full max-w-4xl border border-gray-200 dark:border-gray-700"> |
| 61 | + <div className="flex items-start justify-between p-6 border-b border-gray-200 dark:border-gray-800"> |
| 62 | + <div> |
| 63 | + <p className="text-xs font-semibold uppercase tracking-wide text-blue-600 dark:text-blue-300"> |
| 64 | + {t('guide.subtitle')} |
| 65 | + </p> |
| 66 | + <h2 className="text-2xl font-bold text-gray-900 dark:text-gray-100 mt-1"> |
| 67 | + {t('guide.title')} |
| 68 | + </h2> |
| 69 | + <p className="text-sm text-gray-600 dark:text-gray-300 mt-1"> |
| 70 | + {t('guide.lead')} |
| 71 | + </p> |
| 72 | + </div> |
| 73 | + <button |
| 74 | + type="button" |
| 75 | + onClick={onClose} |
| 76 | + className="inline-flex items-center justify-center p-2 rounded-full text-gray-500 hover:text-gray-900 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-gray-800" |
| 77 | + aria-label={t('guide.close')} |
| 78 | + > |
| 79 | + <X size={18} aria-hidden="true" /> |
| 80 | + </button> |
| 81 | + </div> |
| 82 | + |
| 83 | + <div className="grid md:grid-cols-2 gap-4 p-6"> |
| 84 | + {sections.map(({ icon: Icon, title, desc, bullets }) => ( |
| 85 | + <article key={title} className="rounded-xl border border-gray-200 dark:border-gray-800 p-4 bg-gray-50 dark:bg-gray-800/60"> |
| 86 | + <div className="flex items-center gap-3 mb-3"> |
| 87 | + <span className="p-2 rounded-lg bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-100"> |
| 88 | + <Icon size={18} aria-hidden="true" /> |
| 89 | + </span> |
| 90 | + <div> |
| 91 | + <h3 className="text-base font-semibold text-gray-900 dark:text-gray-100">{title}</h3> |
| 92 | + <p className="text-sm text-gray-600 dark:text-gray-300">{desc}</p> |
| 93 | + </div> |
| 94 | + </div> |
| 95 | + <ul className="space-y-2 text-sm text-gray-700 dark:text-gray-200"> |
| 96 | + {bullets.map((bullet, idx) => ( |
| 97 | + <li key={idx} className="flex items-start gap-2"> |
| 98 | + <span className="mt-1 text-blue-500" aria-hidden="true">•</span> |
| 99 | + <span>{bullet}</span> |
| 100 | + </li> |
| 101 | + ))} |
| 102 | + </ul> |
| 103 | + </article> |
| 104 | + ))} |
| 105 | + </div> |
| 106 | + |
| 107 | + <div className="px-6 py-4 border-t border-gray-200 dark:border-gray-800 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 bg-gray-50 dark:bg-gray-800/70 rounded-b-2xl"> |
| 108 | + <div className="text-sm text-gray-600 dark:text-gray-300"> |
| 109 | + {t('guide.footer')} |
| 110 | + </div> |
| 111 | + <button |
| 112 | + type="button" |
| 113 | + onClick={onClose} |
| 114 | + className="inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-lg shadow focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" |
| 115 | + > |
| 116 | + {t('guide.start')} |
| 117 | + </button> |
| 118 | + </div> |
| 119 | + </div> |
| 120 | + </div> |
| 121 | + ); |
| 122 | +} |
0 commit comments