import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { PublicLayout } from '../../components/layout'; import { FileText, BookOpen, Rocket, Package, BarChart3, Settings, Users, Shield, CreditCard, HelpCircle, ChevronRight, PlayCircle, CheckCircle2, AlertCircle, Info, Download, ExternalLink } from 'lucide-react'; interface DocSection { id: string; title: string; description: string; icon: React.ComponentType<{ className?: string }>; articles: DocArticle[]; } interface DocArticle { id: string; title: string; description: string; readTime: string; difficulty: 'beginner' | 'intermediate' | 'advanced'; } const DocumentationPage: React.FC = () => { const { t } = useTranslation('help'); const [activeSection, setActiveSection] = useState('getting-started'); const [selectedArticle, setSelectedArticle] = useState<{ sectionId: string; articleId: string } | null>(null); const sections: DocSection[] = [ { id: 'getting-started', title: t('categories.gettingStarted.title'), description: t('categories.gettingStarted.description'), icon: Rocket, articles: [ { id: 'quick-start', title: t('articles.gettingStarted.quickStart.title'), description: t('articles.gettingStarted.quickStart.description'), readTime: `${t('articles.gettingStarted.quickStart.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, { id: 'import-data', title: t('articles.gettingStarted.importData.title'), description: t('articles.gettingStarted.importData.description'), readTime: `${t('articles.gettingStarted.importData.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, { id: 'products-catalog', title: t('articles.gettingStarted.productsCatalog.title'), description: t('articles.gettingStarted.productsCatalog.description'), readTime: `${t('articles.gettingStarted.productsCatalog.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, { id: 'first-prediction', title: t('articles.gettingStarted.firstPrediction.title'), description: t('articles.gettingStarted.firstPrediction.description'), readTime: `${t('articles.gettingStarted.firstPrediction.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, ], }, { id: 'features', title: t('categories.features.title'), description: t('categories.features.description'), icon: Package, articles: [ { id: 'demand-forecasting', title: t('articles.features.demandForecasting.title'), description: t('articles.features.demandForecasting.description'), readTime: `${t('articles.features.demandForecasting.readTime')} ${t('docs.readTime')}`, difficulty: 'intermediate', }, { id: 'production-planning', title: t('articles.features.productionPlanning.title'), description: t('articles.features.productionPlanning.description'), readTime: `${t('articles.features.productionPlanning.readTime')} ${t('docs.readTime')}`, difficulty: 'intermediate', }, { id: 'inventory-management', title: t('articles.features.inventoryManagement.title'), description: t('articles.features.inventoryManagement.description'), readTime: `${t('articles.features.inventoryManagement.readTime')} ${t('docs.readTime')}`, difficulty: 'intermediate', }, { id: 'pos-integration', title: t('articles.features.posIntegration.title'), description: t('articles.features.posIntegration.description'), readTime: `${t('articles.features.posIntegration.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, { id: 'waste-tracking', title: t('articles.features.wasteTracking.title'), description: t('articles.features.wasteTracking.description'), readTime: `${t('articles.features.wasteTracking.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, ], }, { id: 'analytics', title: t('categories.analytics.title'), description: t('categories.analytics.description'), icon: BarChart3, articles: [ { id: 'dashboard-overview', title: t('articles.analytics.dashboardOverview.title'), description: t('articles.analytics.dashboardOverview.description'), readTime: `${t('articles.analytics.dashboardOverview.readTime')} ${t('docs.readTime')}`, difficulty: 'beginner', }, { id: 'reports', title: t('articles.analytics.reports.title'), description: t('articles.analytics.reports.description'), readTime: `${t('articles.analytics.reports.readTime')} ${t('docs.readTime')}`, difficulty: 'intermediate', }, { id: 'ai-insights', title: t('articles.analytics.aiInsights.title'), description: t('articles.analytics.aiInsights.description'), readTime: `${t('articles.analytics.aiInsights.readTime')} ${t('docs.readTime')}`, difficulty: 'advanced', }, { id: 'performance-metrics', title: t('articles.analytics.performanceMetrics.title'), description: t('articles.analytics.performanceMetrics.description'), readTime: `${t('articles.analytics.performanceMetrics.readTime')} ${t('docs.readTime')}`, difficulty: 'intermediate', }, ], }, { id: 'account', title: t('categories.account.title'), description: t('categories.account.description'), icon: Settings, articles: [ { id: 'profile-settings', title: 'Configuración de Perfil', description: 'Actualiza tu información personal y preferencias', readTime: '4 min', difficulty: 'beginner', }, { id: 'team-management', title: 'Gestionar Equipo', description: 'Añade miembros, asigna roles y permisos', readTime: '7 min', difficulty: 'intermediate', }, { id: 'notifications', title: 'Notificaciones y Alertas', description: 'Configura cómo y cuándo recibir avisos', readTime: '5 min', difficulty: 'beginner', }, { id: 'integrations', title: 'Integraciones', description: 'Conecta con TPV, contabilidad y otras herramientas', readTime: '10 min', difficulty: 'advanced', }, ], }, { id: 'billing', title: t('categories.billing.title'), description: t('categories.billing.description'), icon: CreditCard, articles: [ { id: 'pricing-plans', title: 'Planes y Precios', description: 'Compara características de cada plan', readTime: '6 min', difficulty: 'beginner', }, { id: 'payment-methods', title: 'Métodos de Pago', description: 'Añade, modifica o elimina tarjetas', readTime: '4 min', difficulty: 'beginner', }, { id: 'invoices', title: 'Facturas y Recibos', description: 'Descarga y gestiona tu historial de facturación', readTime: '5 min', difficulty: 'beginner', }, { id: 'cancel-subscription', title: 'Cancelar o Pausar Suscripción', description: 'Cómo proceder si necesitas hacer una pausa', readTime: '3 min', difficulty: 'beginner', }, ], }, { id: 'privacy', title: t('categories.privacy.title'), description: t('categories.privacy.description'), icon: Shield, articles: [ { id: 'gdpr-compliance', title: 'Cumplimiento RGPD', description: 'Cómo protegemos tus datos según normativa europea', readTime: '10 min', difficulty: 'intermediate', }, { id: 'data-export', title: 'Exportar Tus Datos', description: 'Descarga toda tu información en cualquier momento', readTime: '5 min', difficulty: 'beginner', }, { id: 'data-deletion', title: 'Eliminar Tu Cuenta', description: 'Procedimiento para borrar permanentemente tus datos', readTime: '6 min', difficulty: 'beginner', }, { id: 'security-best-practices', title: 'Mejores Prácticas de Seguridad', description: 'Protege tu cuenta con 2FA y contraseñas fuertes', readTime: '8 min', difficulty: 'intermediate', }, ], }, ]; const activeContent = sections.find((s) => s.id === activeSection); const getDifficultyColor = (difficulty: string) => { switch (difficulty) { case 'beginner': return 'text-green-600 dark:text-green-400'; case 'intermediate': return 'text-amber-600 dark:text-amber-400'; case 'advanced': return 'text-red-600 dark:text-red-400'; default: return 'text-[var(--text-tertiary)]'; } }; const getDifficultyLabel = (difficulty: string) => { return t(`difficulty.${difficulty}` as any) || difficulty; }; const getCategoryKey = (sectionId: string): string => { const categoryMap: Record = { 'getting-started': 'gettingStarted', 'features': 'features', 'analytics': 'analytics', 'account': 'account', 'billing': 'billing', 'privacy': 'privacy', }; return categoryMap[sectionId] || sectionId; }; const getArticleKey = (articleId: string): string => { const articleMap: Record = { 'quick-start': 'quickStart', 'import-data': 'importData', 'products-catalog': 'productsCatalog', 'first-prediction': 'firstPrediction', 'demand-forecasting': 'demandForecasting', 'production-planning': 'productionPlanning', 'inventory-management': 'inventoryManagement', 'pos-integration': 'posIntegration', 'waste-tracking': 'wasteTracking', 'dashboard-overview': 'dashboardOverview', 'reports': 'reports', 'ai-insights': 'aiInsights', 'performance-metrics': 'performanceMetrics', }; return articleMap[articleId] || articleId; }; const handleArticleClick = (sectionId: string, articleId: string) => { setSelectedArticle({ sectionId, articleId }); window.scrollTo({ top: 0, behavior: 'smooth' }); }; const handleBackToList = () => { setSelectedArticle(null); }; const renderArticleContent = () => { if (!selectedArticle) return null; const categoryKey = getCategoryKey(selectedArticle.sectionId); const articleKey = getArticleKey(selectedArticle.articleId); const contentPath = `articles.${categoryKey}.${articleKey}.content`; const content: any = t(contentPath, { returnObjects: true }); const article = sections .find((s) => s.id === selectedArticle.sectionId) ?.articles.find((a) => a.id === selectedArticle.articleId); if (!article || !content) return null; return (
{/* Back Button */} {/* Article Header */}

{article.title}

{article.description}

{article.readTime} {getDifficultyLabel(article.difficulty)}
{/* Article Content */}
{/* Intro */} {content.intro && (

{content.intro}

)} {/* Steps */} {content.steps && Array.isArray(content.steps) && (
{content.steps.map((step: any, index: number) => (

{step.title}

{step.description}

))}
)} {/* Tips */} {content.tips && Array.isArray(content.tips) && content.tips.length > 0 && (

Consejos Útiles

    {content.tips.map((tip: string, index: number) => (
  • {tip}
  • ))}
)} {/* Conclusion */} {content.conclusion && (

{content.conclusion}

)}
{/* Back to List Button */}
); }; return ( {/* Hero Section */}
{/* Documentation Content */}
{/* Sidebar Navigation */}

{t('docs.sectionsTitle')}

{/* Quick Links */}

{t('docs.quickLinks')}

{t('docs.backToHelp')} {t('docs.contactSupport')} {t('docs.downloadPdf')}
{/* Main Content */}
{selectedArticle ? ( renderArticleContent() ) : ( activeContent && (
{/* Section Header */}

{activeContent.title}

{activeContent.description}

{/* Articles Grid */}
{activeContent.articles.map((article) => ( ))}
) )}
{/* Video Tutorials */}

{t('docs.videoTutorialsTitle')}

{t('docs.videoTutorialsSubtitle')}

{[ { title: 'Configuración Inicial', duration: '5:30', thumbnail: 'getting-started', }, { title: 'Importar Datos Históricos', duration: '8:15', thumbnail: 'import-data', }, { title: 'Tu Primera Predicción', duration: '12:00', thumbnail: 'first-prediction', }, ].map((video, index) => (
{video.duration}

{video.title}

))}
{/* Additional Resources */}

{t('docs.additionalResourcesTitle')}

{t('resources.glossary.title')}

{t('resources.glossary.description')}

{t('resources.glossary.action')} →

{t('resources.troubleshooting.title')}

{t('resources.troubleshooting.description')}

{t('resources.troubleshooting.action')} →

{t('resources.bestPractices.title')}

{t('resources.bestPractices.description')}

{t('resources.bestPractices.action')} →
{/* CTA */}

{t('docs.ctaTitle')}

{t('docs.ctaSubtitle')}

{t('docs.ctaButton')}
); }; export default DocumentationPage;