From 00233495340f167096dd16b30e7ac76fa8a739fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedroza?= Date: Fri, 10 Nov 2023 08:41:47 -0300 Subject: [PATCH] Remove Template View Mode --- .../openblocks/src/constants/configConstants.ts | 1 - client/packages/openblocks/src/util/hooks.ts | 10 ---------- proxy/src/api/pocketbase/types.ts | 1 - proxy/src/mocks/configs.ts | 4 +--- proxy/src/types.ts | 1 - server/pb_hooks/pbl_utils.js | 10 ---------- 6 files changed, 1 insertion(+), 26 deletions(-) diff --git a/client/packages/openblocks/src/constants/configConstants.ts b/client/packages/openblocks/src/constants/configConstants.ts index 1b5491af..4068056f 100644 --- a/client/packages/openblocks/src/constants/configConstants.ts +++ b/client/packages/openblocks/src/constants/configConstants.ts @@ -19,7 +19,6 @@ export interface BrandingConfig { favicon?: string; brandName?: string; headerColor?: string; - enableTemplateViewMode?: boolean; } export type ConfigBaseInfo = { diff --git a/client/packages/openblocks/src/util/hooks.ts b/client/packages/openblocks/src/util/hooks.ts index 24cc0322..01cf6faa 100644 --- a/client/packages/openblocks/src/util/hooks.ts +++ b/client/packages/openblocks/src/util/hooks.ts @@ -16,8 +16,6 @@ import { checkIsMobile } from "util/commonUtils"; import { EditorContext } from "comps/editorState"; import { getDataSourceStructures } from "redux/selectors/datasourceSelectors"; import { DatasourceStructure } from "api/datasourceApi"; -import { selectSystemConfig } from "redux/selectors/configSelectors"; -import { getUser } from "redux/selectors/usersSelectors"; export const ForceViewModeContext = React.createContext(false); @@ -48,16 +46,8 @@ export function useMaxWidth() { } export function useTemplateViewMode() { - const systemConfig = useSelector(selectSystemConfig); - const user = useSelector(getUser); const search = useLocation().search; - if( - systemConfig?.branding?.enableTemplateViewMode - && user && user.isAnonymous - ) { - return true - } if (!useUserViewMode) { return false; } diff --git a/proxy/src/api/pocketbase/types.ts b/proxy/src/api/pocketbase/types.ts index 3193a5a1..bee60c25 100644 --- a/proxy/src/api/pocketbase/types.ts +++ b/proxy/src/api/pocketbase/types.ts @@ -66,7 +66,6 @@ export interface PBSettings extends BaseModel { logo: string; icon: string; header_color: string; - anon_template_view?: boolean; home_page: string | null; themes: string; theme: string; // id diff --git a/proxy/src/mocks/configs.ts b/proxy/src/mocks/configs.ts index 6a0c7de6..af0bb875 100644 --- a/proxy/src/mocks/configs.ts +++ b/proxy/src/mocks/configs.ts @@ -10,8 +10,7 @@ export default [ mocker.get("/api/v1/configs", async () => { const settingsResponse = await settings.get(); if (settingsResponse.data) { - const { org_name, header_color, logo, icon, anon_template_view } = - settingsResponse.data; + const { org_name, header_color, logo, icon } = settingsResponse.data; return createDefaultResponse({ authConfigs: await getAuthConfigs(), workspaceMode: "ENTERPRISE", @@ -26,7 +25,6 @@ export default [ favicon: icon, brandName: org_name, headerColor: header_color, - enableTemplateViewMode: anon_template_view, }, }); } diff --git a/proxy/src/types.ts b/proxy/src/types.ts index 4146561c..f0eb9ebd 100644 --- a/proxy/src/types.ts +++ b/proxy/src/types.ts @@ -47,7 +47,6 @@ export interface Settings extends BaseModel { logo?: string; icon?: string; header_color?: string; - anon_template_view?: boolean; home_page: Application | string | null; themes: string; theme: string; // id diff --git a/server/pb_hooks/pbl_utils.js b/server/pb_hooks/pbl_utils.js index 5cb58a4d..600453e3 100644 --- a/server/pb_hooks/pbl_utils.js +++ b/server/pb_hooks/pbl_utils.js @@ -314,16 +314,6 @@ module.exports = { pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", }, }, - { - system: false, - id: "bjehlimo", - name: "anon_template_view", - type: "bool", - required: false, - presentable: false, - unique: false, - options: {}, - }, { system: false, id: "jzvxz6oh",