add eventsPerPage to schedule (#583)

* add eventsPerPage to schedule

---------

Co-authored-by: arc-alex <ac@omnivox.dk>
This commit is contained in:
Alex Christoffer Rasmussen
2023-11-13 22:03:17 +01:00
committed by GitHub
parent cbed3e4fe4
commit 140daef7e7
2 changed files with 13 additions and 2 deletions
@@ -21,7 +21,6 @@ interface ScheduleProviderProps {
events: OntimeEvent[]; events: OntimeEvent[];
selectedEventId: string | null; selectedEventId: string | null;
isBackstage?: boolean; isBackstage?: boolean;
eventsPerPage?: number;
time?: number; time?: number;
} }
@@ -30,7 +29,6 @@ export const ScheduleProvider = ({
events, events,
selectedEventId, selectedEventId,
isBackstage = false, isBackstage = false,
eventsPerPage = 7,
time = 10, time = 10,
}: PropsWithChildren<ScheduleProviderProps>) => { }: PropsWithChildren<ScheduleProviderProps>) => {
const [visiblePage, setVisiblePage] = useState(0); const [visiblePage, setVisiblePage] = useState(0);
@@ -39,6 +37,7 @@ export const ScheduleProvider = ({
// look for overrides from views // look for overrides from views
const hidePast = isStringBoolean(searchParams.get('hidePast')); const hidePast = isStringBoolean(searchParams.get('hidePast'));
const stopCycle = isStringBoolean(searchParams.get('stopCycle')); const stopCycle = isStringBoolean(searchParams.get('stopCycle'));
const eventsPerPage = Number(searchParams.get('eventsPerPage') ?? 7);
let selectedEventIndex = events.findIndex((event) => event.id === selectedEventId); let selectedEventIndex = events.findIndex((event) => event.id === selectedEventId);
@@ -208,6 +208,12 @@ export const BACKSTAGE_OPTIONS: ParamField[] = [
description: 'Schedule will not auto-cycle through events', description: 'Schedule will not auto-cycle through events',
type: 'boolean', type: 'boolean',
}, },
{
id: 'eventsPerPage',
title: 'Events per page',
description: 'Sets the number of events on the page, can cause overlow',
type: 'number',
},
]; ];
export const PUBLIC_OPTIONS: ParamField[] = [ export const PUBLIC_OPTIONS: ParamField[] = [
@@ -224,6 +230,12 @@ export const PUBLIC_OPTIONS: ParamField[] = [
description: 'Schedule will not auto-cycle through events', description: 'Schedule will not auto-cycle through events',
type: 'boolean', type: 'boolean',
}, },
{
id: 'eventsPerPage',
title: 'Events per page',
description: 'Sets the number of events on the page, can cause overlow',
type: 'number',
},
]; ];
export const STUDIO_CLOCK_OPTIONS: ParamField[] = [ export const STUDIO_CLOCK_OPTIONS: ParamField[] = [
TIME_FORMAT_OPTION, TIME_FORMAT_OPTION,