mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
fix: reset focus when deleting all
This commit is contained in:
committed by
Carlos Valente
parent
8b6e06150a
commit
d41d1b054d
@@ -7,11 +7,12 @@ import { IoTrashOutline } from '@react-icons/all-files/io5/IoTrashOutline';
|
|||||||
import { SupportedEvent } from 'ontime-types';
|
import { SupportedEvent } from 'ontime-types';
|
||||||
|
|
||||||
import { useEventAction } from '../../../common/hooks/useEventAction';
|
import { useEventAction } from '../../../common/hooks/useEventAction';
|
||||||
|
import { useAppMode } from '../../../common/stores/appModeStore';
|
||||||
import { useEventSelection } from '../useEventSelection';
|
import { useEventSelection } from '../useEventSelection';
|
||||||
|
|
||||||
const RundownMenu = ({ children }: { children: ReactNode }) => {
|
const RundownMenu = ({ children }: { children: ReactNode }) => {
|
||||||
const { clearSelectedEvents } = useEventSelection();
|
const clearSelectedEvents = useEventSelection((state) => state.clearSelectedEvents);
|
||||||
|
const setCursor = useAppMode((state) => state.setCursor);
|
||||||
const { addEvent, deleteAllEvents } = useEventAction();
|
const { addEvent, deleteAllEvents } = useEventAction();
|
||||||
|
|
||||||
const newEvent = useCallback(() => {
|
const newEvent = useCallback(() => {
|
||||||
@@ -29,8 +30,8 @@ const RundownMenu = ({ children }: { children: ReactNode }) => {
|
|||||||
const deleteAll = useCallback(() => {
|
const deleteAll = useCallback(() => {
|
||||||
deleteAllEvents();
|
deleteAllEvents();
|
||||||
clearSelectedEvents();
|
clearSelectedEvents();
|
||||||
// setCursor(null);
|
setCursor(null);
|
||||||
}, [deleteAllEvents, clearSelectedEvents]);
|
}, [clearSelectedEvents, deleteAllEvents, setCursor]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu isLazy lazyBehavior='unmount' variant='ontime-on-dark' placement='right-start'>
|
<Menu isLazy lazyBehavior='unmount' variant='ontime-on-dark' placement='right-start'>
|
||||||
|
|||||||
Reference in New Issue
Block a user