Add website annotations with chart markers and CRUD management
This commit is contained in:
1 parent
eea124bbf8
commit
64e4cc1c3b
24 files changed
+957
-3
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { endOfDay, endOfHour, startOfDay, startOfHour } from 'date-fns';
|
||||
|
||||
/**
|
||||
* Returns the `date` URL parameter value that filters the website view
|
||||
* to the day (all-day annotation) or hour (timed annotation) of an annotation.
|
||||
*/
|
||||
export function getAnnotationDateRangeValue(date: Date, allDay: boolean) {
|
||||
const [startDate, endDate] = allDay
|
||||
? [startOfDay(date), endOfDay(date)]
|
||||
: [startOfHour(date), endOfHour(date)];
|
||||
|
||||
return `range:${startDate.getTime()}:${endDate.getTime()}`;
|
||||
}
|
||||
@@ -78,6 +78,12 @@ export const replayParams = {
|
||||
minDuration: z.coerce.number().int().nonnegative().optional(),
|
||||
};
|
||||
|
||||
export const annotationSchema = z.object({
|
||||
date: z.coerce.date(),
|
||||
allDay: z.boolean().optional().default(true),
|
||||
note: z.string().min(1).max(500),
|
||||
});
|
||||
|
||||
export const pagingParams = {
|
||||
page: z.coerce.number().int().positive().optional(),
|
||||
pageSize: z.coerce.number().int().positive().optional(),
|
||||
|
||||
Reference in new issue
Block a user