Skip to content

Commit

Permalink
bump version to 3.5.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cpvalente committed Aug 4, 2024
1 parent 6cfdfce commit d9f9f26
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 49 deletions.
2 changes: 1 addition & 1 deletion apps/client/src/features/operator/operator.options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getOperatorOptions = (customFields: CustomFields, timeFormat: strin
{
id: 'hidepast',
title: 'Hide Past Events',
description: 'Whether to events that have passed',
description: 'Whether to hide events that have passed',
type: 'boolean',
defaultValue: false,
},
Expand Down
40 changes: 17 additions & 23 deletions apps/client/src/features/viewers/timeline/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { memo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { useViewportSize } from '@mantine/hooks';
import { isOntimeEvent, MaybeNumber } from 'ontime-types';
import { dayInMs, getFirstEventNormal, getLastEventNormal, MILLIS_PER_HOUR } from 'ontime-utils';

import useRundown from '../../../common/hooks-query/useRundown';
import { isOntimeEvent, MaybeNumber, OntimeEvent } from 'ontime-types';
import { dayInMs, getFirstEvent, getLastEvent, MILLIS_PER_HOUR } from 'ontime-utils';

import TimelineMarkers from './timeline-markers/TimelineMarkers';
import ProgressBar from './timeline-progress-bar/TimelineProgressBar';
Expand All @@ -12,14 +11,9 @@ import { ProgressStatus, TimelineEntry } from './TimelineEntry';

import style from './Timeline.module.scss';

function useTimeline() {
const { data } = useRundown();
if (data.revision === -1) {
return null;
}

const { firstEvent } = getFirstEventNormal(data.rundown, data.order);
const { lastEvent } = getLastEventNormal(data.rundown, data.order);
function useTimeline(rundown: OntimeEvent[]) {
const { firstEvent } = getFirstEvent(rundown);
const { lastEvent } = getLastEvent(rundown);
const firstStart = firstEvent?.timeStart ?? 0;
const lastEnd = lastEvent?.timeEnd ?? 0;
const normalisedLastEnd = lastEnd < firstStart ? lastEnd + dayInMs : lastEnd;
Expand All @@ -30,8 +24,7 @@ function useTimeline() {
const accumulatedDelay = lastEvent?.delay ?? 0;

return {
rundown: data.rundown,
order: data.order,
rundown: rundown,
startHour,
endHour,
accumulatedDelay,
Expand All @@ -40,20 +33,22 @@ function useTimeline() {

interface TimelineProps {
selectedEventId: string | null;
rundown: OntimeEvent[];
}

export default memo(Timeline);

function Timeline(props: TimelineProps) {
const { selectedEventId } = props;
const { selectedEventId, rundown: baseRundown } = props;
const { width: screenWidth } = useViewportSize();
const timelineData = useTimeline();
const timelineData = useTimeline(baseRundown);
const [searchParams] = useSearchParams();

Check failure on line 45 in apps/client/src/features/viewers/timeline/Timeline.tsx

View workflow job for this annotation

GitHub Actions / unit-test

'searchParams' is assigned a value but never used. Allowed unused elements of array destructuring patterns must match /^_/u

if (timelineData === null) {
return null;
}

const { rundown, order, startHour, endHour, accumulatedDelay } = timelineData;
const { rundown, startHour, endHour, accumulatedDelay } = timelineData;

let hasTimelinePassedMidnight = false;
let previousEventStartTime: MaybeNumber = null;
Expand All @@ -62,12 +57,11 @@ function Timeline(props: TimelineProps) {

return (
<div className={style.timeline}>
<TimelineMarkers />
<TimelineMarkers rundown={rundown} />
<ProgressBar startHour={startHour} endHour={endHour + accumulatedDelay} />
<div className={style.timelineEvents}>
{order.map((eventId) => {
{rundown.map((event) => {
// for now we dont render delays and blocks
const event = rundown[eventId];
if (!isOntimeEvent(event)) {
return null;
}
Expand All @@ -76,12 +70,12 @@ function Timeline(props: TimelineProps) {
if (eventStatus === 'live') {
eventStatus = 'future';
}
if (eventId === selectedEventId) {
if (event.id === selectedEventId) {
eventStatus = 'live';
}

// we need to offset the start to account for midnight
if (!hasTimelinePassedMidnight) {
// we need to offset the start to account for midnight
hasTimelinePassedMidnight = previousEventStartTime !== null && event.timeStart < previousEventStartTime;
}
const normalisedStart = hasTimelinePassedMidnight ? event.timeStart + dayInMs : event.timeStart;
Expand All @@ -97,7 +91,7 @@ function Timeline(props: TimelineProps) {

return (
<TimelineEntry
key={eventId}
key={event.id}
colour={event.colour}
delay={event.delay ?? 0}
duration={event.duration}
Expand Down
10 changes: 8 additions & 2 deletions apps/client/src/features/viewers/timeline/TimelinePage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useMemo } from 'react';
import { useSearchParams } from 'react-router-dom';
import { MaybeString, OntimeEvent, ProjectData, Settings } from 'ontime-types';

import ViewParamsEditor from '../../../common/components/view-params-editor/ViewParamsEditor';
import { ViewExtendedTimer } from '../../../common/models/TimeManager.type';
import { formatTime, getDefaultFormat } from '../../../common/utils/time';
import { useTranslation } from '../../../translation/TranslationProvider';
import { isStringBoolean } from '../common/viewUtils';

import Section from './timeline-section/TimelineSection';
import Timeline from './Timeline';
Expand All @@ -15,6 +17,7 @@ import style from './TimelinePage.module.scss';

interface TimelinePageProps {
backstageEvents: OntimeEvent[];
events: OntimeEvent[];
general: ProjectData;
selectedId: MaybeString;
settings: Settings | undefined;
Expand All @@ -27,8 +30,9 @@ interface TimelinePageProps {
* There is little point splitting or memoising top level elements
*/
export default function TimelinePage(props: TimelinePageProps) {
const { backstageEvents, general, selectedId, settings, time } = props;
const { backstageEvents, events, general, selectedId, settings, time } = props;

const [searchParams] = useSearchParams();
const { getLocalizedString } = useTranslation();
const clock = formatTime(time.clock);

Expand All @@ -46,6 +50,8 @@ export default function TimelinePage(props: TimelinePageProps) {
const followedByText =
followedBy !== null ? `${followedBy.title} · ${getFormattedTimeToStart(followedBy, time.clock, dueText)}` : '-';

const hideBackstage = isStringBoolean(searchParams.get('hideBackstage'));

return (
<div className={style.timeline}>
<ViewParamsEditor viewOptions={progressOptions} />
Expand All @@ -56,7 +62,7 @@ export default function TimelinePage(props: TimelinePageProps) {
<Section title={getLocalizedString('timeline.live')} content={titleNow} category='now' />
<Section title={getLocalizedString('timeline.followedby')} content={followedByText} category='next' />
</div>
<Timeline selectedEventId={selectedId} />
<Timeline selectedEventId={selectedId} rundown={hideBackstage ? events : backstageEvents} />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import useRundown from '../../../../common/hooks-query/useRundown';
import { OntimeEvent } from 'ontime-types';

import { getTimelineSections } from '../timeline.utils';

import style from './TimelineMarkers.module.scss';

export default function TimelineMarkers() {
const { data } = useRundown();
interface TimelineMarkersProps {
rundown: OntimeEvent[];
}

if (!data || data.revision === -1) {
return null;
}
export default function TimelineMarkers(props: TimelineMarkersProps) {
const { rundown } = props;

const elements = getTimelineSections(data.rundown, data.order);
const elements = getTimelineSections(rundown);

return (
<div className={style.markers}>
Expand Down
18 changes: 17 additions & 1 deletion apps/client/src/features/viewers/timeline/timeline.options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,21 @@ import { getTimeOption } from '../../../common/components/view-params-editor/con
import { ViewOption } from '../../../common/components/view-params-editor/types';

export const getTimelineOptions = (timeFormat: string): ViewOption[] => {
return [getTimeOption(timeFormat)];
return [
getTimeOption(timeFormat),
{
id: 'hidePast',
title: 'Hide Past Events',
description: 'Whether to hide events that have passed',
type: 'boolean',
defaultValue: false,
},
{
id: 'hideBackstage',
title: 'Hide Backstage Events',
description: 'Whether to hide non-public events',
type: 'boolean',
defaultValue: false,
},
];
};
13 changes: 6 additions & 7 deletions apps/client/src/features/viewers/timeline/timeline.utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { isOntimeEvent, MaybeString, NormalisedRundown, OntimeEvent } from 'ontime-types';
import { isOntimeEvent, MaybeString, OntimeEvent, OntimeRundown } from 'ontime-types';
import {
dayInMs,
getEventWithId,
getFirstEvent,
getFirstEventNormal,
getLastEventNormal,
getLastEvent,
getNextEvent,
MILLIS_PER_HOUR,
millisToString,
Expand Down Expand Up @@ -76,12 +75,12 @@ export function makeTimelineSections(firstHour: number, lastHour: number) {
/**
* Extracts the timeline sections from a rundown
*/
export function getTimelineSections(rundown: NormalisedRundown, order: string[]): string[] {
if (order.length === 0) {
export function getTimelineSections(rundown: OntimeRundown): string[] {
if (rundown.length === 0) {
return [];
}
const { firstEvent } = getFirstEventNormal(rundown, order);
const { lastEvent } = getLastEventNormal(rundown, order);
const { firstEvent } = getFirstEvent(rundown);
const { lastEvent } = getLastEvent(rundown);
const firstStart = firstEvent?.timeStart ?? 0;
const lastEnd = lastEvent?.timeEnd ?? 0;
const normalisedLastEnd = lastEnd < firstStart ? lastEnd + dayInMs : lastEnd;
Expand Down
23 changes: 15 additions & 8 deletions apps/electron/src/menu/applicationMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ function getApplicationMenu(isMac, askToQuit, urlBase, version, redirectWindow)
{
label: 'Ontime Views (opens in browser)',
submenu: [
{
label: 'Public',
click: async () => {
await shell.openExternal(`${urlBase}/public`);
},
},
{
label: 'Lower Thirds',
click: async () => {
await shell.openExternal(`${urlBase}/lower`);
},
},
{ type: 'separator' },
{
label: 'Timer',
accelerator: 'CmdOrCtrl+V',
Expand All @@ -85,15 +98,9 @@ function getApplicationMenu(isMac, askToQuit, urlBase, version, redirectWindow)
},
},
{
label: 'Public',
click: async () => {
await shell.openExternal(`${urlBase}/public`);
},
},
{
label: 'Lower Thirds',
label: 'Timeline',
click: async () => {
await shell.openExternal(`${urlBase}/lower`);
await shell.openExternal(`${urlBase}/timeline`);
},
},
{
Expand Down

0 comments on commit d9f9f26

Please sign in to comment.