fix(ocr): remove progress bar, keep text-only page counter
The thin bar without a border looked broken at low progress values. The text counter (e.g. "1 / 6") already communicates progress clearly so the bar is unnecessary. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,26 +8,17 @@ let {
|
||||
totalPages: number;
|
||||
skippedPages?: number;
|
||||
} = $props();
|
||||
|
||||
let percentage = $derived((currentPage / totalPages) * 100);
|
||||
</script>
|
||||
|
||||
{#if totalPages > 0}
|
||||
<div class="flex flex-col items-center">
|
||||
<div
|
||||
class="bg-brand-sand mx-auto mt-4 h-2 w-full max-w-xs rounded-full"
|
||||
role="progressbar"
|
||||
aria-valuenow={currentPage}
|
||||
aria-valuemax={totalPages}
|
||||
aria-label="OCR progress"
|
||||
>
|
||||
<div
|
||||
class="h-full rounded-full bg-brand-mint transition-all duration-500"
|
||||
data-testid="progress-fill"
|
||||
style="width: {percentage}%"
|
||||
></div>
|
||||
</div>
|
||||
<span class="mt-1 text-xs text-gray-400 tabular-nums">
|
||||
<div
|
||||
class="mt-2 flex flex-col items-center"
|
||||
role="progressbar"
|
||||
aria-valuenow={currentPage}
|
||||
aria-valuemax={totalPages}
|
||||
aria-label="OCR progress"
|
||||
>
|
||||
<span class="text-xs text-gray-400 tabular-nums">
|
||||
{currentPage} / {totalPages}
|
||||
</span>
|
||||
{#if skippedPages > 0}
|
||||
|
||||
@@ -6,26 +6,18 @@ import OcrProgressBar from './OcrProgressBar.svelte';
|
||||
afterEach(cleanup);
|
||||
|
||||
describe('OcrProgressBar', () => {
|
||||
it('renders progress bar with correct ARIA attributes', async () => {
|
||||
it('renders with correct ARIA attributes', async () => {
|
||||
render(OcrProgressBar, { currentPage: 2, totalPages: 5 });
|
||||
const bar = page.getByRole('progressbar');
|
||||
await expect.element(bar).toHaveAttribute('aria-valuenow', '2');
|
||||
await expect.element(bar).toHaveAttribute('aria-valuemax', '5');
|
||||
});
|
||||
|
||||
it('hides progress bar when totalPages is zero', async () => {
|
||||
it('hides when totalPages is zero', async () => {
|
||||
render(OcrProgressBar, { currentPage: 0, totalPages: 0 });
|
||||
await expect.element(page.getByRole('progressbar')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('fills to 100 percent when current equals total', async () => {
|
||||
render(OcrProgressBar, { currentPage: 5, totalPages: 5 });
|
||||
const fill = page.getByTestId('progress-fill');
|
||||
await expect.element(fill).toBeInTheDocument();
|
||||
const el = fill.element() as HTMLElement;
|
||||
expect(el.style.width).toBe('100%');
|
||||
});
|
||||
|
||||
it('shows page counter text', async () => {
|
||||
render(OcrProgressBar, { currentPage: 3, totalPages: 7 });
|
||||
await expect.element(page.getByText('3 / 7')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user