diff --git a/src/components/LoginModal.jsx b/src/components/LoginModal.jsx index f1b6c49..52dc89c 100644 --- a/src/components/LoginModal.jsx +++ b/src/components/LoginModal.jsx @@ -2,99 +2,173 @@ import React, { useState, useEffect } from 'react'; import { X, LogIn, UserPlus, Github, Mail } from 'lucide-react'; import { api } from '../services/api'; -// Custom Markdown Renderer to ensure consistent styling without dependencies +// Custom Markdown Renderer const renderMarkdown = (text) => { if (!text) return null; const lines = text.split('\n'); const elements = []; let listBuffer = []; - let currentIndent = 0; // 0 for H1, 1 for H2, 2 for H3... used for indentation + + // Track context for indentation of non-header content + // Default (start/after H1): ml-4 + // After H2 (ml-0): ml-4 + // After H3 (ml-4): ml-8 + // After H4 (ml-8): ml-12 + let contentIndentClass = 'ml-4'; // Helper to parse inline styles (Bold and Links) const parseInline = (text) => { + if (!text) return { __html: '' }; + // Pass 1: Links [text](url) - // We use a callback to handle styling logic let processed = text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (match, txt, url) => { const isGreen = txt.includes('CR200J') || url.includes('CR200J'); const classes = isGreen ? "text-emerald-600 hover:text-emerald-800 hover:underline transition-colors font-medium" : "text-blue-600 hover:text-blue-800 hover:underline transition-colors font-medium"; - // Ensure we don't break subsequent bold parsing if link text has stars (unlikely but safe to assume standard markdown) return `${txt}`; }); // Pass 2: Bold (**text**) - // We strictly match **...** and wrap in - // Note: This simple regex might struggle with nested complex HTML but works for standard MD usage here. processed = processed.replace(/\*\*(.*?)\*\*/g, '$1'); return { __html: processed }; }; + // Helper to render buffered list items into a nested structure const flushList = () => { - if (listBuffer.length > 0) { - elements.push( -