Skip to content

Commit 500ccd5

Browse files
committed
fix container queries for time entry rows
1 parent bacd6f4 commit 500ccd5

File tree

4 files changed

+5
-39
lines changed

4 files changed

+5
-39
lines changed

resources/js/Pages/ReportingDetailed.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ async function downloadExport(format: ExportFormat) {
383383
@submit="clearSelectionAndState"
384384
@select-all="selectedTimeEntries = [...timeEntries]"
385385
@unselect-all="selectedTimeEntries = []"></TimeEntryMassActionRow>
386-
<div class="w-full relative">
386+
<div class="w-full relative @container">
387387
<div v-for="entry in timeEntries" :key="entry.id">
388388
<TimeEntryRow
389389
:selected="selectedTimeEntries.includes(entry)"

resources/js/packages/ui/src/TimeEntry/TimeEntryAggregateRow.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function onSelectChange(checked: boolean) {
9393
class="border-b border-default-background-separator bg-row-background min-w-0 transition"
9494
data-testid="time_entry_row">
9595
<MainContainer class="min-w-0">
96-
<div class="@sm:flex py-2 items-center min-w-0 justify-between group">
96+
<div class="@xl:flex py-2 items-center min-w-0 justify-between group">
9797
<div class="flex space-x-3 items-center min-w-0">
9898
<Checkbox
9999
:checked="

resources/js/packages/ui/src/TimeEntry/TimeEntryGroupedTable.vue

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, onMounted, ref, watch } from 'vue';
2+
import { computed } from 'vue';
33
import type {
44
CreateClientBody,
55
CreateProjectBody,
@@ -38,8 +38,6 @@ const props = defineProps<{
3838
canCreateProject: boolean;
3939
}>();
4040
41-
const maxVisibleGroups = ref(7); // Start with 10 day groups, then show all
42-
4341
const groupedTimeEntries = computed(() => {
4442
const groupedEntriesByDay: Record<string, TimeEntry[]> = {};
4543
for (const entry of props.timeEntries) {
@@ -137,43 +135,11 @@ function unselectAllTimeEntries(value: TimeEntriesGroupedByType[]) {
137135
);
138136
});
139137
}
140-
141-
const visibleGroupedEntries = computed(() => {
142-
const allGroups = Object.entries(groupedTimeEntries.value);
143-
return Object.fromEntries(allGroups.slice(0, maxVisibleGroups.value));
144-
});
145-
146-
const totalGroups = computed(() => Object.keys(groupedTimeEntries.value).length);
147-
148-
function startProgressiveLoading() {
149-
const loadMoreGroups = () => {
150-
if (maxVisibleGroups.value < totalGroups.value) {
151-
maxVisibleGroups.value = Math.min(maxVisibleGroups.value + 5, totalGroups.value);
152-
153-
if (maxVisibleGroups.value < totalGroups.value) {
154-
requestIdleCallback(loadMoreGroups);
155-
}
156-
}
157-
};
158-
159-
requestIdleCallback(loadMoreGroups);
160-
}
161-
162-
// Watch for changes to totalGroups and adjust maxVisibleGroups accordingly
163-
watch(totalGroups, (newTotal, oldTotal) => {
164-
if (newTotal !== oldTotal) {
165-
maxVisibleGroups.value = newTotal;
166-
}
167-
});
168-
169-
onMounted(() => {
170-
startProgressiveLoading();
171-
});
172138
</script>
173139

174140
<template>
175141
<div class="@container">
176-
<div v-for="(value, key) in visibleGroupedEntries" :key="key">
142+
<div v-for="(value, key) in groupedTimeEntries" :key="key">
177143
<TimeEntryRowHeading
178144
:date="String(key)"
179145
:duration="sumDuration(value)"

resources/js/packages/ui/src/TimeEntry/TimeEntryRow.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async function handleDeleteTimeEntry() {
112112
class="border-b border-default-background-separator transition min-w-0 bg-row-background"
113113
data-testid="time_entry_row">
114114
<MainContainer class="min-w-0">
115-
<div class="@sm:flex py-2 min-w-0 items-center justify-between group">
115+
<div class="@xl:flex py-2 min-w-0 items-center justify-between group">
116116
<div class="flex items-center min-w-0">
117117
<Checkbox :checked="selected" @update:checked="onSelectChange" />
118118
<div v-if="indent === true" class="w-10 h-7"></div>

0 commit comments

Comments
 (0)