diff --git a/src/App.tsx b/src/App.tsx
index 29099df..a3e2871 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,7 +1,5 @@
import { useState } from 'react'
-import { Grid, Paper, Typography } from '@mui/material'
-import WarningRoundedIcon from '@mui/icons-material/WarningRounded'
-import WaterDropRoundedIcon from '@mui/icons-material/WaterDropRounded'
+import { Paper } from '@mui/material'
import useIrrigationEvents from './hooks/useIrrigationEvents'
import { Resource, ViewState } from '@devexpress/dx-react-scheduler'
import {
@@ -18,6 +16,8 @@ import {
CurrentTimeIndicator,
} from '@devexpress/dx-react-scheduler-material-ui'
import { startOfWeek, endOfWeek, startOfDay, endOfDay } from 'date-fns'
+import AppointmentWithIcon from './components/AppointmentWithIcon'
+import AppointmentTooltipWithIcon from './components/AppointmentTooltipWithIcon'
const refreshIntervalMinutes = import.meta.env.VITE_REFRESH_INTERVAL_MINUTES as number
@@ -59,54 +59,8 @@ const resources: Resource[] = [
},
]
-const AppointmentWithIcon = ({ children, data, ...restProps }: Appointments.AppointmentProps) => (
-
- {data.warning && (
-
- )}
- {data.currentlyOn && (
-
- )}
- {children}
-
-)
-
-const AppointmentTooltipWithIcon = ({
- children,
- appointmentData,
- ...restProps
-}: AppointmentTooltip.ContentProps) => (
-
- {children}
- {appointmentData?.warning && (
-
-
-
-
-
-
- {appointmentData.warning}
-
-
-
- )}
- {appointmentData?.currentlyOn && (
-
-
-
-
-
-
- Device is currently on
-
-
-
- )}
-
-)
-
function App() {
- const [viewCurrentDate, setViewCurrentDate] = useState(new Date())
+ const [viewCurrentDate, setViewCurrentDate] = useState(() => new Date())
const [currentViewName, setCurrentViewName] = useState('Week')
const { data: irrigationEvents } = useIrrigationEvents(
getStartDate(viewCurrentDate, currentViewName),
diff --git a/src/components/AppointmentTooltipWithIcon.tsx b/src/components/AppointmentTooltipWithIcon.tsx
new file mode 100644
index 0000000..d95e05e
--- /dev/null
+++ b/src/components/AppointmentTooltipWithIcon.tsx
@@ -0,0 +1,40 @@
+import WarningRoundedIcon from '@mui/icons-material/WarningRounded'
+import WaterDropRoundedIcon from '@mui/icons-material/WaterDropRounded'
+import { AppointmentTooltip } from '@devexpress/dx-react-scheduler-material-ui'
+import { Grid, Typography } from '@mui/material'
+
+export default function AppointmentTooltipWithIcon({
+ children,
+ appointmentData,
+ ...restProps
+}: AppointmentTooltip.ContentProps) {
+ return (
+
+ {children}
+ {appointmentData?.warning && (
+
+
+
+
+
+
+ {appointmentData.warning}
+
+
+
+ )}
+ {appointmentData?.currentlyOn && (
+
+
+
+
+
+
+ Device is currently on
+
+
+
+ )}
+
+ )
+}
diff --git a/src/components/AppointmentWithIcon.tsx b/src/components/AppointmentWithIcon.tsx
new file mode 100644
index 0000000..a584062
--- /dev/null
+++ b/src/components/AppointmentWithIcon.tsx
@@ -0,0 +1,21 @@
+import WarningRoundedIcon from '@mui/icons-material/WarningRounded'
+import WaterDropRoundedIcon from '@mui/icons-material/WaterDropRounded'
+import { Appointments } from '@devexpress/dx-react-scheduler-material-ui'
+
+export default function AppointmentWithIcon({
+ children,
+ data,
+ ...restProps
+}: Appointments.AppointmentProps) {
+ return (
+
+ {data.warning && (
+
+ )}
+ {data.currentlyOn && (
+
+ )}
+ {children}
+
+ )
+}