added calendar and rough structure of calendar

This commit is contained in:
CoGomu
2025-05-11 19:35:39 +02:00
parent f88402d04e
commit f8cb42962a
13 changed files with 591 additions and 14 deletions

42
web/utils/lib.ts Normal file
View File

@@ -0,0 +1,42 @@
import type { Moment } from "moment"
export type Seperator = {
text: string,
time: Moment
}
export type Timespan = {
from: number,
to: number
}
export type Event = AnonymousEvent & {
title: string
}
export type AnonymousEvent = {
from: Moment,
to: Moment
}
export type SerializableEvent = {
title: string,
from: string,
to: string
}
export type EventWithCollisions = Event & {
collisions: number
}
export type EventDimensions = {
from: number,
to: number
}
export function percentToPixelDimensions(dimensions: EventDimensions, totalHeight: number): EventDimensions {
return {
from: (dimensions.from / 100) * totalHeight,
to: (dimensions.to / 100) * totalHeight
}
}