diff --git a/resources/js/packages/ui/src/TimeTracker/TimeTrackerProjectTaskDropdown.vue b/resources/js/packages/ui/src/TimeTracker/TimeTrackerProjectTaskDropdown.vue index 54388aad..ea8275af 100644 --- a/resources/js/packages/ui/src/TimeTracker/TimeTrackerProjectTaskDropdown.vue +++ b/resources/js/packages/ui/src/TimeTracker/TimeTrackerProjectTaskDropdown.vue @@ -30,7 +30,6 @@ const project = defineModel('project', { const searchInput = ref(null); const open = ref(false); const dropdownViewport = ref(null); -import { UseFocusTrap } from '@vueuse/integrations/useFocusTrap/component'; const searchValue = ref(''); @@ -117,15 +116,17 @@ const flatRows = computed(() => { return rows; }); +const ROW_HEIGHT = { client: 28, project: 36, task: 32 } as const; + const rowVirtualizer = useVirtualizer( computed(() => ({ count: flatRows.value.length, getScrollElement: () => dropdownViewport.value, estimateSize: (index: number) => { const row = flatRows.value[index]; - if (row?.kind === 'client') return 28; - if (row?.kind === 'task') return 32; - return 38; + if (row?.kind === 'client') return ROW_HEIGHT.client; + if (row?.kind === 'task') return ROW_HEIGHT.task; + return ROW_HEIGHT.project; }, getItemKey: (index: number) => flatRows.value[index]?.key ?? index, overscan: 12, @@ -141,12 +142,6 @@ const visibleRows = computed(() => })) ); -function measureRow(el: unknown): void { - if (el instanceof HTMLElement) { - rowVirtualizer.value.measureElement(el); - } -} - // Lookup maps so filtering is O(projects + tasks + clients) instead of // O(projects × (tasks + clients)). They are rebuilt only when the underlying task/client // props change, not on every keystroke. @@ -599,7 +594,7 @@ const showCreateProject = ref(false);