refactor(web): rename DayGroup to TimelineDay (#27446)

Rename DayGroup class to TimelineDay to better convey that it represents
a single day within the timeline. Updates the file, class, and all
references across 13 files.

Change-Id: I9faef9bad73cd5b11f40daaf5eb140dd6a6a6964
This commit is contained in:
Min Idzelis
2026-04-01 19:30:54 -04:00
committed by GitHub
parent c9e251c78c
commit 2166f07b1f
13 changed files with 153 additions and 147 deletions
@@ -1,64 +1,64 @@
import { setDifference, type TimelineDate } from '$lib/utils/timeline-util';
import { AssetOrder } from '@immich/sdk';
import type { DayGroup } from './day-group.svelte';
import type { MonthGroup } from './month-group.svelte';
import type { TimelineDay } from './timeline-day.svelte';
import type { TimelineAsset } from './types';
export class GroupInsertionCache {
#lookupCache: {
[year: number]: { [month: number]: { [day: number]: DayGroup } };
[year: number]: { [month: number]: { [day: number]: TimelineDay } };
} = {};
unprocessedAssets: TimelineAsset[] = [];
// eslint-disable-next-line svelte/prefer-svelte-reactivity
changedDayGroups = new Set<DayGroup>();
changedTimelineDays = new Set<TimelineDay>();
// eslint-disable-next-line svelte/prefer-svelte-reactivity
newDayGroups = new Set<DayGroup>();
newTimelineDays = new Set<TimelineDay>();
getDayGroup({ year, month, day }: TimelineDate): DayGroup | undefined {
getTimelineDay({ year, month, day }: TimelineDate): TimelineDay | undefined {
return this.#lookupCache[year]?.[month]?.[day];
}
setDayGroup(dayGroup: DayGroup, { year, month, day }: TimelineDate) {
setTimelineDay(timelineDay: TimelineDay, { year, month, day }: TimelineDate) {
if (!this.#lookupCache[year]) {
this.#lookupCache[year] = {};
}
if (!this.#lookupCache[year][month]) {
this.#lookupCache[year][month] = {};
}
this.#lookupCache[year][month][day] = dayGroup;
this.#lookupCache[year][month][day] = timelineDay;
}
get existingDayGroups() {
return setDifference(this.changedDayGroups, this.newDayGroups);
get existingTimelineDays() {
return setDifference(this.changedTimelineDays, this.newTimelineDays);
}
get updatedBuckets() {
// eslint-disable-next-line svelte/prefer-svelte-reactivity
const updated = new Set<MonthGroup>();
for (const group of this.changedDayGroups) {
for (const group of this.changedTimelineDays) {
updated.add(group.monthGroup);
}
return updated;
}
get bucketsWithNewDayGroups() {
get bucketsWithNewTimelineDays() {
// eslint-disable-next-line svelte/prefer-svelte-reactivity
const updated = new Set<MonthGroup>();
for (const group of this.newDayGroups) {
for (const group of this.newTimelineDays) {
updated.add(group.monthGroup);
}
return updated;
}
sort(monthGroup: MonthGroup, sortOrder: AssetOrder = AssetOrder.Desc) {
for (const group of this.changedDayGroups) {
for (const group of this.changedTimelineDays) {
group.sortAssets(sortOrder);
}
for (const group of this.newDayGroups) {
for (const group of this.newTimelineDays) {
group.sortAssets(sortOrder);
}
if (this.newDayGroups.size > 0) {
monthGroup.sortDayGroups();
if (this.newTimelineDays.size > 0) {
monthGroup.sortTimelineDays();
}
}
}