mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 22:49:18 +00:00
match group target duration to actual event duration
This commit is contained in:
@@ -2,7 +2,7 @@ import { useSortable } from '@dnd-kit/sortable';
|
|||||||
import { CSS } from '@dnd-kit/utilities';
|
import { CSS } from '@dnd-kit/utilities';
|
||||||
import { EntryId, OntimeGroup } from 'ontime-types';
|
import { EntryId, OntimeGroup } from 'ontime-types';
|
||||||
import { MILLIS_PER_MINUTE } from 'ontime-utils';
|
import { MILLIS_PER_MINUTE } from 'ontime-utils';
|
||||||
import { MouseEvent, useRef } from 'react';
|
import { MouseEvent, useCallback, useRef } from 'react';
|
||||||
import {
|
import {
|
||||||
IoChevronDown,
|
IoChevronDown,
|
||||||
IoChevronUp,
|
IoChevronUp,
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
IoReorderTwo,
|
IoReorderTwo,
|
||||||
IoTrash,
|
IoTrash,
|
||||||
} from 'react-icons/io5';
|
} from 'react-icons/io5';
|
||||||
|
import { TbClockPin } from 'react-icons/tb';
|
||||||
|
|
||||||
import IconButton from '../../../common/components/buttons/IconButton';
|
import IconButton from '../../../common/components/buttons/IconButton';
|
||||||
import Tag from '../../../common/components/tag/Tag';
|
import Tag from '../../../common/components/tag/Tag';
|
||||||
@@ -40,12 +41,16 @@ export default function RundownGroup({ data, hasCursor, collapsed, onCollapse }:
|
|||||||
'use memo';
|
'use memo';
|
||||||
|
|
||||||
const handleRef = useRef<null | HTMLSpanElement>(null);
|
const handleRef = useRef<null | HTMLSpanElement>(null);
|
||||||
const { clone, ungroup, deleteEntry } = useEntryActionsContext();
|
const { clone, ungroup, deleteEntry, updateEntry } = useEntryActionsContext();
|
||||||
|
|
||||||
const selectSingleEntry = useEventSelection((state) => state.setSingleEntrySelection);
|
const selectSingleEntry = useEventSelection((state) => state.setSingleEntrySelection);
|
||||||
const selectedEvents = useEventSelection((state) => state.selectedEvents);
|
const selectedEvents = useEventSelection((state) => state.selectedEvents);
|
||||||
const entryCopyId = useEntryCopy((state) => state.entryCopyId);
|
const entryCopyId = useEntryCopy((state) => state.entryCopyId);
|
||||||
|
|
||||||
|
const matchDuration = useCallback(() => {
|
||||||
|
updateEntry({ id: data.id, targetDuration: data.duration });
|
||||||
|
}, [data.duration, data.id, updateEntry]);
|
||||||
|
|
||||||
const [onContextMenu] = useContextMenu<HTMLDivElement>(() => [
|
const [onContextMenu] = useContextMenu<HTMLDivElement>(() => [
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
@@ -62,6 +67,13 @@ export default function RundownGroup({ data, hasCursor, collapsed, onCollapse }:
|
|||||||
disabled: data.entries.length === 0,
|
disabled: data.entries.length === 0,
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
|
{
|
||||||
|
type: 'item',
|
||||||
|
label: 'Match Content Duration',
|
||||||
|
icon: TbClockPin,
|
||||||
|
onClick: matchDuration,
|
||||||
|
},
|
||||||
|
{ type: 'divider' },
|
||||||
{
|
{
|
||||||
type: 'item',
|
type: 'item',
|
||||||
label: 'Delete Group',
|
label: 'Delete Group',
|
||||||
|
|||||||
Reference in New Issue
Block a user