feat(admin): add OCR entry to EntityNav sidebar and flyout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -122,6 +122,23 @@ function handleKeydown(event: KeyboardEvent) {
|
||||
</svg>
|
||||
{/snippet}
|
||||
|
||||
{#snippet ocrIcon()}
|
||||
<svg
|
||||
class="h-5 w-5 flex-shrink-0 {isActive('ocr') ? 'text-brand-mint' : 'text-white/40'}"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
||||
/>
|
||||
</svg>
|
||||
{/snippet}
|
||||
|
||||
<svelte:document onkeydown={handleKeydown} />
|
||||
|
||||
<!--
|
||||
@@ -188,6 +205,17 @@ function handleKeydown(event: KeyboardEvent) {
|
||||
icon={systemIcon}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if canRunMaintenance}
|
||||
<EntityNavSection
|
||||
variant="sidebar"
|
||||
href="/admin/ocr"
|
||||
label={m.admin_tab_ocr()}
|
||||
isActive={isActive('ocr')}
|
||||
onTabletTrigger={openFlyout}
|
||||
icon={ocrIcon}
|
||||
/>
|
||||
{/if}
|
||||
</nav>
|
||||
|
||||
{#if flyoutOpen}
|
||||
@@ -261,5 +289,16 @@ function handleKeydown(event: KeyboardEvent) {
|
||||
icon={systemIcon}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if canRunMaintenance}
|
||||
<EntityNavSection
|
||||
variant="flyout"
|
||||
href="/admin/ocr"
|
||||
label={m.admin_tab_ocr()}
|
||||
isActive={isActive('ocr')}
|
||||
onFlyoutClick={closeFlyout}
|
||||
icon={ocrIcon}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -79,3 +79,16 @@ describe('EntityNav — flyout', () => {
|
||||
await expect.element(page.getByRole('dialog')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('EntityNav — OCR entry', () => {
|
||||
it('renders OCR link when canRunMaintenance is true', async () => {
|
||||
render(EntityNav, props);
|
||||
await expect.element(page.getByRole('link', { name: /OCR/i })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('does not render OCR link when canRunMaintenance is false', async () => {
|
||||
render(EntityNav, { ...props, canRunMaintenance: false });
|
||||
const links = document.querySelectorAll('a[href="/admin/ocr"]');
|
||||
expect(links.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user