| // src/components/authoring/SubmissionExportPanel.tsx | |
| import { FileText, FileDown, Send, Loader2, Check, Download, Globe } from "lucide-react"; | |
| import type { ExportFormat } from "@/types/authoring"; | |
| interface SubmissionExportPanelProps { | |
| exporting: boolean; | |
| activeFormat: ExportFormat | null; | |
| options: any; | |
| setOptions: (o: any) => void; | |
| exportDocument: (format: ExportFormat) => void; | |
| submitToJournal: (journalId: string) => void; | |
| lastExportUrl: string | null; | |
| } | |
| const EXPORT_FORMATS: { format: ExportFormat; icon: typeof FileText; label: string; description: string }[] = [ | |
| { format: "pdf", icon: FileText, label: "PDF", description: "Ready for submission or sharing" }, | |
| { format: "docx", icon: FileText, label: "Word (.docx)", description: "Editable in Microsoft Word" }, | |
| { format: "latex", icon: FileText, label: "LaTeX Source", description: "Raw .tex files as ZIP" }, | |
| { format: "html", icon: Globe, label: "HTML", description: "Web-ready single file" }, | |
| { format: "markdown", icon: FileText, label: "Markdown", description: "Plain text with formatting" }, | |
| { format: "epub", icon: FileText, label: "EPUB", description: "E-reader compatible" }, | |
| ]; | |
| export function SubmissionExportPanel({ exporting, activeFormat, options, setOptions, exportDocument, submitToJournal }: SubmissionExportPanelProps) { | |
| return ( | |
| <div className="grid grid-cols-1 lg:grid-cols-3 gap-4 h-full"> | |
| {/* Format list */} | |
| <div className="space-y-1.5"> | |
| <h4 className="text-sm font-semibold flex items-center gap-2"><Download className="w-4 h-4 text-primary"/> Export Format</h4> | |
| {EXPORT_FORMATS.map(f => ( | |
| <button key={f.format} onClick={() => setOptions({ ...options, format: f.format })} | |
| className={`w-full flex items-start gap-3 p-2.5 rounded-xl text-left transition ${ | |
| options.format === f.format ? "bg-primary/10 border border-primary/30" : "hover:bg-white/5 border border-transparent" | |
| }`}> | |
| <f.icon className="w-4 h-4 text-primary mt-0.5 shrink-0"/> | |
| <div> | |
| <p className="text-sm font-medium">{f.label}</p> | |
| <p className="text-[10px] text-gray-500">{f.description}</p> | |
| </div> | |
| </button> | |
| ))} | |
| </div> | |
| {/* Options */} | |
| <div className="space-y-3"> | |
| <h4 className="text-sm font-semibold">Options</h4> | |
| <label className="flex items-center justify-between cursor-pointer text-sm"> | |
| <span>Include references</span> | |
| <input type="checkbox" checked={options.includeReferences} onChange={e => setOptions({ ...options, includeReferences: e.target.checked })} className="rounded"/> | |
| </label> | |
| <label className="flex items-center justify-between cursor-pointer text-sm"> | |
| <span>Include figures</span> | |
| <input type="checkbox" checked={options.includeFigures} onChange={e => setOptions({ ...options, includeFigures: e.target.checked })} className="rounded"/> | |
| </label> | |
| <label className="flex items-center justify-between cursor-pointer text-sm"> | |
| <span>Include comments</span> | |
| <input type="checkbox" checked={options.includeComments} onChange={e => setOptions({ ...options, includeComments: e.target.checked })} className="rounded"/> | |
| </label> | |
| <label className="flex items-center justify-between cursor-pointer text-sm"> | |
| <span>Draft watermark</span> | |
| <input type="checkbox" checked={options.draftWatermark} onChange={e => setOptions({ ...options, draftWatermark: e.target.checked })} className="rounded"/> | |
| </label> | |
| </div> | |
| {/* Export button */} | |
| <div className="space-y-3"> | |
| <h4 className="text-sm font-semibold">Generate</h4> | |
| <button onClick={() => exportDocument(options.format)} disabled={exporting} | |
| className="btn btn-primary w-full gap-2"> | |
| {exporting ? <Loader2 className="w-4 h-4 animate-spin"/> : <Download className="w-4 h-4"/>} | |
| {exporting ? `Exporting ${activeFormat?.toUpperCase()}...` : `Export as ${options.format.toUpperCase()}`} | |
| </button> | |
| <div className="relative"> | |
| <div className="absolute inset-0 flex items-center"><div className="w-full border-t border-white/20"/></div> | |
| <div className="relative flex justify-center text-xs"><span className="px-2 bg-white/5 text-gray-400">or</span></div> | |
| </div> | |
| <button onClick={() => submitToJournal("default")} disabled={exporting} | |
| className="btn btn-secondary w-full gap-2"> | |
| <Send className="w-4 h-4"/> Submit to Journal | |
| </button> | |
| </div> | |
| </div> | |
| ); | |
| } |
Xet Storage Details
- Size:
- 4.67 kB
- Xet hash:
- f880a5e88585be8df068df7e04738390a67632b71d81fa483e5bb5047e7749c8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.