|
22 | 22 | import { getIncompleteIterationItems } from './iterationCompletion.js'; |
23 | 23 | import CompleteIterationDialog from '../../dialogs/CompleteIterationDialog.svelte'; |
24 | 24 | import { workspacesStore } from '../../stores/workspaces.svelte.js'; |
| 25 | + import { formatItemCount } from '../../utils/itemCount.js'; |
25 | 26 | import { isSystemFieldAvailableForItem } from '../../utils/screenFields.js'; |
26 | 27 |
|
27 | 28 | let { workspaceId, collectionId = null } = $props(); |
|
246 | 247 | ), collapsedSections.has('unassigned') ? 0 : unassignedItems.length) |
247 | 248 | ); |
248 | 249 |
|
| 250 | + let backlogTotal = $derived(collectionStore.backlogPagination?.total_items ?? backlogItems.length); |
| 251 | + let backlogShownCount = $derived(collectionStore.loading ? null : shownItemCount); |
| 252 | + let backlogRemaining = $derived(Math.max(0, backlogTotal - backlogItems.length)); |
| 253 | + let backlogCountSummary = $derived(formatItemCount(backlogTotal, backlogShownCount, t)); |
| 254 | +
|
249 | 255 | // Centralized gradient styling |
250 | 256 | const styles = useGradientStyles(); |
251 | 257 |
|
|
297 | 303 |
|
298 | 304 | // Keep backlog count in sync |
299 | 305 | $effect(() => { |
300 | | - backlogStore.setCount(workspaceId, collectionStore.backlogPagination?.total_items ?? collectionStore.backlogItems.length); |
| 306 | + backlogStore.setCount(workspaceId, backlogTotal); |
301 | 307 | }); |
302 | 308 |
|
303 | 309 | // Adaptive polling for backlog items: use cheap deltas, falling back to full refresh only when needed. |
|
716 | 722 | workspaceName={workspace?.name || ''} |
717 | 723 | collection={currentCollectionName} |
718 | 724 | viewName="Backlog" |
719 | | - itemCount={collectionStore.collectionTotal} |
720 | | - shownCount={collectionStore.loading ? null : shownItemCount} |
| 725 | + itemCount={backlogTotal} |
| 726 | + shownCount={backlogShownCount} |
721 | 727 | > |
722 | 728 | {#snippet actions()} |
723 | 729 | <div class="flex items-center gap-2"> |
|
836 | 842 | > |
837 | 843 | {collectionStore.backlogLoadingMore ? t('common.loading') : t('common.loadMore')} |
838 | 844 | {#if collectionStore.backlogPagination?.total_items} |
839 | | - ({collectionStore.backlogPagination.total_items - collectionStore.backlogItems.length} {t('common.remaining')}) |
| 845 | + ({backlogRemaining} {t('common.remaining')}) |
840 | 846 | {/if} |
841 | 847 | </button> |
842 | 848 | </div> |
843 | 849 | {/if} |
844 | 850 |
|
845 | 851 | <!-- Summary --> |
846 | 852 | <div class="mt-8 text-center"> |
847 | | - <p class="text-sm" style="color: var(--ctx-text-subtle, var(--ds-text-subtle));"> |
848 | | - {t('collections.showingItemsFromBacklog', { count: collectionStore.backlogPagination?.total_items ?? backlogItems.length })} |
| 853 | + <p data-testid="backlog-count-summary" class="text-sm" style="color: var(--ctx-text-subtle, var(--ds-text-subtle));"> |
| 854 | + {backlogCountSummary} |
849 | 855 | </p> |
850 | 856 | </div> |
851 | 857 | </div> |
|
0 commit comments