refactor(documents): unify count + action links into one row
Move result count, bulk-edit button, and new-document link into a shared flex row so they appear on the same line. Adds an edit icon to the bulk-edit button to visually match the existing plus icon on the add link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,14 +13,12 @@ let {
|
|||||||
items,
|
items,
|
||||||
canWrite,
|
canWrite,
|
||||||
error,
|
error,
|
||||||
total = 0,
|
|
||||||
q = '',
|
q = '',
|
||||||
sort = 'DATE'
|
sort = 'DATE'
|
||||||
}: {
|
}: {
|
||||||
items: DocumentSearchItem[];
|
items: DocumentSearchItem[];
|
||||||
canWrite: boolean;
|
canWrite: boolean;
|
||||||
error?: string | null;
|
error?: string | null;
|
||||||
total?: number;
|
|
||||||
q?: string;
|
q?: string;
|
||||||
sort?: SortMode;
|
sort?: SortMode;
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -71,29 +69,6 @@ function groupByReceiver(docItems: DocumentSearchItem[]) {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- DOCUMENT LIST HEADER -->
|
|
||||||
<div class="mb-2 flex justify-end">
|
|
||||||
{#if canWrite}
|
|
||||||
<a
|
|
||||||
href="/documents/new"
|
|
||||||
class="inline-flex items-center gap-1 text-sm font-medium text-ink-2 transition-colors hover:text-ink"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="/degruyter-icons/Simple/Medium-24px/SVG/Action/Add/Add-General-MD.svg"
|
|
||||||
alt=""
|
|
||||||
aria-hidden="true"
|
|
||||||
class="h-4 w-4"
|
|
||||||
/>
|
|
||||||
{m.docs_btn_new()}
|
|
||||||
</a>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- RESULT COUNT -->
|
|
||||||
{#if total > 0}
|
|
||||||
<p class="mb-3 font-sans text-base text-ink-2">{m.docs_result_count({ count: total })}</p>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- ERROR -->
|
<!-- ERROR -->
|
||||||
{#if error}
|
{#if error}
|
||||||
<div class="border border-line bg-surface shadow-sm">
|
<div class="border border-line bg-surface shadow-sm">
|
||||||
|
|||||||
@@ -234,28 +234,54 @@ $effect(() => {
|
|||||||
onblur={() => (qFocused = false)}
|
onblur={() => (qFocused = false)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if data.canWrite && data.totalElements > 0}
|
<div class="mb-3 flex items-center justify-between gap-4">
|
||||||
<div class="mb-2 flex flex-col items-end gap-1">
|
<p class="font-sans text-base text-ink-2">
|
||||||
<button
|
{#if data.totalElements > 0}{m.docs_result_count({ count: data.totalElements })}{/if}
|
||||||
type="button"
|
</p>
|
||||||
onclick={editAllMatching}
|
{#if data.canWrite}
|
||||||
disabled={editingAll}
|
<div class="flex flex-col items-end gap-1">
|
||||||
class="inline-flex items-center gap-1 text-sm font-medium text-ink-2 transition-colors hover:text-ink disabled:opacity-50"
|
<div class="flex items-center gap-4">
|
||||||
data-testid="bulk-edit-all-x"
|
{#if data.totalElements > 0}
|
||||||
>
|
<button
|
||||||
{m.bulk_edit_all_x({ count: data.totalElements })}
|
type="button"
|
||||||
</button>
|
onclick={editAllMatching}
|
||||||
{#if editAllError}
|
disabled={editingAll}
|
||||||
<p role="alert" class="text-xs text-danger" data-testid="bulk-edit-all-x-error">
|
class="inline-flex cursor-pointer items-center gap-1 text-sm font-medium text-ink-2 transition-colors hover:text-ink disabled:opacity-50"
|
||||||
{editAllError}
|
data-testid="bulk-edit-all-x"
|
||||||
</p>
|
>
|
||||||
{/if}
|
<img
|
||||||
</div>
|
src="/degruyter-icons/Simple/Medium-24px/SVG/Action/Edit-Content-MD.svg"
|
||||||
{/if}
|
alt=""
|
||||||
|
aria-hidden="true"
|
||||||
|
class="h-4 w-4"
|
||||||
|
/>
|
||||||
|
{m.bulk_edit_all_x({ count: data.totalElements })}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
<a
|
||||||
|
href="/documents/new"
|
||||||
|
class="inline-flex items-center gap-1 text-sm font-medium text-ink-2 transition-colors hover:text-ink"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="/degruyter-icons/Simple/Medium-24px/SVG/Action/Add/Add-General-MD.svg"
|
||||||
|
alt=""
|
||||||
|
aria-hidden="true"
|
||||||
|
class="h-4 w-4"
|
||||||
|
/>
|
||||||
|
{m.docs_btn_new()}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{#if editAllError}
|
||||||
|
<p role="alert" class="text-xs text-danger" data-testid="bulk-edit-all-x-error">
|
||||||
|
{editAllError}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<DocumentList
|
<DocumentList
|
||||||
items={data.items}
|
items={data.items}
|
||||||
total={data.totalElements}
|
|
||||||
q={data.q}
|
q={data.q}
|
||||||
canWrite={data.canWrite}
|
canWrite={data.canWrite}
|
||||||
error={data.error}
|
error={data.error}
|
||||||
|
|||||||
Reference in New Issue
Block a user