style: Styling Operator Block (#468)

* Operator Layout
This commit is contained in:
arihanv
2023-07-23 15:17:25 -05:00
committed by GitHub
parent 465550130b
commit bf7ca81e02
6 changed files with 123 additions and 15 deletions
@@ -30,9 +30,21 @@
.scheduledEvent {
@include event-block();
background-color: $gray-1300;
align-items: start;
}
.activeEvent {
border-top: 1.5px white;
border-style: solid;
}
.runningTimer {
border-top: 0.5px white;
border-style: solid;
background-color: $green-700;
}
.block {
@include event-block();
background-color: $gray-1350;
}
}
+24 -5
View File
@@ -1,7 +1,10 @@
import React from 'react';
import { SupportedEvent } from 'ontime-types';
import NavigationMenu from '../.././common/components/navigation-menu/NavigationMenu';
import useRundown from '../../common/hooks-query/useRundown';
import FocusBlock from './focus-block/focus-block';
import OpBlock from './op-block/OpBlock';
import OpEvent from './op-event/OpEvent';
import TimeBlock from './time-block/TimeBlock';
@@ -12,6 +15,14 @@ export default function Operator() {
// this is the data that you need, the status flag should give you possibility to create a loading state
// for debugging data use the react query dev tools (flower thing in the bottom left corner)
const { data, status } = useRundown();
const [showChild, setShowChild] = React.useState(false);
const handleScroll = (event: any) => {
const scrollThreshold = 50; // Set the scroll threshold here
const scrollPosition = event.target.scrollTop;
setShowChild(scrollPosition > scrollThreshold);
};
if (!data || status === 'loading') {
return <>loading</>;
@@ -19,16 +30,23 @@ export default function Operator() {
return (
<div className={style.operatorContainer}>
<div className={style.operatorEvents}>
{data.map((entry) => {
<NavigationMenu />
<div className={style.operatorEvents} onScroll={handleScroll}>
{data.map((entry, i) => {
// there are three types of events, you a filter them by using the type property
// for this view, we do not show the delay event
// this is a scheduled event
if (entry.type === SupportedEvent.Event) {
return (
<div key={entry.id} className={style.scheduledEvent}>
<OpEvent data={entry} />
<div
key={entry.id}
className={`${style.scheduledEvent} ${i % 3 == 0 ? style.activeEvent : ''} ${
i == 4 ? style.runningTimer : ''
}`}
>
<OpEvent id={i} data={entry} />
</div>
);
}
@@ -43,8 +61,9 @@ export default function Operator() {
}
return null;
})}
{showChild && <FocusBlock />}
</div>
<TimeBlock />
</div>
);
}
}
@@ -0,0 +1,14 @@
import { BiTargetLock } from '@react-icons/all-files/bi/BiTargetLock';
import style from './focusBlock.module.scss';
export default function FocusBlock() {
return (
<button className={style.focusBlock}>
<div className={style.focusButton}>
<BiTargetLock size={20} />
Follow
</div>
</button>
);
}
@@ -0,0 +1,25 @@
@use '.../../../src/theme/ontimeColours' as *;
.focusBlock {
bottom: 0;
left: 0;
right: 0;
position: -webkit-sticky;
position: sticky;
display: flex;
justify-content: center;
width: 100%;
margin-top: -53px;
}
.focusButton {
margin: 10px;
background-color: $blue-500;
width: fit-content;
padding: 3px 15px 3px 15px;
border-radius: 10px;
display: flex;
align-items: center;
gap: 5px;
font-size: medium;
}
@@ -10,6 +10,20 @@
font-size: 1rem;
}
.event {
display: flex;
gap: 6px;
width: 100%;
}
.block {
width: 100%;
}
.fields {
font-weight: 700;
}
.time {
display: flex;
flex-direction: column;
@@ -24,3 +38,15 @@
.title {
flex: 1;
}
.indicator {
display: flex;
justify-content: space-between;
}
.chevron {
display: flex;
align-items: center;
color: yellow;
font-size: 16px;
}
@@ -1,3 +1,4 @@
import { IoChevronUp } from '@react-icons/all-files/io5/IoChevronUp';
import { OntimeEvent } from 'ontime-types';
import { formatTime } from '../../../common/utils/time';
@@ -6,23 +7,34 @@ import style from './OpEvent.module.scss';
type OpEventProps = {
data: OntimeEvent;
id: number;
};
export default function OpEvent({ data }: OpEventProps) {
export default function OpEvent({ data, id }: OpEventProps) {
const start = formatTime(data.timeStart, { format: 'hh:mm' });
const end = formatTime(data.timeEnd, { format: 'hh:mm' });
return (
<>
<div className={style.alias}>{data.note}</div>
<div className={style.title}>
{data.title} - {data.subtitle}
</div>
<div className={style.time}>
<div>
{start} - {end}
<div className={style.block}>
<div className={style.event}>
<div className={style.title}>
{data.title} - {data.subtitle}
</div>
<div className={style.time}>
<div>
{start} - {end}
</div>
<div className={style.indicator}>
<div className={style.chevron}>
<IoChevronUp />
</div>
--:--:--
</div>
</div>
</div>
--:--:--
{id % 3 == 0 && <div className={style.fields}>CAM 5 Slow pan to SL</div>}
</div>
</>
);
}
}