import { useApp } from "../app-state"; export function TopBar() { const { state, dispatch, lsp } = useApp(); const lspChip = () => { switch (lsp.status) { case "ready": return ( LSP ); case "connecting": return ( LSP ); case "error": return ( LSP ); default: return null; } }; const previewChip = () => { // No preview without an open file (tinymist previews a document). if (!state.openFile) return null; if (lsp.previewReady) { return ( Preview ); } if (lsp.status === "ready") { return ( Preview · starting ); } return null; }; return (
typst-leaf · {state.currentProject ? ( <> {state.currentProject} {state.openFile && ( <> / {state.openFile} {state.fileDirty && *} )}
{lspChip()} {previewChip()}
) : ( Select a project to begin )}
); }