Skip to content

Commit bacd6f4

Browse files
committed
include the currently running time entry in the calendar header
1 parent 022caf5 commit bacd6f4

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

resources/js/packages/ui/src/FullCalendar/TimeEntryCalendar.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,23 @@ const events = computed(() => {
177177
// Daily totals used in day header
178178
const dailyTotals = computed(() => {
179179
const totals: Record<string, number> = {};
180-
props.timeEntries
181-
.filter((entry) => entry.end !== null)
182-
.forEach((entry) => {
183-
const date = getDayJsInstance()(entry.start).format('YYYY-MM-DD');
184-
const duration = getDayJsInstance()(entry.end!).diff(
180+
props.timeEntries.forEach((entry) => {
181+
const date = getDayJsInstance()(entry.start).format('YYYY-MM-DD');
182+
let duration: number;
183+
184+
if (entry.end !== null) {
185+
// Completed entry
186+
duration = getDayJsInstance()(entry.end).diff(
185187
getDayJsInstance()(entry.start),
186188
'minutes'
187189
);
188-
totals[date] = (totals[date] || 0) + duration;
189-
});
190+
} else {
191+
// Running entry - use current time
192+
duration = currentTime.value.diff(getDayJsInstance()(entry.start), 'minutes');
193+
}
194+
195+
totals[date] = (totals[date] || 0) + duration;
196+
});
190197
return totals;
191198
});
192199

resources/js/packages/ui/styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ body {
183183
--popover: var(--theme-color-card-background);
184184
--popover-foreground: var(--color-text-primary);
185185
--primary: var(--color-bg-primary);
186-
--primary-foreground: var(--theme-color-button-primary-text);
186+
--primary-foreground: var(--color-text-primary);
187187
--secondary: var(--color-bg-secondary);
188188
--secondary-foreground: var(--color-text-primary);
189189
--muted: var(--color-bg-tertiary);
@@ -210,7 +210,7 @@ body {
210210
--popover: var(--theme-color-card-background);
211211
--popover-foreground: var(--color-text-primary);
212212
--primary: var(--color-bg-primary);
213-
--primary-foreground: var(--theme-color-button-primary-text);
213+
--primary-foreground: var(--color-text-primary);
214214
--secondary: var(--color-bg-secondary);
215215
--secondary-foreground: var(--color-text-primary);
216216
--muted: var(--color-bg-tertiary);

0 commit comments

Comments
 (0)