Skip to content

Commit acae106

Browse files
committed
Revert "feat: add DropdownMenu component and integrate it into RibbonToolbar for enhanced file operations"
This reverts commit 4d377ef.
1 parent 89ac22c commit acae106

File tree

3 files changed

+99
-321
lines changed

3 files changed

+99
-321
lines changed

src/App.jsx

Lines changed: 44 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
Superscript, Subscript, FunctionSquare, FileUp, Save, ImagePlus, RotateCw
1313
} from 'lucide-react';
1414
import RibbonToolbar from './features/Toolbar/RibbonToolbar';
15-
import DropdownMenu from './features/Toolbar/DropdownMenu';
1615
import {
1716
escapeLatex,
1817
unescapeLatex,
@@ -105,14 +104,6 @@ export default function LiveLatexEditor() {
105104
const pdfReqIdRef = useRef(0);
106105
const pdfDebounceRef = useRef(null);
107106

108-
const docName = (() => {
109-
const fromPath = (activeFilePath || '').split('/').pop();
110-
if (fromPath) return fromPath;
111-
const fromHandle = activeFileHandle?.name;
112-
if (fromHandle) return fromHandle;
113-
return 'Untitled';
114-
})();
115-
116107
const focusMathInput = (el) => {
117108
if (!el) return;
118109
try {
@@ -2598,59 +2589,12 @@ export default function LiveLatexEditor() {
25982589
<div className="flex flex-col h-screen bg-slate-50 font-sans text-slate-800">
25992590
{/* Header */}
26002591
<header className="flex items-center justify-between px-6 py-2 bg-white border-b border-slate-200 shadow-sm z-20">
2601-
<div className="flex items-center gap-3 min-w-0">
2602-
<div className="bg-blue-600 p-1.5 rounded-lg text-white flex-shrink-0">
2603-
<NotebookPen size={22} />
2592+
<div className="flex items-center gap-3">
2593+
<div className="bg-blue-600 p-1.5 rounded-lg text-white">
2594+
<NotebookPen size={24} />
26042595
</div>
2605-
<div className="min-w-0">
2606-
<div className="flex items-center gap-2 min-w-0">
2607-
<h1 className="font-semibold text-[15px] leading-tight truncate">{docName}</h1>
2608-
{saving && <span className="text-[11px] text-slate-500">Saving…</span>}
2609-
</div>
2610-
<div className="mt-0.5 flex items-center gap-1">
2611-
<DropdownMenu
2612-
label="File"
2613-
ariaLabel="File menu"
2614-
items={[
2615-
{
2616-
key: 'open',
2617-
label: 'Open…',
2618-
subtle: 'Open a .tex/.txt file',
2619-
icon: FileUp,
2620-
onSelect: openFile,
2621-
},
2622-
{
2623-
key: 'save',
2624-
label: saving ? 'Saving…' : 'Save',
2625-
subtle: activeFileHandle ? (activeFilePath ? `Save ${activeFilePath}` : 'Save current file') : 'Download as .tex',
2626-
icon: Save,
2627-
disabled: saving,
2628-
onSelect: saveCurrentFile,
2629-
},
2630-
{ type: 'separator' },
2631-
{
2632-
key: 'export-pdf',
2633-
label: exporting ? 'Exporting…' : 'Export PDF',
2634-
subtle: 'Compile LaTeX and download PDF',
2635-
icon: Download,
2636-
disabled: exporting,
2637-
onSelect: exportAsPDF,
2638-
},
2639-
{
2640-
key: 'logs',
2641-
label: 'Logs',
2642-
subtle:
2643-
compileStatus === 'error'
2644-
? compileSummary || 'Compiler error'
2645-
: compileStatus === 'checking'
2646-
? 'Checking…'
2647-
: compileSummary || 'Show compiler log',
2648-
icon: FileText,
2649-
onSelect: showCompileLog,
2650-
},
2651-
]}
2652-
/>
2653-
</div>
2596+
<div>
2597+
<h1 className="font-bold text-lg leading-tight">Modern LaTex</h1>
26542598
</div>
26552599
</div>
26562600

@@ -2665,8 +2609,8 @@ export default function LiveLatexEditor() {
26652609
<button
26662610
key={key}
26672611
onClick={() => setActiveTab(key)}
2668-
className={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${
2669-
activeTab === key ? 'bg-white shadow-sm text-slate-900' : 'text-slate-600 hover:text-slate-800'
2612+
className={`px-3 py-1 text-xs uppercase font-bold tracking-wide rounded-md transition-all ${
2613+
activeTab === key ? 'bg-white shadow text-blue-600' : 'text-slate-500 hover:text-slate-700'
26702614
}`}
26712615
>
26722616
{label}
@@ -2675,16 +2619,16 @@ export default function LiveLatexEditor() {
26752619
</div>
26762620

26772621
{activeTab === 'both' && (
2678-
<div className="hidden sm:flex items-center gap-1 bg-slate-100 p-1 rounded-lg" aria-label="Preview mode">
2622+
<div className="flex items-center gap-1 bg-slate-100 p-1 rounded-lg" aria-label="Preview mode">
26792623
{[
26802624
{ key: 'visual', label: 'Visual' },
26812625
{ key: 'pdf', label: 'PDF' },
26822626
].map(({ key, label }) => (
26832627
<button
26842628
key={key}
26852629
onClick={() => setSplitPreviewMode(key)}
2686-
className={`px-2.5 py-1 text-xs font-medium rounded-md transition-all ${
2687-
splitPreviewMode === key ? 'bg-white shadow-sm text-slate-900' : 'text-slate-600 hover:text-slate-800'
2630+
className={`px-3 py-1 text-xs uppercase font-bold tracking-wide rounded-md transition-all ${
2631+
splitPreviewMode === key ? 'bg-white shadow text-blue-600' : 'text-slate-500 hover:text-slate-700'
26882632
}`}
26892633
>
26902634
{label}
@@ -2694,30 +2638,43 @@ export default function LiveLatexEditor() {
26942638
)}
26952639
</div>
26962640

2641+
2642+
<div className="flex items-center gap-2">
2643+
<button
2644+
onClick={openFile}
2645+
className="flex items-center gap-2 px-3 py-1.5 bg-slate-100 text-slate-700 rounded-md hover:bg-slate-200 transition-colors text-xs font-medium border border-slate-200"
2646+
title="Open .tex/.txt file"
2647+
>
2648+
<FileUp size={14} /> Open File
2649+
</button>
2650+
2651+
<button
2652+
onClick={saveCurrentFile}
2653+
disabled={saving}
2654+
className="flex items-center gap-2 px-3 py-1.5 bg-slate-100 text-slate-700 rounded-md hover:bg-slate-200 transition-colors text-xs font-medium border border-slate-200 disabled:opacity-50 disabled:cursor-not-allowed"
2655+
title={activeFileHandle ? (activeFilePath ? `Save ${activeFilePath}` : 'Save') : 'Download .tex'}
2656+
>
2657+
<Save size={14} /> {saving ? 'Saving…' : 'Save'}
2658+
</button>
2659+
2660+
<button
2661+
onClick={showCompileLog}
2662+
className="flex items-center gap-2 px-3 py-1.5 bg-slate-100 text-slate-700 rounded-md hover:bg-slate-200 transition-colors text-xs font-medium border border-slate-200"
2663+
title={compileStatus === 'error' ? (compileSummary || 'Compiler error') : (compileStatus === 'checking' ? 'Checking…' : (compileSummary || 'Show LaTeX compiler log'))}
2664+
>
2665+
<span className={`w-2 h-2 rounded-full ${compileStatus === 'checking' ? 'bg-amber-400 animate-pulse' : compileStatus === 'error' ? 'bg-red-500' : compileStatus === 'success' ? 'bg-emerald-500' : 'bg-slate-300'}`}></span>
2666+
<FileText size={14} /> Logs
2667+
</button>
2668+
26972669
<button
2698-
onClick={showCompileLog}
2699-
className="hidden md:flex items-center gap-2 px-2.5 py-1 bg-slate-50 text-slate-700 rounded-md hover:bg-slate-100 transition-colors text-xs font-medium border border-slate-200"
2700-
title={
2701-
compileStatus === 'error'
2702-
? compileSummary || 'Compiler error'
2703-
: compileStatus === 'checking'
2704-
? 'Checking…'
2705-
: compileSummary || 'Show LaTeX compiler log'
2706-
}
2670+
onClick={exportAsPDF}
2671+
className="flex items-center gap-2 px-3 py-1.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors text-xs font-medium disabled:opacity-50 disabled:cursor-not-allowed"
2672+
disabled={exporting}
2673+
title={exporting ? 'Compiling…' : 'Export LaTeX to PDF'}
27072674
>
2708-
<span
2709-
className={`w-2 h-2 rounded-full ${
2710-
compileStatus === 'checking'
2711-
? 'bg-amber-400 animate-pulse'
2712-
: compileStatus === 'error'
2713-
? 'bg-red-500'
2714-
: compileStatus === 'success'
2715-
? 'bg-emerald-500'
2716-
: 'bg-slate-300'
2717-
}`}
2718-
/>
2719-
Status
2675+
<Download size={14} /> {exporting ? 'Compiling…' : 'Export PDF'}
27202676
</button>
2677+
</div>
27212678
</header>
27222679

27232680
{/* Main Content */}

src/features/Toolbar/DropdownMenu.jsx

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)