From 6d81c10467ab7a0bebaa0a9ad4645398d4645bb8 Mon Sep 17 00:00:00 2001 From: Jan Starzak Date: Tue, 9 Jan 2024 17:28:38 +0100 Subject: [PATCH] feat(CurrentRundown): selectable Lines --- .../CurrentRundown/CurrentRundown.module.scss | 11 +++++- .../apps/client/src/CurrentRundown/Line.tsx | 6 +-- .../client/src/CurrentRundown/Segment.tsx | 18 ++++++++- .../apps/client/src/ScriptEditor/Editor.tsx | 38 ++++++++++++------- .../apps/client/src/mocks/mockConnection.ts | 4 +- packages/apps/client/src/stores/UIStore.ts | 8 +++- 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/packages/apps/client/src/CurrentRundown/CurrentRundown.module.scss b/packages/apps/client/src/CurrentRundown/CurrentRundown.module.scss index 7d2aa67..c8f407b 100644 --- a/packages/apps/client/src/CurrentRundown/CurrentRundown.module.scss +++ b/packages/apps/client/src/CurrentRundown/CurrentRundown.module.scss @@ -3,8 +3,8 @@ grid-template-columns: 1fr 3em 4em 2fr 5fr 1fr 1fr; padding: 0; margin: 0; - --table-gap-size: 2px; - gap: var(--table-gap-size); + --table-gap-size: 0; + gap: 0; } .SegmentContainer { @@ -37,6 +37,13 @@ gap: var(--table-gap-size); padding: 0; margin: 0; + border: 1px solid transparent; + user-select: none; +} + +.LineSelected { + composes: Line; + border: 1px solid var(--bs-primary); } .LineItem { diff --git a/packages/apps/client/src/CurrentRundown/Line.tsx b/packages/apps/client/src/CurrentRundown/Line.tsx index 2b1e140..9c9cc76 100644 --- a/packages/apps/client/src/CurrentRundown/Line.tsx +++ b/packages/apps/client/src/CurrentRundown/Line.tsx @@ -7,11 +7,11 @@ const Line = observer(({ line }: { line: UILine | undefined }): React.JSX.Elemen if (!line) return null return ( <> -
-
+
{line.identifier}
+
{line.lineType?.label}
{line.slug}
{line.script}
-
+
{line.expectedDuration}
) diff --git a/packages/apps/client/src/CurrentRundown/Segment.tsx b/packages/apps/client/src/CurrentRundown/Segment.tsx index 8b74dfc..153c18a 100644 --- a/packages/apps/client/src/CurrentRundown/Segment.tsx +++ b/packages/apps/client/src/CurrentRundown/Segment.tsx @@ -3,16 +3,32 @@ import { observer } from 'mobx-react-lite' import { UISegment } from '../model/UISegment' import { Line } from './Line' import classes from './CurrentRundown.module.scss' +import { AppStore } from '../stores/AppStore' +import { UILineId } from '../model/UILine' const Segment = observer(({ segment }: { segment: UISegment }): React.JSX.Element | null => { if (!segment) return null + function isSelected(lineId: UILineId) { + return lineId === AppStore.uiStore.selectedLineId + } + + function onClick(e: React.MouseEvent) { + const lineId = e.currentTarget.dataset['lineId'] as UILineId + AppStore.uiStore.setSelectedLineId(lineId) + } + return ( <>
{segment.name}