Hide LaTeX-only compile options for Typst/Quarto projects; add smooth_pdf_transition translations
Build and Deploy Verso / deploy (push) Successful in 9m35s

Draft compile mode and stop-on-first-error are LaTeX-only features not
supported by TypstRunner or QuartoRunner. Hide both sections from the
recompile dropdown for non-LaTeX projects. Also detect Quarto root files
(.qmd/.md/.Rmd) alongside Typst (.typ) to correctly set isLatexProject.

Add missing smooth_pdf_transition translations for French, Spanish, and
German (the English key already existed).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-08 13:45:02 +00:00
parent 1c323351a2
commit f1abcaa4ce
6 changed files with 69 additions and 41 deletions
@@ -50,6 +50,7 @@ function PdfCompileButton() {
recompileFromScratch,
smoothPdfTransition,
setSmoothPdfTransition,
isLatexProject,
} = useCompileContext()
const { enableStopOnFirstError, disableStopOnFirstError } =
useStopOnFirstError({ eventSource: 'dropdown' })
@@ -171,26 +172,30 @@ function PdfCompileButton() {
{t('off')}
</DropdownItem>
</li>
<DropdownDivider />
<DropdownHeader>{t('compile_mode')}</DropdownHeader>
<li role="none">
<DropdownItem
as="button"
onClick={() => sendEventAndSet(false, setDraft, 'compile-mode')}
trailingIcon={!draft ? 'check' : null}
>
{t('normal')}
</DropdownItem>
</li>
<li role="none">
<DropdownItem
as="button"
onClick={() => sendEventAndSet(true, setDraft, 'compile-mode')}
trailingIcon={draft ? 'check' : null}
>
{t('fast')}&nbsp;<span className="subdued">[draft]</span>
</DropdownItem>
</li>
{isLatexProject && (
<>
<DropdownDivider />
<DropdownHeader>{t('compile_mode')}</DropdownHeader>
<li role="none">
<DropdownItem
as="button"
onClick={() => sendEventAndSet(false, setDraft, 'compile-mode')}
trailingIcon={!draft ? 'check' : null}
>
{t('normal')}
</DropdownItem>
</li>
<li role="none">
<DropdownItem
as="button"
onClick={() => sendEventAndSet(true, setDraft, 'compile-mode')}
trailingIcon={draft ? 'check' : null}
>
{t('fast')}&nbsp;<span className="subdued">[draft]</span>
</DropdownItem>
</li>
</>
)}
<DropdownDivider />
<DropdownHeader>{t('syntax_checks')}</DropdownHeader>
<li role="none">
@@ -215,26 +220,30 @@ function PdfCompileButton() {
{t('ignore_validation_errors')}
</DropdownItem>
</li>
<DropdownDivider />
<DropdownHeader>{t('compile_error_handling')}</DropdownHeader>
<li role="none">
<DropdownItem
as="button"
onClick={enableStopOnFirstError}
trailingIcon={stopOnFirstError ? 'check' : null}
>
{t('stop_on_first_error')}
</DropdownItem>
</li>
<li role="none">
<DropdownItem
as="button"
onClick={disableStopOnFirstError}
trailingIcon={!stopOnFirstError ? 'check' : null}
>
{t('try_to_compile_despite_errors')}
</DropdownItem>
</li>
{isLatexProject && (
<>
<DropdownDivider />
<DropdownHeader>{t('compile_error_handling')}</DropdownHeader>
<li role="none">
<DropdownItem
as="button"
onClick={enableStopOnFirstError}
trailingIcon={stopOnFirstError ? 'check' : null}
>
{t('stop_on_first_error')}
</DropdownItem>
</li>
<li role="none">
<DropdownItem
as="button"
onClick={disableStopOnFirstError}
trailingIcon={!stopOnFirstError ? 'check' : null}
>
{t('try_to_compile_despite_errors')}
</DropdownItem>
</li>
</>
)}
<DropdownDivider />
<DropdownHeader>{t('smooth_pdf_transition')}</DropdownHeader>
<li role="none">
@@ -76,6 +76,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
activeOverallTheme: _activeOverallTheme,
smoothPdfTransition: _smoothPdfTransition,
setSmoothPdfTransition: _setSmoothPdfTransition,
isLatexProject: _isLatexProject,
} = localCompileContext
const [animateCompileDropdownArrow] = useDetachStateWatcher(
@@ -152,6 +153,12 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
'detacher',
'detached'
)
const [isLatexProject] = useDetachStateWatcher(
'isLatexProject',
_isLatexProject,
'detacher',
'detached'
)
const [lastCompileOptions] = useDetachStateWatcher(
'lastCompileOptions',
_lastCompileOptions,
@@ -474,6 +481,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
activeOverallTheme,
smoothPdfTransition,
setSmoothPdfTransition,
isLatexProject,
}),
[
animateCompileDropdownArrow,
@@ -532,6 +540,7 @@ export const DetachCompileProvider: FC<React.PropsWithChildren> = ({
activeOverallTheme,
smoothPdfTransition,
setSmoothPdfTransition,
isLatexProject,
]
)
@@ -132,6 +132,7 @@ export type CompileContext = {
darkModePdf: boolean | undefined
setDarkModePdf: (value: boolean) => void
activeOverallTheme: ActiveOverallTheme
isLatexProject: boolean
}
export const LocalCompileContext = createContext<CompileContext | undefined>(
@@ -302,6 +303,8 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
{ listen: true }
)
const [isTypstProject, setIsTypstProject] = useState(false)
const [isQuartoProject, setIsQuartoProject] = useState(false)
const isLatexProject = !isTypstProject && !isQuartoProject
const smoothPdfTransition = isTypstProject
? smoothTransitionTypst
: smoothTransitionLatex
@@ -380,8 +383,10 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
// distinguish "no stored preference" from an explicit user choice.
useEffect(() => {
const { rootResourcePath } = getRootDocInfo()
const isTypst = rootResourcePath.endsWith('.typ')
const isTypst = /\.typ$/i.test(rootResourcePath)
const isQuarto = /\.(qmd|md|rmd)$/i.test(rootResourcePath)
setIsTypstProject(isTypst)
setIsQuartoProject(isQuarto)
if (!isTypst) return
// Default auto-compile ON for Typst — only if user has never set a pref.
if (window.localStorage.getItem(`autocompile_enabled:${projectId}`) === null) {
@@ -873,6 +878,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
activeOverallTheme,
smoothPdfTransition,
setSmoothPdfTransition,
isLatexProject,
}),
[
animateCompileDropdownArrow,
@@ -930,6 +936,7 @@ export const LocalCompileProvider: FC<React.PropsWithChildren> = ({
activeOverallTheme,
smoothPdfTransition,
setSmoothPdfTransition,
isLatexProject,
]
)
+1
View File
@@ -1396,6 +1396,7 @@
"state": "Status",
"status_checks": "Statusüberprüfungen",
"still_have_questions": "Hast du noch Fragen?",
"smooth_pdf_transition": "Weicher PDF-Übergang",
"stop_compile": "Kompiliervorgang stoppen",
"stop_on_first_error": "Beim ersten Fehler anhalten",
"stop_on_first_error_enabled_description": "<0>„Anhalten beim ersten Fehler“ ist aktiviert.</0> Durch Deaktivieren kann der Compiler möglicherweise eine PDF-Datei erstellen (Das Projekt wird aber weiterhin Fehler enthalten).",
+1
View File
@@ -541,6 +541,7 @@
"share_project": "Compartir proyecto",
"shared_with_you": "Compartidos contigo",
"single_sign_on_sso": "Single Sign-On (SSO)",
"smooth_pdf_transition": "Transición suave del PDF",
"something_went_wrong_rendering_pdf": "Algo ha fallado al renderizar este PDF.",
"somthing_went_wrong_compiling": "Disculpa, algo anduvo mal y tu proyecto no se pudo compilar. Por favor, intenta de nuevo en unos minutos más.",
"source": "Fuente",
+1
View File
@@ -1031,6 +1031,7 @@
"state": "État",
"status_checks": "Vérifications d’état",
"still_have_questions": "Vous avez dautres questions ?",
"smooth_pdf_transition": "Transition PDF fluide",
"stop_compile": "Arrêter la compilation",
"stop_on_first_error": "Arrêter à la première erreur",
"stop_on_validation_error": "Vérifier la syntaxe avant la compilation",