mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 15:09:10 +00:00
fix: add event at end of block
This commit is contained in:
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
|
|||||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
EntryId,
|
EntryId,
|
||||||
|
isOntimeBlock,
|
||||||
isOntimeEvent,
|
isOntimeEvent,
|
||||||
MaybeString,
|
MaybeString,
|
||||||
OntimeBlock,
|
OntimeBlock,
|
||||||
@@ -679,12 +680,12 @@ function optimisticDeleteEntries(entryIds: EntryId[], rundown: Rundown) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteEntry(entry: OntimeEntry) {
|
function deleteEntry(entry: OntimeEntry) {
|
||||||
if (isOntimeEvent(entry) && entry.parent) {
|
if (isOntimeBlock(entry) || !entry.parent) {
|
||||||
|
order = order.filter((id) => id !== entry.id);
|
||||||
|
} else {
|
||||||
const parent = entries[entry.parent] as OntimeBlock;
|
const parent = entries[entry.parent] as OntimeBlock;
|
||||||
parent.events = parent.events.filter((event) => event !== entry.id);
|
parent.events = parent.events.filter((event) => event !== entry.id);
|
||||||
parent.numEvents -= 1;
|
parent.numEvents -= 1;
|
||||||
} else {
|
|
||||||
order = order.filter((id) => id !== entry.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete entries[entry.id];
|
delete entries[entry.id];
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ export default function Rundown({ data }: RundownProps) {
|
|||||||
<Fragment key={entryId}>
|
<Fragment key={entryId}>
|
||||||
{showPrependingQuickAdd && (
|
{showPrependingQuickAdd && (
|
||||||
<QuickAddBlock
|
<QuickAddBlock
|
||||||
previousEventId={rundownMetadata.previousEntryId}
|
previousEventId={rundownMetadata.thisId}
|
||||||
parentBlock={parentId}
|
parentBlock={parentId}
|
||||||
backgroundColor={parentColour}
|
backgroundColor={parentColour}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user