diff --git a/frontend/src/lib/components/DocumentTopBar.svelte b/frontend/src/lib/components/DocumentTopBar.svelte index 1cdf5948..1112a1c3 100644 --- a/frontend/src/lib/components/DocumentTopBar.svelte +++ b/frontend/src/lib/components/DocumentTopBar.svelte @@ -43,6 +43,72 @@ const longDate = $derived(doc.documentDate ? formatDate(doc.documentDate, 'long' let mobileMenuOpen = $state(false); +{#snippet annotateBtn(mobile: boolean)} + +{/snippet} + +{#snippet annotateStopBtn(mobile: boolean)} + +{/snippet} + +{#snippet downloadLink(mobile: boolean)} + { + if (mobile) mobileMenuOpen = false; + }} + class={mobile + ? 'flex items-center gap-2 rounded px-3 py-2 text-[16px] text-ink transition hover:bg-muted focus-visible:ring-2 focus-visible:ring-primary' + : 'hidden rounded border border-transparent bg-muted p-1.5 text-ink transition hover:bg-accent focus-visible:ring-2 focus-visible:ring-primary md:block'} + title={m.doc_download_title()} + > + + {#if mobile}{m.doc_download_title()}{/if} + +{/snippet} +
@@ -102,37 +168,11 @@ let mobileMenuOpen = $state(false);
{#if canAnnotate && isPdf && !annotateMode} - + {@render annotateBtn(false)} {/if} {#if canAnnotate && isPdf && annotateMode} - + {@render annotateStopBtn(false)} {/if} {#if canWrite && !annotateMode} @@ -152,19 +192,7 @@ let mobileMenuOpen = $state(false); {/if} {#if doc.filePath && !annotateMode} - + {@render downloadLink(false)} {/if} @@ -197,59 +225,15 @@ let mobileMenuOpen = $state(false); class="absolute top-full right-0 z-50 mt-1 min-w-[200px] rounded-md border border-line bg-surface p-2 shadow-lg" > {#if canAnnotate && isPdf && !annotateMode} - + {@render annotateBtn(true)} {/if} {#if canAnnotate && isPdf && annotateMode} - + {@render annotateStopBtn(true)} {/if} {#if doc.filePath} - (mobileMenuOpen = false)} - class="flex items-center gap-2 rounded px-3 py-2 text-[16px] text-ink transition hover:bg-muted focus-visible:ring-2 focus-visible:ring-primary" - > - - {m.doc_download_title()} - + {@render downloadLink(true)} {/if}
{/if}