Skip to content

Commit

Permalink
Added features that build view
Browse files Browse the repository at this point in the history
  • Loading branch information
Imiss-U1025 committed Nov 5, 2024
1 parent 7d1c335 commit a21cb55
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ declare var numbro: any;
declare var uuid: any;
declare var PUBLIC_URL: string;
declare var REACT_APP_EDITION: string;
declare var REACT_APP_VIEW_MODE: string;
declare var REACT_APP_LANGUAGES: string;
declare var REACT_APP_COMMIT_ID: string;
declare var REACT_APP_API_SERVICE_URL: string;
Expand Down
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/dev-utils/buildVars.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const buildVars = [
defaultValue: "app",
},
{
name: "REACT_APP_DISABLE_JS_SANDBOX",
defaultValue: "",
name: "REACT_APP_VIEW_MODE",
defaultValue: "admin",
},
];
10 changes: 5 additions & 5 deletions client/packages/lowcoder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ debug(`REACT_APP_ENV:, ${REACT_APP_ENV}`);
debug(`REACT_APP_LOG_LEVEL:, ${REACT_APP_LOG_LEVEL}`);
initTranslatorDesign().then(() => {
initTranslator().then(async () => {
if (!window.location.href.includes("view")) {
const bootstrap = await import("./bootstrap/admin/app").then(module => module.bootstrap);
bootstrap();
let bootstrap;
if (REACT_APP_VIEW_MODE === "view") {
bootstrap = await import("./bootstrap/view/app").then(module => module.bootstrap);
} else {
const bootstrap = await import("./bootstrap/view/app").then(module => module.bootstrap);
bootstrap();
bootstrap = await import("./bootstrap/admin/app").then(module => module.bootstrap);
}
bootstrap();
})
})
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/util/editor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const viewMode = () => window.location.href.includes("edit") ? "edit" : window.location.href.includes("view") ? "view" : "admin"
export const viewMode = () => REACT_APP_VIEW_MODE;
export const viewModeTriple = () => viewMode() === "view" ? "view" : window.location.href.includes("edit") ? "edit" : "admin";
export const getLanguage = (): string => {
return localStorage.getItem('lowcoder_uiLanguage') || 'en';
}

0 comments on commit a21cb55

Please sign in to comment.