feat: Add Operator List

This commit is contained in:
arihanv
2023-07-03 00:22:10 -05:00
parent 7a6158584a
commit 50f7bd1227
8 changed files with 116 additions and 13 deletions
@@ -1,4 +1,5 @@
// remember we are targeting phones and tablets
.operator {
width: 100vw;
height: 100vh;
@@ -7,10 +8,19 @@
display: flex;
flex-direction: column;
gap: 2px;
color:white;
}
.allBlocks{
flex: 1;
overflow: scroll;
}
@mixin event-block() {
padding: 0.5rem;
padding: 0.2rem;
display: flex;
gap: 0.75rem;
align-items: center;
}
.scheduledEvent {
@@ -20,5 +30,5 @@
.block {
@include event-block();
background-color: wheat;
background-color: gray;
}
@@ -3,8 +3,9 @@ import { SupportedEvent } from 'ontime-types';
import useRundown from '../../common/hooks-query/useRundown';
import style from './Operator.module.scss';
import OpEvent from './op-event/OpEvent';
import OpBlock from './op-block/OpBlock';
import TimeBlock from './time-block/TimeBlock';
export default function Operator() {
// this is the data that you need, the status flag should give you possibility to create a loading state
@@ -17,6 +18,7 @@ export default function Operator() {
return (
<div className={style.operator}>
<div className={style.allBlocks}>
{data.map((entry) => {
// 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
@@ -25,23 +27,24 @@ export default function Operator() {
if (entry.type === SupportedEvent.Event) {
return (
<div key={entry.id} className={style.scheduledEvent}>
<OpBlock entry={JSON.stringify(entry, null, 2)} />
<OpEvent data={entry} />
</div>
);
}
// this is a block entry (like a section title)
if (entry.type === SupportedEvent.Block) {
return (
<div key={entry.id} className={style.block}>
{/* {JSON.stringify(entry, null, 2)} */}
<OpBlock entry={JSON.stringify(entry, null, 2)} />
<OpBlock data={entry} />
</div>
);
}
return null;
})}
</div>
<TimeBlock/>
</div>
);
}
@@ -0,0 +1,3 @@
.title{
font-size: 1rem;
}
@@ -1,11 +1,13 @@
import style from './OpBlock.module.scss';
type Props = {
entry: string;
}
data: any;
};
export default function OpBlock({entry}: Props) {
export default function OpBlock({ data }: Props) {
return (
<div>OpBlock</div>
)
}
<>
<div className={style.title}>{data.title}</div>
</>
);
}
@@ -0,0 +1,27 @@
.alias{
background-color: red;
width: fit-content;
height: fit-content;
padding: 0.2rem;
align-items: center;
}
.title{
font-size: 1rem;
}
.time{
display: flex;
flex-direction: column;
font-size: 0.65rem;
text-align: right;
}
.time > div {
margin-bottom: -4px; /* Adjust the value as needed */
}
.title{
flex: 1;
}
@@ -0,0 +1,26 @@
import { EventData } from 'ontime-types';
import style from './OpEvent.module.scss';
import { formatTime } from '../../../common/utils/time';
type Props = {
data: any;
};
export default function OpEvent({ data }: Props) {
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>
--:--:--
</div>
</>
);
}
@@ -0,0 +1,12 @@
.block{
padding: 0.65rem;
border: 1px solid hotpink;
display: flex;
justify-content: space-between;
}
.clock{
display: flex;
gap: 1.5rem;
margin-right:1rem;
}
@@ -0,0 +1,20 @@
import styles from './TimeBlock.module.scss';
import { Play } from 'lucide-react';
import { useTimer } from '../../../common/hooks/useSocket';
import { formatTime } from '../../../common/utils/time';
type Props = {};
export default function TimeBlock({}: Props) {
const timer = useTimer();
const timeNow = formatTime(timer.clock, {
showSeconds: true,
format: 'hh:mm:ss a',
});
return (
<div className={styles.block}>
<Play size={17} />
<div className={styles.clock}>{timeNow} <div>00:10:00</div></div>
</div>
);
}