|
| 1 | +'use client' |
| 2 | + |
| 3 | +import { useState } from 'react' |
| 4 | +import Image from 'next/image' |
| 5 | +import { useCredentialsStore } from '../lib/store' |
| 6 | +import { SettingsSheet } from '../components/settings-sheet' |
| 7 | +import { CredentialsPrompt } from '../components/credentials-prompt' |
| 8 | +import { OjsSearch } from '../components/ojs-search' |
| 9 | +import { SubmissionPanel } from '../components/submission-panel' |
| 10 | +import { ConversionDropzone } from '../components/conversion-dropzone' |
| 11 | +import { LatexOutput } from '../components/latex-output' |
| 12 | +import { Separator } from '../components/ui/separator' |
| 13 | + |
| 14 | +export default function Page() { |
| 15 | + const { token, endpoint } = useCredentialsStore() |
| 16 | + const [skippedSetup, setSkippedSetup] = useState(false) |
| 17 | + const hasCredentials = Boolean(token && endpoint) |
| 18 | + |
| 19 | + return ( |
| 20 | + <div className="min-h-screen"> |
| 21 | + <header className="sticky top-0 z-40 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"> |
| 22 | + <div className="mx-auto flex h-14 max-w-5xl items-center justify-between px-4"> |
| 23 | + <div className="flex items-center gap-3"> |
| 24 | + <Image src="/favicon.png" alt="JOTE" width={28} height={28} /> |
| 25 | + <div className="flex items-baseline gap-2"> |
| 26 | + <h1 className="text-lg font-semibold tracking-tight">JOTE Converter</h1> |
| 27 | + <span className="hidden text-xs text-muted-foreground sm:inline">DOCX to LaTeX</span> |
| 28 | + </div> |
| 29 | + </div> |
| 30 | + <SettingsSheet /> |
| 31 | + </div> |
| 32 | + </header> |
| 33 | + |
| 34 | + <main className="mx-auto max-w-5xl space-y-6 px-4 py-8"> |
| 35 | + {!hasCredentials && !skippedSetup ? ( |
| 36 | + <CredentialsPrompt onSkip={() => setSkippedSetup(true)} /> |
| 37 | + ) : ( |
| 38 | + <> |
| 39 | + {hasCredentials && ( |
| 40 | + <> |
| 41 | + <section> |
| 42 | + <OjsSearch /> |
| 43 | + </section> |
| 44 | + <SubmissionPanel /> |
| 45 | + <Separator /> |
| 46 | + </> |
| 47 | + )} |
| 48 | + |
| 49 | + <section className="space-y-4"> |
| 50 | + <h2 className="text-base font-medium"> |
| 51 | + {hasCredentials ? 'Or upload a file directly' : 'Upload a .docx file'} |
| 52 | + </h2> |
| 53 | + <ConversionDropzone /> |
| 54 | + </section> |
| 55 | + |
| 56 | + <LatexOutput /> |
| 57 | + </> |
| 58 | + )} |
| 59 | + </main> |
| 60 | + |
| 61 | + <footer className="border-t py-6"> |
| 62 | + <div className="mx-auto flex max-w-5xl items-center justify-center gap-2 px-4 text-xs text-muted-foreground"> |
| 63 | + <Image src="/favicon.png" alt="" width={16} height={16} className="opacity-50" /> |
| 64 | + <span>Center of Trial & Error</span> |
| 65 | + </div> |
| 66 | + </footer> |
| 67 | + </div> |
| 68 | + ) |
| 69 | +} |
0 commit comments