diff --git a/web/src/components/channel_config/ChannelProgrammingConfig.tsx b/web/src/components/channel_config/ChannelProgrammingConfig.tsx index c48c9385..79924f76 100644 --- a/web/src/components/channel_config/ChannelProgrammingConfig.tsx +++ b/web/src/components/channel_config/ChannelProgrammingConfig.tsx @@ -1,14 +1,10 @@ -import { Box, Button, Paper, Stack } from '@mui/material'; +import { Box, Stack } from '@mui/material'; import { DateTimePicker } from '@mui/x-date-pickers'; import dayjs, { Dayjs } from 'dayjs'; import { createContext, useState } from 'react'; import { useSlideSchedule } from '../../hooks/programming_controls/useSlideSchedule.ts'; import { usePreloadedChannelEdit } from '../../hooks/usePreloadedChannel.ts'; -import { - resetLineup, - setChannelStartTime, -} from '../../store/channelEditor/actions.ts'; -import useStore from '../../store/index.ts'; +import { setChannelStartTime } from '../../store/channelEditor/actions.ts'; import AddProgrammingButton from './AddProgrammingButton.tsx'; import AdjustScheduleControls from './AdjustScheduleControls.tsx'; import ChannelProgrammingList from './ChannelProgrammingList.tsx'; @@ -28,7 +24,6 @@ export const ScheduleControlsContext = createContext({ export function ChannelProgrammingConfig() { const { currentEntity: channel } = usePreloadedChannelEdit(); - const programsDirty = useStore((s) => s.channelEditor.dirty.programs); const slideSchedule = useSlideSchedule(); const handleStartTimeChange = (value: Dayjs | null) => { @@ -56,60 +51,52 @@ export function ChannelProgrammingConfig() { }} > - - + - - - handleStartTimeChange(newDateTime)} - slotProps={{ textField: { size: 'small' } }} - /> - - {showScheduleControls && ( - - - - )} - - - - - + + + )} - - + + + + + + ); diff --git a/web/src/pages/channels/ChannelProgrammingPage.tsx b/web/src/pages/channels/ChannelProgrammingPage.tsx index 5362f705..b8abb133 100644 --- a/web/src/pages/channels/ChannelProgrammingPage.tsx +++ b/web/src/pages/channels/ChannelProgrammingPage.tsx @@ -2,6 +2,7 @@ import { Box, Button, CircularProgress, + Paper, Snackbar, Typography, } from '@mui/material'; @@ -11,14 +12,17 @@ import { UpdateChannelProgrammingRequest } from '@tunarr/types/api'; import { ZodiosError } from '@zodios/core'; import { chain, findIndex, first, isUndefined, map } from 'lodash-es'; import { useState } from 'react'; -import { Link as RouterLink } from 'react-router-dom'; import Breadcrumbs from '../../components/Breadcrumbs.tsx'; import { ChannelProgrammingConfig } from '../../components/channel_config/ChannelProgrammingConfig.tsx'; import { apiClient } from '../../external/api.ts'; import { channelProgramUniqueId } from '../../helpers/util.ts'; import { usePreloadedChannelEdit } from '../../hooks/usePreloadedChannel.ts'; import { useUpdateChannel } from '../../hooks/useUpdateChannel.ts'; -import { resetCurrentLineup } from '../../store/channelEditor/actions.ts'; +import { + resetCurrentLineup, + resetLineup, +} from '../../store/channelEditor/actions.ts'; +import useStore from '../../store/index.ts'; type MutateArgs = { channelId: string; @@ -38,6 +42,8 @@ export default function ChannelProgrammingPage() { programList: newLineup, } = usePreloadedChannelEdit(); + const programsDirty = useStore((s) => s.channelEditor.dirty.programs); + const queryClient = useQueryClient(); const theme = useTheme(); @@ -148,15 +154,30 @@ export default function ChannelProgrammingPage() { Channel {channel.number} Programming - - - - - + + + + + {programsDirty && ( + + )} + + + ); }