diff --git a/apps/client/src/common/hooks/useEventAction.ts b/apps/client/src/common/hooks/useEventAction.ts index 4d3085774..4cbc8f2d8 100644 --- a/apps/client/src/common/hooks/useEventAction.ts +++ b/apps/client/src/common/hooks/useEventAction.ts @@ -13,14 +13,14 @@ import { requestPutEvent, requestReorderEvent, } from '../api/eventsApi'; -import { useLocalEvent } from '../stores/localEvent'; +import { useEditorSettings } from '../stores/editorSettings'; /** * @description Set of utilities for events */ export const useEventAction = () => { const queryClient = useQueryClient(); - const eventSettings = useLocalEvent((state) => state.eventSettings); + const eventSettings = useEditorSettings((state) => state.eventSettings); const defaultPublic = eventSettings.defaultPublic; const startTimeIsLastEnd = eventSettings.startTimeIsLastEnd; diff --git a/apps/client/src/common/models/EventData.ts b/apps/client/src/common/models/EventData.ts index ff121d821..9add8fee4 100644 --- a/apps/client/src/common/models/EventData.ts +++ b/apps/client/src/common/models/EventData.ts @@ -2,6 +2,7 @@ import { EventData } from 'ontime-types'; export const eventDataPlaceholder: EventData = { title: '', + description: '', publicUrl: '', publicInfo: '', backstageUrl: '', diff --git a/apps/client/src/common/stores/editorSettings.ts b/apps/client/src/common/stores/editorSettings.ts new file mode 100644 index 000000000..c4922303a --- /dev/null +++ b/apps/client/src/common/stores/editorSettings.ts @@ -0,0 +1,67 @@ +import { create } from 'zustand'; + +import { booleanFromLocalStorage } from '../utils/localStorage'; + +type EditorSettings = { + showQuickEntry: boolean; + startTimeIsLastEnd: boolean; + defaultPublic: boolean; + showNif: boolean; +}; + +type EditorSettingsStore = { + eventSettings: EditorSettings; + setLocalEventSettings: (newState: EditorSettings) => void; + setShowQuickEntry: (showQuickEntry: boolean) => void; + setStartTimeIsLastEnd: (startTimeIsLastEnd: boolean) => void; + setDefaultPublic: (defaultPublic: boolean) => void; + setShowNif: (showNif: boolean) => void; +}; + +enum EditorSettingsKeys { + ShowQuickEntry = 'ontime-show-quick-entry', + StartTimeIsLastEnd = 'ontime-start-is-last-end', + DefaultPublic = 'ontime-default-public', + ShowNif = 'ontime-show-nif', +} + +export const useEditorSettings = create((set) => ({ + eventSettings: { + showQuickEntry: booleanFromLocalStorage(EditorSettingsKeys.ShowQuickEntry, false), + startTimeIsLastEnd: booleanFromLocalStorage(EditorSettingsKeys.ShowQuickEntry, true), + defaultPublic: booleanFromLocalStorage(EditorSettingsKeys.ShowQuickEntry, true), + showNif: booleanFromLocalStorage(EditorSettingsKeys.ShowNif, true), + }, + + setLocalEventSettings: (value) => + set(() => { + localStorage.setItem(EditorSettingsKeys.ShowQuickEntry, String(value.showQuickEntry)); + localStorage.setItem(EditorSettingsKeys.StartTimeIsLastEnd, String(value.startTimeIsLastEnd)); + localStorage.setItem(EditorSettingsKeys.DefaultPublic, String(value.defaultPublic)); + return { eventSettings: value }; + }), + + setShowQuickEntry: (showQuickEntry) => + set((state) => { + localStorage.setItem(EditorSettingsKeys.ShowQuickEntry, String(showQuickEntry)); + return { eventSettings: { ...state.eventSettings, showQuickEntry } }; + }), + + setStartTimeIsLastEnd: (startTimeIsLastEnd) => + set((state) => { + localStorage.setItem(EditorSettingsKeys.StartTimeIsLastEnd, String(startTimeIsLastEnd)); + return { eventSettings: { ...state.eventSettings, startTimeIsLastEnd } }; + }), + + setDefaultPublic: (defaultPublic) => + set((state) => { + localStorage.setItem(EditorSettingsKeys.DefaultPublic, String(defaultPublic)); + return { eventSettings: { ...state.eventSettings, defaultPublic } }; + }), + + setShowNif: (showNif) => + set((state) => { + localStorage.setItem(EditorSettingsKeys.ShowNif, String(showNif)); + return { eventSettings: { ...state.eventSettings, showNif } }; + }), +})); diff --git a/apps/client/src/common/stores/localEvent.ts b/apps/client/src/common/stores/localEvent.ts deleted file mode 100644 index d6b9a3dcd..000000000 --- a/apps/client/src/common/stores/localEvent.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { create } from 'zustand'; - -import { booleanFromLocalStorage } from '../utils/localStorage'; - -type EventSettings = { - showQuickEntry: boolean; - startTimeIsLastEnd: boolean; - defaultPublic: boolean; -}; - -type LocalEventStore = { - eventSettings: EventSettings; - setLocalEventSettings: (newState: EventSettings) => void; - setShowQuickEntry: (showQuickEntry: boolean) => void; - setStartTimeIsLastEnd: (startTimeIsLastEnd: boolean) => void; - setDefaultPublic: (defaultPublic: boolean) => void; -}; - -enum LocalEventKeys { - ShowQuickEntry = 'ontime-show-quick-entry', - StartTimeIsLastEnd = 'ontime-start-is-last-end', - DefaultPublic = 'ontime-default-public', -} - -export const useLocalEvent = create((set) => ({ - eventSettings: { - showQuickEntry: booleanFromLocalStorage(LocalEventKeys.ShowQuickEntry, false), - startTimeIsLastEnd: booleanFromLocalStorage(LocalEventKeys.ShowQuickEntry, true), - defaultPublic: booleanFromLocalStorage(LocalEventKeys.ShowQuickEntry, true), - }, - - setLocalEventSettings: (value) => - set(() => { - localStorage.setItem(LocalEventKeys.ShowQuickEntry, String(value.showQuickEntry)); - localStorage.setItem(LocalEventKeys.StartTimeIsLastEnd, String(value.startTimeIsLastEnd)); - localStorage.setItem(LocalEventKeys.DefaultPublic, String(value.defaultPublic)); - return { eventSettings: value }; - }), - - setShowQuickEntry: (showQuickEntry) => - set((state) => { - localStorage.setItem(LocalEventKeys.ShowQuickEntry, String(showQuickEntry)); - return { eventSettings: { ...state.eventSettings, showQuickEntry } }; - }), - - setStartTimeIsLastEnd: (startTimeIsLastEnd) => - set((state) => { - localStorage.setItem(LocalEventKeys.StartTimeIsLastEnd, String(startTimeIsLastEnd)); - return { eventSettings: { ...state.eventSettings, startTimeIsLastEnd } }; - }), - - setDefaultPublic: (defaultPublic) => - set((state) => { - localStorage.setItem(LocalEventKeys.DefaultPublic, String(defaultPublic)); - return { eventSettings: { ...state.eventSettings, defaultPublic } }; - }), -})); diff --git a/apps/client/src/features/info/Info.module.scss b/apps/client/src/features/info/Info.module.scss index c98851b7d..fadabd735 100644 --- a/apps/client/src/features/info/Info.module.scss +++ b/apps/client/src/features/info/Info.module.scss @@ -19,6 +19,13 @@ } } +.description { + color: $label-gray; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + .labels { font-size: $inner-section-text-size; display: flex; diff --git a/apps/client/src/features/info/Info.tsx b/apps/client/src/features/info/Info.tsx index 68d37a014..d8807ce73 100644 --- a/apps/client/src/features/info/Info.tsx +++ b/apps/client/src/features/info/Info.tsx @@ -1,4 +1,5 @@ import { useInfoPanel } from '../../common/hooks/useSocket'; +import { useEditorSettings } from '../../common/stores/editorSettings'; import InfoHeader from './info-header/InfoHeader'; import CollapsableInfo from './CollapsableInfo'; @@ -8,6 +9,7 @@ import InfoTitles from './InfoTitles'; export default function Info() { const data = useInfoPanel(); + const showNif = useEditorSettings((state) => state.eventSettings.showNif); const titlesNow = { title: data.titles.titleNow || '', @@ -32,9 +34,11 @@ export default function Info() { return ( <> - - - + {showNif && ( + + + + )} diff --git a/apps/client/src/features/info/info-header/InfoHeader.tsx b/apps/client/src/features/info/info-header/InfoHeader.tsx index a1efea41a..577d53932 100644 --- a/apps/client/src/features/info/info-header/InfoHeader.tsx +++ b/apps/client/src/features/info/info-header/InfoHeader.tsx @@ -6,9 +6,12 @@ export default function InfoHeader({ selected }: { selected: string }) { const { data } = useEventData(); return ( -
- {data?.title || ''} - {selected} -
+ <> +
+ {data?.title || ''} + {selected} +
+
{data?.description || ''}
+ ); } diff --git a/apps/client/src/features/modals/quick-start/QuickStart.tsx b/apps/client/src/features/modals/quick-start/QuickStart.tsx index e262e4b3a..c3eae49cf 100644 --- a/apps/client/src/features/modals/quick-start/QuickStart.tsx +++ b/apps/client/src/features/modals/quick-start/QuickStart.tsx @@ -102,6 +102,18 @@ export default function QuickStart({ onClose, isOpen }: QuickStartProps) { /> +
+ +