mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-25 00:49:10 +00:00
eslint
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "src"
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
+10
-10
@@ -2,26 +2,26 @@ import { lazy, Suspense } from 'react';
|
|||||||
import { Route, Switch } from 'react-router-dom';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import { QueryClient, QueryClientProvider } from 'react-query';
|
import { QueryClient, QueryClientProvider } from 'react-query';
|
||||||
import SocketProvider from './app/context/socketContext';
|
import SocketProvider from 'app/context/socketContext';
|
||||||
import withSocket from './features/viewers/ViewWrapper';
|
import withSocket from 'features/viewers/ViewWrapper';
|
||||||
import { ReactQueryDevtools } from 'react-query/devtools';
|
import { ReactQueryDevtools } from 'react-query/devtools';
|
||||||
import Empty from './common/state/Empty';
|
import Empty from 'common/state/Empty';
|
||||||
|
|
||||||
const Editor = lazy(() => import('./features/editors/Editor'));
|
const Editor = lazy(() => import('features/editors/Editor'));
|
||||||
const PresenterView = lazy(() =>
|
const PresenterView = lazy(() =>
|
||||||
import('./features/viewers/presenter/PresenterView')
|
import('features/viewers/presenter/PresenterView')
|
||||||
);
|
);
|
||||||
const PresenterSimple = lazy(() =>
|
const PresenterSimple = lazy(() =>
|
||||||
import('./features/viewers/presenter/PresenterSimple')
|
import('features/viewers/presenter/PresenterSimple')
|
||||||
);
|
);
|
||||||
const StageManager = lazy(() =>
|
const StageManager = lazy(() =>
|
||||||
import('./features/viewers/backstage/StageManager')
|
import('features/viewers/backstage/StageManager')
|
||||||
);
|
);
|
||||||
const Public = lazy(() => import('./features/viewers/foh/Public'));
|
const Public = lazy(() => import('features/viewers/foh/Public'));
|
||||||
const Lower = lazy(() =>
|
const Lower = lazy(() =>
|
||||||
import('./features/viewers/production/lower/LowerWrapper')
|
import('features/viewers/production/lower/LowerWrapper')
|
||||||
);
|
);
|
||||||
const Pip = lazy(() => import('./features/viewers/production/Pip'));
|
const Pip = lazy(() => import('features/viewers/production/Pip'));
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
// Seemed to cause issues
|
// Seemed to cause issues
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { formatDisplay } from '../../dateConfig';
|
import { formatDisplay } from 'common/dateConfig';
|
||||||
import styles from './Countdown.module.css';
|
import styles from './Countdown.module.css';
|
||||||
|
|
||||||
const Countdown = ({ time, small, negative, hideZeroHours }) => {
|
const Countdown = ({ time, small, negative, hideZeroHours }) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import EditableTimer from '../../input/EditableTimer';
|
import EditableTimer from 'common/input/EditableTimer';
|
||||||
import { showWarningToast } from '../../helpers/toastManager';
|
import { showWarningToast } from 'common/helpers/toastManager';
|
||||||
|
|
||||||
export default function EventTimes(props) {
|
export default function EventTimes(props) {
|
||||||
const { actionHandler, delay, timeStart, timeEnd } = props;
|
const { actionHandler, delay, timeStart, timeEnd } = props;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import EditableTimer from '../../input/EditableTimer';
|
import EditableTimer from 'common/input/EditableTimer';
|
||||||
import { showWarningToast } from '../../helpers/toastManager';
|
import { showWarningToast } from 'common/helpers/toastManager';
|
||||||
import { stringFromMillis } from '../../dateConfig';
|
import { stringFromMillis } from 'common/dateConfig';
|
||||||
|
|
||||||
const label = {
|
const label = {
|
||||||
fontSize: '0.75em',
|
fontSize: '0.75em',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { clamp } from '../../../app/utils';
|
import { clamp } from 'app/utils';
|
||||||
import styles from './MyProgressBar.module.css';
|
import styles from './MyProgressBar.module.css';
|
||||||
|
|
||||||
export default function MyProgressBar(props) {
|
export default function MyProgressBar(props) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Image } from '@chakra-ui/react';
|
|||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import tinykeys from 'tinykeys';
|
import tinykeys from 'tinykeys';
|
||||||
import navlogo from '../../../assets/images/logos/LOGO-72.png';
|
import navlogo from 'assets/images/logos/LOGO-72.png';
|
||||||
import style from './NavLogo.module.css';
|
import style from './NavLogo.module.css';
|
||||||
|
|
||||||
export default function NavLogo() {
|
export default function NavLogo() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import TodayItem from './TodayItem';
|
import TodayItem from './TodayItem';
|
||||||
import style from './Paginator.module.css';
|
import style from './Paginator.module.css';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useInterval } from '../../../app/hooks/useInterval';
|
import { useInterval } from 'app/hooks/useInterval';
|
||||||
|
|
||||||
export default function Paginator(props) {
|
export default function Paginator(props) {
|
||||||
const { events, selectedId } = props;
|
const { events, selectedId } = props;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { stringFromMillis } from '../../../common/dateConfig';
|
import { stringFromMillis } from 'common/dateConfig';
|
||||||
import style from './Paginator.module.css';
|
import style from './Paginator.module.css';
|
||||||
export default function TodayItem(props) {
|
export default function TodayItem(props) {
|
||||||
const { selected, timeStart, timeEnd, title } = props;
|
const { selected, timeStart, timeEnd, title } = props;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ReactComponent as Emptyimage } from '../../assets/images/empty.svg';
|
import { ReactComponent as Emptyimage } from 'assets/images/empty.svg';
|
||||||
import style from './Empty.module.css';
|
import style from './Empty.module.css';
|
||||||
|
|
||||||
export default function Empty(props) {
|
export default function Empty(props) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Editable, EditableInput, EditablePreview } from '@chakra-ui/editable';
|
import { Editable, EditableInput, EditablePreview } from '@chakra-ui/editable';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useSocket } from '../../app/context/socketContext';
|
import { useSocket } from 'app/context/socketContext';
|
||||||
import VisibleIconBtn from '../../common/components/buttons/VisibleIconBtn';
|
import VisibleIconBtn from 'common/components/buttons/VisibleIconBtn';
|
||||||
import style from './MessageControl.module.css';
|
import style from './MessageControl.module.css';
|
||||||
|
|
||||||
const inputProps = {
|
const inputProps = {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import style from './PlaybackControl.module.css';
|
import style from './PlaybackControl.module.css';
|
||||||
import StartIconBtn from '../../common/components/buttons/StartIconBtn';
|
import StartIconBtn from 'common/components/buttons/StartIconBtn';
|
||||||
import PauseIconBtn from '../../common/components/buttons/PauseIconBtn';
|
import PauseIconBtn from 'common/components/buttons/PauseIconBtn';
|
||||||
import PrevIconBtn from '../../common/components/buttons/PrevIconBtn';
|
import PrevIconBtn from 'common/components/buttons/PrevIconBtn';
|
||||||
import NextIconBtn from '../../common/components/buttons/NextIconBtn';
|
import NextIconBtn from 'common/components/buttons/NextIconBtn';
|
||||||
import RollIconBtn from '../../common/components/buttons/RollIconBtn';
|
import RollIconBtn from 'common/components/buttons/RollIconBtn';
|
||||||
import UnloadIconBtn from '../../common/components/buttons/UnloadIconBtn';
|
import UnloadIconBtn from 'common/components/buttons/UnloadIconBtn';
|
||||||
import ReloadIconButton from '../../common/components/buttons/ReloadIconBtn';
|
import ReloadIconButton from 'common/components/buttons/ReloadIconBtn';
|
||||||
|
|
||||||
const areEqual = (prevProps, nextProps) => {
|
const areEqual = (prevProps, nextProps) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import style from './PlaybackControl.module.css';
|
import style from './PlaybackControl.module.css';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useSocket } from '../../app/context/socketContext';
|
import { useSocket } from 'app/context/socketContext';
|
||||||
import PlaybackButtons from './PlaybackButtons';
|
import PlaybackButtons from './PlaybackButtons';
|
||||||
import PlaybackTimer from './PlaybackTimer';
|
import PlaybackTimer from './PlaybackTimer';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import style from './PlaybackControl.module.css';
|
import style from './PlaybackControl.module.css';
|
||||||
import Countdown from '../../common/components/countdown/Countdown';
|
import Countdown from 'common/components/countdown/Countdown';
|
||||||
import { stringFromMillis } from '../../common/dateConfig';
|
import { stringFromMillis } from 'common/dateConfig';
|
||||||
import { Button } from '@chakra-ui/button';
|
import { Button } from '@chakra-ui/button';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { Heading } from '@chakra-ui/layout';
|
import { Heading } from '@chakra-ui/layout';
|
||||||
import { Box } from '@chakra-ui/layout';
|
import { Box } from '@chakra-ui/layout';
|
||||||
import NumberedText from '../../common/components/text/NumberedText';
|
import NumberedText from 'common/components/text/NumberedText';
|
||||||
import PlaybackControl from '../control/PlaybackControl';
|
import PlaybackControl from '../control/PlaybackControl';
|
||||||
import MessageControl from '../control/MessageControl';
|
import MessageControl from '../control/MessageControl';
|
||||||
import styles from './Editor.module.css';
|
import styles from './Editor.module.css';
|
||||||
import EventListWrapper from './list/EventListWrapper';
|
import EventListWrapper from './list/EventListWrapper';
|
||||||
import { useDisclosure } from '@chakra-ui/hooks';
|
import { useDisclosure } from '@chakra-ui/hooks';
|
||||||
import SettingsModal from '../modals/SettingsModal';
|
import SettingsModal from '../modals/SettingsModal';
|
||||||
import SettingsIconBtn from '../../common/components/buttons/SettingsIconBtn';
|
import SettingsIconBtn from 'common/components/buttons/SettingsIconBtn';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export default function Editor() {
|
export default function Editor() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Draggable } from 'react-beautiful-dnd';
|
import { Draggable } from 'react-beautiful-dnd';
|
||||||
import { FiMoreVertical } from 'react-icons/fi';
|
import { FiMoreVertical } from 'react-icons/fi';
|
||||||
import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
|
import DeleteIconBtn from 'common/components/buttons/DeleteIconBtn';
|
||||||
import ActionButtons from './ActionButtons';
|
import ActionButtons from './ActionButtons';
|
||||||
import style from './BlockBlock.module.css';
|
import style from './BlockBlock.module.css';
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Draggable } from 'react-beautiful-dnd';
|
import { Draggable } from 'react-beautiful-dnd';
|
||||||
import { FiMoreVertical } from 'react-icons/fi';
|
import { FiMoreVertical } from 'react-icons/fi';
|
||||||
import { millisToMinutes } from '../../../common/dateConfig';
|
import { millisToMinutes } from 'common/dateConfig';
|
||||||
import ActionButtons from './ActionButtons';
|
import ActionButtons from './ActionButtons';
|
||||||
import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
|
import DeleteIconBtn from 'common/components/buttons/DeleteIconBtn';
|
||||||
import ApplyIconBtn from '../../../common/components/buttons/ApplyIconBtn';
|
import ApplyIconBtn from 'common/components/buttons/ApplyIconBtn';
|
||||||
import DelayInput from '../../../common/input/DelayInput';
|
import DelayInput from 'common/input/DelayInput';
|
||||||
import style from './DelayBlock.module.css';
|
import style from './DelayBlock.module.css';
|
||||||
|
|
||||||
export default function DelayBlock(props) {
|
export default function DelayBlock(props) {
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import Icon from '@chakra-ui/icon';
|
|||||||
import { FiChevronDown, FiChevronUp, FiMoreVertical } from 'react-icons/fi';
|
import { FiChevronDown, FiChevronUp, FiMoreVertical } from 'react-icons/fi';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Draggable } from 'react-beautiful-dnd';
|
import { Draggable } from 'react-beautiful-dnd';
|
||||||
import EventTimes from '../../../common/components/eventTimes/EventTimes';
|
import EventTimes from 'common/components/eventTimes/EventTimes';
|
||||||
import EventTimesVertical from '../../../common/components/eventTimes/EventTimesVertical';
|
import EventTimesVertical from 'common/components/eventTimes/EventTimesVertical';
|
||||||
import EditableText from '../../../common/input/EditableText';
|
import EditableText from 'common/input/EditableText';
|
||||||
import ActionButtons from './ActionButtons';
|
import ActionButtons from './ActionButtons';
|
||||||
import VisibleIconBtn from '../../../common/components/buttons/VisibleIconBtn';
|
import VisibleIconBtn from 'common/components/buttons/VisibleIconBtn';
|
||||||
import DeleteIconBtn from '../../../common/components/buttons/DeleteIconBtn';
|
import DeleteIconBtn from 'common/components/buttons/DeleteIconBtn';
|
||||||
import { millisToMinutes } from '../../../common/dateConfig';
|
import { millisToMinutes } from 'common/dateConfig';
|
||||||
import style from './EventBlock.module.css';
|
import style from './EventBlock.module.css';
|
||||||
|
|
||||||
const ExpandedBlock = (props) => {
|
const ExpandedBlock = (props) => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import style from './List.module.css';
|
import style from './List.module.css';
|
||||||
import { Fragment, useEffect, useState } from 'react';
|
import { Fragment, useEffect, useState } from 'react';
|
||||||
import { useSocket } from '../../../app/context/socketContext';
|
import { useSocket } from 'app/context/socketContext';
|
||||||
import tinykeys from 'tinykeys';
|
import tinykeys from 'tinykeys';
|
||||||
import Empty from '../../../common/state/Empty';
|
import Empty from 'common/state/Empty';
|
||||||
import EventListItem from './EventListItem';
|
import EventListItem from './EventListItem';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
|
||||||
@@ -45,7 +45,7 @@ export default function EventList(props) {
|
|||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
}, [cursor, events, eventsHandler]);
|
}, [cursor, events.length, eventsHandler]);
|
||||||
|
|
||||||
// handle incoming messages
|
// handle incoming messages
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import DelayBlock from './DelayBlock';
|
import DelayBlock from './DelayBlock';
|
||||||
import BlockBlock from './BlockBlock';
|
import BlockBlock from './BlockBlock';
|
||||||
import EventBlock from './EventBlock';
|
import EventBlock from './EventBlock';
|
||||||
import { showErrorToast } from '../../../common/helpers/toastManager';
|
import { showErrorToast } from 'common/helpers/toastManager';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
const areEqual = (prevProps, nextProps) => {
|
const areEqual = (prevProps, nextProps) => {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import {
|
|||||||
requestDelete,
|
requestDelete,
|
||||||
requestReorder,
|
requestReorder,
|
||||||
requestApplyDelay,
|
requestApplyDelay,
|
||||||
} from '../../../app/api/eventsApi.js';
|
} from 'app/api/eventsApi.js';
|
||||||
import EventList from './EventList';
|
import EventList from './EventList';
|
||||||
import EventListMenu from '../../menu/EventListMenu.jsx';
|
import EventListMenu from 'features/menu/EventListMenu.jsx';
|
||||||
import { showErrorToast } from '../../../common/helpers/toastManager';
|
import { showErrorToast } from 'common/helpers/toastManager';
|
||||||
import { useFetch } from '../../../app/hooks/useFetch.js';
|
import { useFetch } from 'app/hooks/useFetch.js';
|
||||||
import Empty from '../../../common/state/Empty';
|
import Empty from 'common/state/Empty';
|
||||||
|
|
||||||
export default function EventListWrapper() {
|
export default function EventListWrapper() {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
export const sortByDate = (arr) => {
|
|
||||||
const sorter = (a, b) => {
|
|
||||||
return new Date(a.timeStart).getTime() - new Date(b.timeStart).getTime();
|
|
||||||
};
|
|
||||||
return arr.sort(sorter);
|
|
||||||
};
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
import { Skeleton } from '@chakra-ui/skeleton';
|
|
||||||
|
|
||||||
import style from '../list/List.module.css';
|
|
||||||
|
|
||||||
export default function EventListSkeleton() {
|
|
||||||
return (
|
|
||||||
<div className={style.eventContainer}>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='1.2'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='1.6'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.0'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.4'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.8'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='3.2'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='3.6'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='4.0'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='4.4'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='4.0'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='3.6'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='3.2'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.8'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.4'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='2.0'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='1.6'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
<Skeleton
|
|
||||||
height='4vh'
|
|
||||||
speed='1.2'
|
|
||||||
startColor='#333333'
|
|
||||||
endColor='#202020'
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -14,9 +14,9 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Textarea,
|
Textarea,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { fetchEvent, postEvent, eventNamespace } from '../../app/api/eventApi';
|
import { fetchEvent, postEvent, eventNamespace } from 'app/api/eventApi';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useFetch } from '../../app/hooks/useFetch';
|
import { useFetch } from 'app/hooks/useFetch';
|
||||||
|
|
||||||
export default function SettingsModal(props) {
|
export default function SettingsModal(props) {
|
||||||
const { data, status, isError } = useFetch(eventNamespace, fetchEvent);
|
const { data, status, isError } = useFetch(eventNamespace, fetchEvent);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { eventsNamespace, fetchAllEvents } from '../../app/api/eventsApi';
|
import { eventsNamespace, fetchAllEvents } from 'app/api/eventsApi';
|
||||||
import { fetchEvent, eventNamespace } from '../../app/api/eventApi';
|
import { fetchEvent, eventNamespace } from 'app/api/eventApi';
|
||||||
import { useSocket } from '../../app/context/socketContext';
|
import { useSocket } from 'app/context/socketContext';
|
||||||
import { stringFromMillis } from '../../common/dateConfig';
|
import { stringFromMillis } from 'common/dateConfig';
|
||||||
import { useFetch } from '../../app/hooks/useFetch';
|
import { useFetch } from 'app/hooks/useFetch';
|
||||||
|
|
||||||
const withSocket = (Component) => {
|
const withSocket = (Component) => {
|
||||||
const WrappedComponent = (props) => {
|
const WrappedComponent = (props) => {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import QRCode from 'react-qr-code';
|
import QRCode from 'react-qr-code';
|
||||||
import { formatDisplay } from '../../../common/dateConfig';
|
import { formatDisplay } from 'common/dateConfig';
|
||||||
import style from './StageManager.module.css';
|
import style from './StageManager.module.css';
|
||||||
import Paginator from '../../../common/components/views/Paginator';
|
import Paginator from 'common/components/views/Paginator';
|
||||||
import NavLogo from '../../../common/components/nav/NavLogo';
|
import NavLogo from 'common/components/nav/NavLogo';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import TitleSide from '../../../common/components/views/TitleSide';
|
import TitleSide from 'common/components/views/TitleSide';
|
||||||
|
|
||||||
export default function StageManager(props) {
|
export default function StageManager(props) {
|
||||||
const { publ, title, time, backstageEvents, selectedId, general } = props;
|
const { publ, title, time, backstageEvents, selectedId, general } = props;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import QRCode from 'react-qr-code';
|
import QRCode from 'react-qr-code';
|
||||||
import style from './Public.module.css';
|
import style from './Public.module.css';
|
||||||
import Paginator from '../../../common/components/views/Paginator';
|
import Paginator from 'common/components/views/Paginator';
|
||||||
import NavLogo from '../../../common/components/nav/NavLogo';
|
import NavLogo from 'common/components/nav/NavLogo';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import TitleSide from '../../../common/components/views/TitleSide';
|
import TitleSide from 'common/components/views/TitleSide';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export default function Public(props) {
|
export default function Public(props) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import Countdown from '../../../common/components/countdown/Countdown';
|
import Countdown from 'common/components/countdown/Countdown';
|
||||||
import MyProgressBar from '../../../common/components/myProgressBar/MyProgressBar';
|
import MyProgressBar from 'common/components/myProgressBar/MyProgressBar';
|
||||||
import NavLogo from '../../../common/components/nav/NavLogo';
|
import NavLogo from 'common/components/nav/NavLogo';
|
||||||
import TitleCard from '../../../common/components/views/TitleCard';
|
import TitleCard from 'common/components/views/TitleCard';
|
||||||
import style from './PresenterView.module.css';
|
import style from './PresenterView.module.css';
|
||||||
|
|
||||||
export default function PresenterView(props) {
|
export default function PresenterView(props) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import QRCode from 'react-qr-code';
|
import QRCode from 'react-qr-code';
|
||||||
import style from './Pip.module.css';
|
import style from './Pip.module.css';
|
||||||
import Paginator from '../../../common/components/views/Paginator';
|
import Paginator from 'common/components/views/Paginator';
|
||||||
import NavLogo from '../../../common/components/nav/NavLogo';
|
import NavLogo from 'common/components/nav/NavLogo';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { formatDisplay } from '../../../common/dateConfig';
|
import { formatDisplay } from 'common/dateConfig';
|
||||||
import { ReactComponent as Emptyimage } from '../../../assets/images/empty.svg';
|
import { ReactComponent as Emptyimage } from 'assets/images/empty.svg';
|
||||||
|
|
||||||
export default function Pip(props) {
|
export default function Pip(props) {
|
||||||
const { time, backstageEvents, selectedId, general } = props;
|
const { time, backstageEvents, selectedId, general } = props;
|
||||||
|
|||||||
+14
-14
@@ -4,23 +4,20 @@ const config = require('./config.json');
|
|||||||
// init database
|
// init database
|
||||||
const low = require('lowdb');
|
const low = require('lowdb');
|
||||||
const FileSync = require('lowdb/adapters/FileSync');
|
const FileSync = require('lowdb/adapters/FileSync');
|
||||||
|
|
||||||
const adapter = new FileSync(config.database.filename);
|
const adapter = new FileSync(config.database.filename);
|
||||||
const db = low(adapter);
|
const db = low(adapter);
|
||||||
|
|
||||||
// TODO: move defaults to config file
|
|
||||||
db.defaults({
|
|
||||||
events: [],
|
|
||||||
event: { title: '', url: '', publicInfo: '', backstageInfo: '' },
|
|
||||||
settings: {},
|
|
||||||
}).write();
|
|
||||||
|
|
||||||
// export db
|
|
||||||
module.exports.db = db;
|
|
||||||
|
|
||||||
// dependencies
|
// dependencies
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
|
const dataModel = require('./data/dataModel.js');
|
||||||
|
|
||||||
|
db.defaults(dataModel).write();
|
||||||
|
|
||||||
|
// export db
|
||||||
|
module.exports.db = db;
|
||||||
|
|
||||||
// Import Routes
|
// Import Routes
|
||||||
const eventsRouter = require('./routes/eventsRouter.js');
|
const eventsRouter = require('./routes/eventsRouter.js');
|
||||||
@@ -52,7 +49,7 @@ app.use('/events', eventsRouter);
|
|||||||
app.use('/event', eventRouter);
|
app.use('/event', eventRouter);
|
||||||
|
|
||||||
// implement general router
|
// implement general router
|
||||||
app.get('/', function (req, res) {
|
app.get('/', (req, res) => {
|
||||||
res.send('ontime API');
|
res.send('ontime API');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,11 +67,14 @@ const eventlist = db.get('events').value();
|
|||||||
|
|
||||||
// init timer
|
// init timer
|
||||||
global.timer = new EventTimer(server, config);
|
global.timer = new EventTimer(server, config);
|
||||||
timer.setupWithEventList(eventlist);
|
global.timer.setupWithEventList(eventlist);
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
server.listen(port, () => console.log(`HTTP Server is listening on port ${port}`));
|
server.listen(port, () =>
|
||||||
|
console.log(`HTTP Server is listening on port ${port}`)
|
||||||
|
);
|
||||||
|
|
||||||
// Start OSC server
|
// Start OSC server
|
||||||
const initiateOSC = require('./controllers/OscController.js').initiateOSC;
|
const { initiateOSC } = require('./controllers/OscController.js');
|
||||||
|
|
||||||
initiateOSC(config.osc);
|
initiateOSC(config.osc);
|
||||||
|
|||||||
@@ -51,12 +51,20 @@ const initiateOSC = (config) => {
|
|||||||
break;
|
break;
|
||||||
case 'delay':
|
case 'delay':
|
||||||
console.log('calling delay with', args);
|
console.log('calling delay with', args);
|
||||||
let t = parseInt(args);
|
try {
|
||||||
if (!isNaN(t)) global.timer.increment(t * 1000 * 60);
|
let t = parseInt(args);
|
||||||
|
if (!isNaN(t)) global.timer.increment(t * 1000 * 60);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('error parsing: ', error);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'goto':
|
case 'goto':
|
||||||
console.log('calling goto with', args);
|
console.log('calling goto with', args);
|
||||||
global.timer.loadEventById(args.toLowerCase());
|
try {
|
||||||
|
global.timer.loadEventById(args.toLowerCase());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('error calling goto: ', error);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// get database
|
// get database
|
||||||
const db = require('../app.js').db;
|
const { db } = require('../app.js');
|
||||||
|
|
||||||
const table = 'event';
|
const table = 'event';
|
||||||
|
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
@@ -18,7 +19,7 @@ exports.getAll = async (req, res) => {
|
|||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.post = async (req, res) => {
|
exports.post = async (req, res) => {
|
||||||
if (!req.body) {
|
if (!req.body) {
|
||||||
res.status(400).send(`No object found in request`);
|
res.status(400).send('No object found in request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: validate data
|
// TODO: validate data
|
||||||
@@ -45,7 +46,7 @@ exports.titleGet = async (req, res) => {
|
|||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.titlePost = async (req, res) => {
|
exports.titlePost = async (req, res) => {
|
||||||
if (!req.body) {
|
if (!req.body) {
|
||||||
res.status(400).send(`No object found in request`);
|
res.status(400).send('No object found in request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ exports.titlePost = async (req, res) => {
|
|||||||
// Create controller for GET request to '/event/url'
|
// Create controller for GET request to '/event/url'
|
||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.urlGet = async (req, res) => {
|
exports.urlGet = async (req, res) => {
|
||||||
let event = getEventOptions();
|
const event = getSettings();
|
||||||
|
|
||||||
if (event) res.json(event.url);
|
if (event) res.json(event.url);
|
||||||
else res.sendStatus(400);
|
else res.sendStatus(400);
|
||||||
@@ -71,7 +72,7 @@ exports.urlGet = async (req, res) => {
|
|||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.urlPost = async (req, res) => {
|
exports.urlPost = async (req, res) => {
|
||||||
if (!req.body) {
|
if (!req.body) {
|
||||||
res.status(400).send(`No object found in request`);
|
res.status(400).send('No object found in request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ exports.publicInfoGet = async (req, res) => {
|
|||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.publicInfoPost = async (req, res) => {
|
exports.publicInfoPost = async (req, res) => {
|
||||||
if (!req.body) {
|
if (!req.body) {
|
||||||
res.status(400).send(`No object found in request`);
|
res.status(400).send('No object found in request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +124,7 @@ exports.backstageInfoGet = async (req, res) => {
|
|||||||
// Returns ACK message
|
// Returns ACK message
|
||||||
exports.backstageInfoPost = async (req, res) => {
|
exports.backstageInfoPost = async (req, res) => {
|
||||||
if (!req.body) {
|
if (!req.body) {
|
||||||
res.status(400).send(`No object found in request`);
|
res.status(400).send('No object found in request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
const dbModel = {
|
||||||
|
events: [],
|
||||||
|
event: {
|
||||||
|
title: '',
|
||||||
|
url: '',
|
||||||
|
publicInfo: '',
|
||||||
|
backStageInfo: '',
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
app: 'ontime',
|
||||||
|
version: 1,
|
||||||
|
osc_enabled: false,
|
||||||
|
osc_port: 8888,
|
||||||
|
lock: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { dbModel };
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"events": [],
|
|
||||||
"event": {
|
|
||||||
"title": "",
|
|
||||||
"url": "",
|
|
||||||
"publicInfo": "",
|
|
||||||
"backStageInfo": ""
|
|
||||||
},
|
|
||||||
"settings": {
|
|
||||||
"app": "ontime",
|
|
||||||
"version": 1,
|
|
||||||
"osc_enabled": false,
|
|
||||||
"osc_port": 8008,
|
|
||||||
"lock": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user