From 6f34e1006ba0f5d92f0c8120dfa6eee79af58ef9 Mon Sep 17 00:00:00 2001 From: Carlos Valente Date: Tue, 8 Jul 2025 17:11:25 +0200 Subject: [PATCH] refactor: migrate project data --- apps/client/src/AppRouter.tsx | 2 +- .../navigation-menu/ViewNavigationMenu.tsx | 8 +- apps/client/src/common/models/ProjectData.ts | 6 +- .../panel/project-panel/ProjectCreateForm.tsx | 18 ++--- .../panel/settings-panel/ProjectData.tsx | 24 +++--- .../control/message/MessageControlExport.tsx | 2 +- .../control/playback/TimerControlExport.tsx | 2 +- .../src/features/rundown/RundownExport.tsx | 2 +- .../src/features/viewers/clock/Clock.tsx | 2 +- .../viewers/minimal-timer/MinimalTimer.tsx | 2 +- apps/client/src/translation/languages/de.ts | 4 +- apps/client/src/translation/languages/en.ts | 4 +- apps/client/src/translation/languages/es.ts | 4 +- apps/client/src/translation/languages/fr.ts | 5 +- apps/client/src/translation/languages/it.ts | 4 +- apps/client/src/views/backstage/Backstage.tsx | 6 +- apps/client/src/views/countdown/Countdown.tsx | 2 +- .../cuesheet/__tests__/cuesheet.utils.test.ts | 2 +- .../src/views/project-info/ProjectInfo.scss | 5 +- .../src/views/project-info/ProjectInfo.tsx | 78 +++++++++++-------- .../backstage-info/BackstageInfo.tsx | 40 ---------- .../project-info/custom-info/CustomInfo.tsx | 36 --------- .../views/project-info/projectInfo.options.ts | 25 ------ apps/client/src/views/studio/Studio.tsx | 2 +- .../src/views/timeline/TimelinePage.tsx | 2 +- apps/client/src/views/timer/Timer.tsx | 2 +- apps/server/src/api-data/db/db.controller.ts | 6 +- apps/server/src/api-data/db/db.validation.ts | 7 +- .../project-data/projectData.parser.ts | 6 +- .../project-data/projectData.router.ts | 7 +- .../project-data/projectData.validation.ts | 7 +- .../__tests__/DataProvider.utils.test.ts | 8 +- apps/server/src/models/dataModel.ts | 6 +- apps/server/src/models/demoProject.ts | 6 +- .../project-service/ProjectService.ts | 4 +- apps/server/test-db/db.json | 6 +- e2e/tests/fixtures/e2e-test-db.json | 6 +- .../src/definitions/core/ProjectData.type.ts | 6 +- 38 files changed, 136 insertions(+), 228 deletions(-) delete mode 100644 apps/client/src/views/project-info/backstage-info/BackstageInfo.tsx delete mode 100644 apps/client/src/views/project-info/custom-info/CustomInfo.tsx delete mode 100644 apps/client/src/views/project-info/projectInfo.options.ts diff --git a/apps/client/src/AppRouter.tsx b/apps/client/src/AppRouter.tsx index d64f8bd55..926c91849 100644 --- a/apps/client/src/AppRouter.tsx +++ b/apps/client/src/AppRouter.tsx @@ -38,7 +38,7 @@ const SMinimalTimer = withPreset(withData(MinimalTimerView)); const SClock = withPreset(withData(ClockView)); const SCountdown = withPreset(withData(Countdown)); const SBackstage = withPreset(withData(Backstage)); -const SProjectInfo = withPreset(withData(ProjectInfo)); +const SProjectInfo = withPreset(ProjectInfo); // NOTE: ProjectInfo does not use the viewWrapper since it has no options const SLowerThird = withPreset(withData(Lower)); const SStudio = withPreset(withData(StudioClock)); const STimeline = withPreset(withData(Timeline)); diff --git a/apps/client/src/common/components/navigation-menu/ViewNavigationMenu.tsx b/apps/client/src/common/components/navigation-menu/ViewNavigationMenu.tsx index 0b36187f1..733cd1f54 100644 --- a/apps/client/src/common/components/navigation-menu/ViewNavigationMenu.tsx +++ b/apps/client/src/common/components/navigation-menu/ViewNavigationMenu.tsx @@ -8,11 +8,11 @@ import useViewEditor from './useViewEditor'; interface ViewNavigationMenuProps { isLockable?: boolean; - supressSettings?: boolean; + suppressSettings?: boolean; } export default memo(ViewNavigationMenu); -function ViewNavigationMenu({ isLockable, supressSettings }: ViewNavigationMenuProps) { +function ViewNavigationMenu({ isLockable, suppressSettings }: ViewNavigationMenuProps) { const [isMenuOpen, menuHandler] = useDisclosure(); const { showEditFormDrawer, isViewLocked } = useViewEditor({ isLockable }); @@ -28,7 +28,7 @@ function ViewNavigationMenu({ isLockable, supressSettings }: ViewNavigationMenuP [ 'mod + ,', () => { - if (isViewLocked || supressSettings) return; + if (isViewLocked || suppressSettings) return; showEditFormDrawer(); }, { preventDefault: true }, @@ -43,7 +43,7 @@ function ViewNavigationMenu({ isLockable, supressSettings }: ViewNavigationMenuP <> showEditFormDrawer()} + toggleSettings={suppressSettings ? undefined : () => showEditFormDrawer()} /> diff --git a/apps/client/src/common/models/ProjectData.ts b/apps/client/src/common/models/ProjectData.ts index 8ee964be4..899f7052d 100644 --- a/apps/client/src/common/models/ProjectData.ts +++ b/apps/client/src/common/models/ProjectData.ts @@ -3,8 +3,8 @@ import { ProjectData } from 'ontime-types'; export const projectDataPlaceholder: ProjectData = { title: '', description: '', - backstageUrl: '', - backstageInfo: '', - projectLogo: null, + url: '', + info: '', + logo: null, custom: [], }; diff --git a/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx b/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx index 4b8c3e607..ed3c2c604 100644 --- a/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx +++ b/apps/client/src/features/app-settings/panel/project-panel/ProjectCreateForm.tsx @@ -22,8 +22,8 @@ interface ProjectCreateFromProps { type ProjectCreateFormValues = { title?: string; description?: string; - backstageInfo?: string; - backstageUrl?: string; + info?: string; + url?: string; custom?: { title: string; value: string }[]; }; @@ -107,18 +107,12 @@ export default function ProjectCreateForm(props: ProjectCreateFromProps) {