Refactor to use ClientSchedule on client

Use the ClientSchedule data structure for deserialising and tracking
edit state on the client instead of trying to directly deal with the
ApiSchedule type which is not build for ease of edits or rendering.
This commit is contained in:
Hornwitser 2025-06-14 19:22:53 +02:00
parent ce9f758f84
commit bb450fd583
15 changed files with 488 additions and 1297 deletions

View file

@ -7,7 +7,9 @@ export function* enumerate<T>(iterable: Iterable<T>) {
}
/** Filters an iterable based on the passed predicate function */
export function* filter<T, S extends T>(it: Iterable<T>, predicate: (value: T) => value is S) {
export function filter<T, S extends T>(it: Iterable<T>, predicate: (value: T) => value is S): Generator<S, void, unknown>;
export function filter<T>(it: Iterable<T>, predicate: (value: T) => unknown): Generator<T, void, unknown>;
export function* filter(it: Iterable<unknown>, predicate: (value: unknown) => unknown): Generator<unknown, void, unknown> {
for (const value of it) {
if (predicate(value)) {
yield value;

View file

@ -1,5 +1,5 @@
// Wrapper around Luxon to make sure the throwOnInvalid option is set
import { DateTime, FixedOffsetZone, Info, Settings, Zone } from "luxon";
import { DateTime, Duration, FixedOffsetZone, Info, Settings, Zone } from "luxon";
Settings.throwOnInvalid = true;
declare module 'luxon' {
@ -8,4 +8,4 @@ declare module 'luxon' {
}
}
export { DateTime, FixedOffsetZone, Info, Zone }
export { DateTime, Duration, FixedOffsetZone, Info, Zone }