From 715c2f59d4c2bc71a674c042682ca120f25bbb93 Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Tue, 19 Mar 2024 13:58:42 -0400 Subject: [PATCH 1/4] Pickup "live_updates_enabled" field and show/hide accordingly --- .../LiveUpdateSettings/LiveUpdateSettings.tsx | 39 ++++++++++--------- .../services/models/projects/projectsModel.ts | 2 + 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx index fb9591ca..2b40b64f 100644 --- a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx +++ b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx @@ -8,29 +8,32 @@ import './LiveUpdateSettings.scss'; export interface ILiveUpdateSettingsProp { delay: number; enabled: boolean; - onLiveUpdateConfigChange: ({ enabled }: { enabled: boolean }) => void; } function LiveUpdateSettings( props: ILiveUpdateSettingsProp, ): React.FunctionComponentElement { - return ( - -
- - Live Update: - - { - props.onLiveUpdateConfigChange({ enabled: !props.enabled }); - }} - size='small' - color='primary' - /> -
-
- ); + if (window.live_updates_enabled == 1) { + return ( + +
+ + Live Update: + + { + props.onLiveUpdateConfigChange({ enabled: !props.enabled }); + }} + size='small' + color='primary' + /> +
+
+ ); + } + props.onLiveUpdateConfigChange({ enabled: false }); + return null; } export default React.memo(LiveUpdateSettings); diff --git a/src/src/services/models/projects/projectsModel.ts b/src/src/services/models/projects/projectsModel.ts index 4422c903..a892f888 100644 --- a/src/src/services/models/projects/projectsModel.ts +++ b/src/src/services/models/projects/projectsModel.ts @@ -24,6 +24,8 @@ function getProjectsData() { }).then((data: IProject) => { //@ts-ignore window.telemetry_enabled = data.telemetry_enabled; + //@ts-ignore + window.live_updates_enabled = data.live_updates_enabled; model.setState({ project: data, }); From 47158bfd31ec9c592e7edf9b127082d8b65a8e2f Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Tue, 19 Mar 2024 14:26:52 -0400 Subject: [PATCH 2/4] removed prop mistakenly --- src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx index 2b40b64f..e69eef30 100644 --- a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx +++ b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx @@ -8,6 +8,7 @@ import './LiveUpdateSettings.scss'; export interface ILiveUpdateSettingsProp { delay: number; enabled: boolean; + onLiveUpdateConfigChange: ({ enabled }: { enabled: boolean }) => void; } function LiveUpdateSettings( From ab0c19571f4c2d745c8b8cd94808ef6b715b403b Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Tue, 19 Mar 2024 16:51:24 -0400 Subject: [PATCH 3/4] Fix lint --- src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx index e69eef30..7b743653 100644 --- a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx +++ b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx @@ -14,6 +14,7 @@ export interface ILiveUpdateSettingsProp { function LiveUpdateSettings( props: ILiveUpdateSettingsProp, ): React.FunctionComponentElement { + //@ts-ignore if (window.live_updates_enabled == 1) { return ( From b474956ef6ae3baaaceb947150beda5cc87ac1f7 Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Tue, 19 Mar 2024 17:11:01 -0400 Subject: [PATCH 4/4] fix type complaint --- src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx index 7b743653..5c8dc03f 100644 --- a/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx +++ b/src/src/components/LiveUpdateSettings/LiveUpdateSettings.tsx @@ -13,7 +13,7 @@ export interface ILiveUpdateSettingsProp { function LiveUpdateSettings( props: ILiveUpdateSettingsProp, -): React.FunctionComponentElement { +): React.FunctionComponentElement | null { //@ts-ignore if (window.live_updates_enabled == 1) { return (