mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-07 23:39:09 +00:00
feat(op): add group visual relation
This commit is contained in:
committed by
Carlos Valente
parent
a75d35bdc0
commit
5001dda284
@@ -180,7 +180,13 @@ function Operator({ rundown, rundownMetadata, customFields, settings }: Operator
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment key={entry.id}>
|
<Fragment key={entry.id}>
|
||||||
<OperatorGroup key={entry.id} title={entry.title} />
|
<OperatorGroup
|
||||||
|
key={entry.id}
|
||||||
|
title={entry.title}
|
||||||
|
colour={entry.colour}
|
||||||
|
count={entry.entries.length}
|
||||||
|
duration={entry.duration}
|
||||||
|
/>
|
||||||
{entry.entries.map((nestedEntryId) => {
|
{entry.entries.map((nestedEntryId) => {
|
||||||
const nestedEntry = rundown.entries[nestedEntryId];
|
const nestedEntry = rundown.entries[nestedEntryId];
|
||||||
if (!isOntimeEvent(nestedEntry)) {
|
if (!isOntimeEvent(nestedEntry)) {
|
||||||
@@ -217,6 +223,7 @@ function Operator({ rundown, rundownMetadata, customFields, settings }: Operator
|
|||||||
isLinkedToLoaded={isLinkedToLoaded}
|
isLinkedToLoaded={isLinkedToLoaded}
|
||||||
isSelected={isLoaded}
|
isSelected={isLoaded}
|
||||||
isPast={isPast}
|
isPast={isPast}
|
||||||
|
groupColour={entry.colour}
|
||||||
selectedRef={isLoaded ? selectedRef : undefined}
|
selectedRef={isLoaded ? selectedRef : undefined}
|
||||||
showStart={showStart}
|
showStart={showStart}
|
||||||
subscribed={subscribedData}
|
subscribed={subscribedData}
|
||||||
|
|||||||
@@ -22,17 +22,39 @@
|
|||||||
background-color: $gray-1250;
|
background-color: $gray-1250;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.grouped {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 0.35rem;
|
||||||
|
background:
|
||||||
|
linear-gradient(90deg, color-mix(in srgb, transparent 88%, var(--group-colour, $gray-500) 12%), transparent 8rem),
|
||||||
|
$viewer-card-bg-color;
|
||||||
|
}
|
||||||
|
|
||||||
&.running {
|
&.running {
|
||||||
border-top: 1px solid $gray-1300;
|
border-top: 1px solid $gray-1300;
|
||||||
background-color: var(--operator-running-bg-override, $active-green);
|
background-color: var(--operator-running-bg-override, $active-green);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.grouped.running {
|
||||||
|
background:
|
||||||
|
linear-gradient(90deg, color-mix(in srgb, transparent 82%, var(--group-colour, $gray-500) 18%), transparent 8rem),
|
||||||
|
var(--operator-running-bg-override, $active-green);
|
||||||
|
}
|
||||||
|
|
||||||
&.past {
|
&.past {
|
||||||
border-top: 1px solid transparent;
|
border-top: 1px solid transparent;
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.groupRail {
|
||||||
|
position: absolute;
|
||||||
|
inset-block: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 0.35rem;
|
||||||
|
background-color: var(--group-colour, $gray-500);
|
||||||
|
}
|
||||||
|
|
||||||
.binder {
|
.binder {
|
||||||
grid-area: binder;
|
grid-area: binder;
|
||||||
color: $section-white;
|
color: $section-white;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ interface OperatorEventProps {
|
|||||||
isLinkedToLoaded: boolean;
|
isLinkedToLoaded: boolean;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
isPast: boolean;
|
isPast: boolean;
|
||||||
|
groupColour?: string;
|
||||||
selectedRef?: RefObject<HTMLDivElement | null>;
|
selectedRef?: RefObject<HTMLDivElement | null>;
|
||||||
showStart: boolean;
|
showStart: boolean;
|
||||||
subscribed: Subscribed;
|
subscribed: Subscribed;
|
||||||
@@ -46,6 +47,7 @@ function OperatorEvent({
|
|||||||
isLinkedToLoaded,
|
isLinkedToLoaded,
|
||||||
isSelected,
|
isSelected,
|
||||||
isPast,
|
isPast,
|
||||||
|
groupColour,
|
||||||
selectedRef,
|
selectedRef,
|
||||||
showStart,
|
showStart,
|
||||||
subscribed,
|
subscribed,
|
||||||
@@ -68,7 +70,12 @@ function OperatorEvent({
|
|||||||
const mouseHandlers = useLongPress(handleLongPress);
|
const mouseHandlers = useLongPress(handleLongPress);
|
||||||
const cueColours = colour && getAccessibleColour(colour);
|
const cueColours = colour && getAccessibleColour(colour);
|
||||||
|
|
||||||
const operatorClasses = cx([style.event, isSelected && style.running, isPast && style.past]);
|
const operatorClasses = cx([
|
||||||
|
style.event,
|
||||||
|
groupColour && style.grouped,
|
||||||
|
isSelected && style.running,
|
||||||
|
isPast && style.past,
|
||||||
|
]);
|
||||||
|
|
||||||
const hasFields = subscribed.some((field) => field.value);
|
const hasFields = subscribed.some((field) => field.value);
|
||||||
const columnCount = subscribed.length ? Math.min(subscribed.length, 4) : 0;
|
const columnCount = subscribed.length ? Math.min(subscribed.length, 4) : 0;
|
||||||
@@ -85,8 +92,10 @@ function OperatorEvent({
|
|||||||
data-testid={cue}
|
data-testid={cue}
|
||||||
ref={selectedRef}
|
ref={selectedRef}
|
||||||
onContextMenu={handleLongPress}
|
onContextMenu={handleLongPress}
|
||||||
|
style={groupColour ? ({ '--group-colour': groupColour } as CSSProperties) : undefined}
|
||||||
{...mouseHandlers}
|
{...mouseHandlers}
|
||||||
>
|
>
|
||||||
|
{groupColour && <div className={style.groupRail} />}
|
||||||
<div className={style.binder} style={{ ...cueColours }}>
|
<div className={style.binder} style={{ ...cueColours }}>
|
||||||
<span className={style.cue}>{cue}</span>
|
<span className={style.cue}>{cue}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,33 @@
|
|||||||
.group {
|
.group {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.25rem 0.5rem;
|
min-height: 2.5rem;
|
||||||
|
padding: 0.4rem 0.75rem;
|
||||||
|
border-left: 0.35rem solid var(--group-colour, $gray-500);
|
||||||
background-color: $gray-1350;
|
background-color: $gray-1350;
|
||||||
|
background: color-mix(in srgb, transparent 88%, var(--group-colour, $gray-500) 12%);
|
||||||
font-size: 1.25rem;
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
letter-spacing: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tablet
|
.title {
|
||||||
@media (min-width: $min-tablet) {
|
flex: 1 1 auto;
|
||||||
.group {
|
min-width: 0;
|
||||||
padding: 0.25rem 1rem;
|
overflow: hidden;
|
||||||
}
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta {
|
||||||
|
display: flex;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
color: rgba($ui-white, 0.55);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,29 @@
|
|||||||
import { memo } from 'react';
|
import { CSSProperties, memo } from 'react';
|
||||||
|
|
||||||
|
import { getAccessibleColour } from '../../../common/utils/styleUtils';
|
||||||
|
import { formatDuration } from '../../../common/utils/time';
|
||||||
|
|
||||||
import style from './OperatorGroup.module.scss';
|
import style from './OperatorGroup.module.scss';
|
||||||
|
|
||||||
interface OperatorGroup {
|
interface OperatorGroup {
|
||||||
title: string;
|
title: string;
|
||||||
|
colour: string;
|
||||||
|
count: number;
|
||||||
|
duration: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(OperatorGroup);
|
export default memo(OperatorGroup);
|
||||||
function OperatorGroup({ title }: OperatorGroup) {
|
function OperatorGroup({ title, colour, count, duration }: OperatorGroup) {
|
||||||
return <div className={style.group}>{title}</div>;
|
const groupColour = colour || '#929292';
|
||||||
|
const groupColours = getAccessibleColour(groupColour);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={style.group} style={{ ...groupColours, '--group-colour': groupColour } as CSSProperties}>
|
||||||
|
<span className={style.title}>{title}</span>
|
||||||
|
<span className={style.meta}>
|
||||||
|
<span>{`${count} ${count === 1 ? 'event' : 'events'}`}</span>
|
||||||
|
<span>{formatDuration(duration)}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user