2023-07-10 05:51:40 +00:00
|
|
|
import React, { useEffect } from "react";
|
2021-06-17 07:37:27 +00:00
|
|
|
import styled, { ThemeProvider } from "styled-components";
|
2022-05-04 09:45:57 +00:00
|
|
|
import { useDispatch } from "react-redux";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { RouteComponentProps } from "react-router";
|
|
|
|
|
import { withRouter } from "react-router";
|
|
|
|
|
import type { AppState } from "@appsmith/reducers";
|
|
|
|
|
import type {
|
2019-11-22 14:02:55 +00:00
|
|
|
AppViewerRouteParams,
|
2020-02-18 10:41:52 +00:00
|
|
|
BuilderRouteParams,
|
2019-11-22 14:02:55 +00:00
|
|
|
} from "constants/routes";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import { GIT_BRANCH_QUERY_KEY } from "constants/routes";
|
2021-02-04 07:02:36 +00:00
|
|
|
import {
|
2022-05-04 09:45:57 +00:00
|
|
|
getIsInitialized,
|
|
|
|
|
getAppViewHeaderHeight,
|
|
|
|
|
} from "selectors/appViewSelectors";
|
2023-02-14 16:07:31 +00:00
|
|
|
import EditorContextProvider from "components/editorComponents/EditorContextProvider";
|
2019-11-22 14:02:55 +00:00
|
|
|
import AppViewerPageContainer from "./AppViewerPageContainer";
|
2020-08-28 17:23:07 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
2023-05-15 12:44:04 +00:00
|
|
|
import {
|
|
|
|
|
getCurrentPageDescription,
|
|
|
|
|
getViewModePageList,
|
|
|
|
|
} from "selectors/editorSelectors";
|
2021-06-17 07:37:27 +00:00
|
|
|
import { getThemeDetails, ThemeMode } from "selectors/themeSelectors";
|
2021-10-18 14:03:44 +00:00
|
|
|
import { getSearchQuery } from "utils/helpers";
|
2022-05-04 09:45:57 +00:00
|
|
|
import { getSelectedAppTheme } from "selectors/appThemingSelectors";
|
|
|
|
|
import { useSelector } from "react-redux";
|
2022-06-08 09:41:53 +00:00
|
|
|
import BrandingBadge from "./BrandingBadge";
|
2022-05-04 09:45:57 +00:00
|
|
|
import { setAppViewHeaderHeight } from "actions/appViewActions";
|
2022-01-25 13:56:52 +00:00
|
|
|
import { showPostCompletionMessage } from "selectors/onboardingSelectors";
|
2022-06-08 10:17:49 +00:00
|
|
|
import { CANVAS_SELECTOR } from "constants/WidgetConstants";
|
2022-06-10 18:22:59 +00:00
|
|
|
import { fetchPublishedPage } from "actions/pageActions";
|
|
|
|
|
import usePrevious from "utils/hooks/usePrevious";
|
|
|
|
|
import { getIsBranchUpdated } from "../utils";
|
|
|
|
|
import { APP_MODE } from "entities/App";
|
|
|
|
|
import { initAppViewer } from "actions/initActions";
|
2022-07-29 04:59:02 +00:00
|
|
|
import { WidgetGlobaStyles } from "globalStyles/WidgetGlobalStyles";
|
2022-12-30 14:52:11 +00:00
|
|
|
import useWidgetFocus from "utils/hooks/useWidgetFocus/useWidgetFocus";
|
2023-05-15 12:44:04 +00:00
|
|
|
import HtmlTitle from "./AppViewerHtmlTitle";
|
2023-07-26 12:40:44 +00:00
|
|
|
import BottomBar from "components/BottomBar";
|
2023-05-15 12:44:04 +00:00
|
|
|
import type { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants";
|
|
|
|
|
import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors";
|
2023-07-10 05:51:40 +00:00
|
|
|
import { editorInitializer } from "../../utils/editor/EditorUtils";
|
|
|
|
|
import { widgetInitialisationSuccess } from "../../actions/widgetActions";
|
2023-07-21 05:53:17 +00:00
|
|
|
import { areEnvironmentsFetched } from "@appsmith/selectors/environmentSelectors";
|
2023-09-15 17:00:10 +00:00
|
|
|
import type { FontFamily } from "@design-system/theming";
|
2023-07-26 12:40:44 +00:00
|
|
|
import {
|
|
|
|
|
ThemeProvider as WDSThemeProvider,
|
|
|
|
|
useTheme,
|
|
|
|
|
} from "@design-system/theming";
|
|
|
|
|
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
2023-08-05 07:59:47 +00:00
|
|
|
import { RAMP_NAME } from "utils/ProductRamps/RampsControlList";
|
2023-08-28 15:37:32 +00:00
|
|
|
import { showProductRamps } from "@appsmith/selectors/rampSelectors";
|
2023-09-29 10:46:24 +00:00
|
|
|
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
|
2023-09-26 12:00:15 +00:00
|
|
|
import { KBViewerFloatingButton } from "@appsmith/pages/AppViewer/KnowledgeBase/KBViewerFloatingButton";
|
2023-10-12 05:31:22 +00:00
|
|
|
import urlBuilder from "@appsmith/entities/URLRedirect/URLAssembly";
|
2023-10-14 18:34:45 +00:00
|
|
|
import { getHideWatermark } from "@appsmith/selectors/tenantSelectors";
|
2022-11-14 04:19:25 +00:00
|
|
|
|
2022-01-25 13:56:52 +00:00
|
|
|
const AppViewerBody = styled.section<{
|
|
|
|
|
hasPages: boolean;
|
2022-05-04 09:45:57 +00:00
|
|
|
headerHeight: number;
|
2022-01-25 13:56:52 +00:00
|
|
|
showGuidedTourMessage: boolean;
|
2023-07-21 05:53:17 +00:00
|
|
|
showBottomBar: boolean;
|
2022-01-25 13:56:52 +00:00
|
|
|
}>`
|
2019-10-31 08:36:04 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
justify-content: flex-start;
|
2023-07-21 05:53:17 +00:00
|
|
|
height: calc(
|
|
|
|
|
100vh -
|
|
|
|
|
${(props) => (props.showBottomBar ? props.theme.bottomBarHeight : "0px")} -
|
|
|
|
|
${({ headerHeight }) => headerHeight}px
|
|
|
|
|
);
|
2022-07-12 15:43:26 +00:00
|
|
|
--view-mode-header-height: ${({ headerHeight }) => headerHeight}px;
|
2019-10-31 08:36:04 +00:00
|
|
|
`;
|
2019-11-01 05:28:56 +00:00
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
const AppViewerBodyContainer = styled.div<{
|
|
|
|
|
width?: string;
|
|
|
|
|
backgroundColor: string;
|
|
|
|
|
}>`
|
2021-06-17 07:37:27 +00:00
|
|
|
flex: 1;
|
2021-06-09 10:35:10 +00:00
|
|
|
overflow: auto;
|
|
|
|
|
margin: 0 auto;
|
2022-05-04 09:45:57 +00:00
|
|
|
background: ${({ backgroundColor }) => backgroundColor};
|
2021-06-09 10:35:10 +00:00
|
|
|
`;
|
|
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
export type AppViewerProps = RouteComponentProps<BuilderRouteParams>;
|
2019-10-31 08:36:04 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
type Props = AppViewerProps & RouteComponentProps<AppViewerRouteParams>;
|
|
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
const DEFAULT_FONT_NAME = "System Default";
|
|
|
|
|
|
|
|
|
|
function AppViewer(props: Props) {
|
|
|
|
|
const dispatch = useDispatch();
|
2022-06-10 18:22:59 +00:00
|
|
|
const { pathname, search } = props.location;
|
2022-05-04 09:45:57 +00:00
|
|
|
const { applicationId, pageId } = props.match.params;
|
|
|
|
|
const isInitialized = useSelector(getIsInitialized);
|
|
|
|
|
const pages = useSelector(getViewModePageList);
|
|
|
|
|
const selectedTheme = useSelector(getSelectedAppTheme);
|
|
|
|
|
const lightTheme = useSelector((state: AppState) =>
|
|
|
|
|
getThemeDetails(state, ThemeMode.LIGHT),
|
|
|
|
|
);
|
|
|
|
|
const showGuidedTourMessage = useSelector(showPostCompletionMessage);
|
|
|
|
|
const headerHeight = useSelector(getAppViewHeaderHeight);
|
2022-06-10 18:22:59 +00:00
|
|
|
const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY);
|
|
|
|
|
const prevValues = usePrevious({ branch, location: props.location, pageId });
|
2023-10-14 18:34:45 +00:00
|
|
|
const hideWatermark = useSelector(getHideWatermark);
|
2023-05-15 12:44:04 +00:00
|
|
|
const pageDescription = useSelector(getCurrentPageDescription);
|
|
|
|
|
const currentApplicationDetails: ApplicationPayload | undefined = useSelector(
|
|
|
|
|
getCurrentApplication,
|
|
|
|
|
);
|
2023-07-26 12:40:44 +00:00
|
|
|
const { theme } = useTheme({
|
|
|
|
|
borderRadius: selectedTheme.properties.borderRadius.appBorderRadius,
|
|
|
|
|
seedColor: selectedTheme.properties.colors.primaryColor,
|
2023-09-15 17:00:10 +00:00
|
|
|
fontFamily: selectedTheme.properties.fontFamily.appFont as FontFamily,
|
2023-07-26 12:40:44 +00:00
|
|
|
});
|
2022-12-30 14:52:11 +00:00
|
|
|
const focusRef = useWidgetFocus();
|
|
|
|
|
|
2023-09-05 08:23:44 +00:00
|
|
|
const showRampSelector = showProductRamps(RAMP_NAME.MULTIPLE_ENV, true);
|
2023-08-17 07:56:11 +00:00
|
|
|
const canShowRamp = useSelector(showRampSelector);
|
|
|
|
|
|
2023-07-21 05:53:17 +00:00
|
|
|
const workspaceId = currentApplicationDetails?.workspaceId || "";
|
2023-09-29 10:46:24 +00:00
|
|
|
const isMultipleEnvEnabled = useFeatureFlag(
|
|
|
|
|
FEATURE_FLAG.release_datasource_environments_enabled,
|
|
|
|
|
);
|
2023-07-21 05:53:17 +00:00
|
|
|
const showBottomBar = useSelector((state: AppState) => {
|
|
|
|
|
return (
|
2023-08-05 07:59:47 +00:00
|
|
|
areEnvironmentsFetched(state, workspaceId) &&
|
2023-09-29 10:46:24 +00:00
|
|
|
(isMultipleEnvEnabled || canShowRamp)
|
2023-07-21 05:53:17 +00:00
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* initializes the widgets factory and registers all widgets
|
|
|
|
|
*/
|
2022-05-04 09:45:57 +00:00
|
|
|
useEffect(() => {
|
2022-06-10 18:22:59 +00:00
|
|
|
editorInitializer().then(() => {
|
2023-07-10 05:51:40 +00:00
|
|
|
dispatch(widgetInitialisationSuccess());
|
2022-06-10 18:22:59 +00:00
|
|
|
});
|
2023-09-06 12:15:04 +00:00
|
|
|
}, []);
|
2022-05-04 09:45:57 +00:00
|
|
|
/**
|
|
|
|
|
* initialize the app if branch, pageId or application is changed
|
|
|
|
|
*/
|
|
|
|
|
useEffect(() => {
|
2022-06-10 18:22:59 +00:00
|
|
|
const prevBranch = prevValues?.branch;
|
|
|
|
|
const prevLocation = prevValues?.location;
|
|
|
|
|
const prevPageId = prevValues?.pageId;
|
|
|
|
|
let isBranchUpdated = false;
|
|
|
|
|
if (prevBranch && prevLocation) {
|
|
|
|
|
isBranchUpdated = getIsBranchUpdated(props.location, prevLocation);
|
2022-05-04 09:45:57 +00:00
|
|
|
}
|
2022-06-10 18:22:59 +00:00
|
|
|
|
|
|
|
|
const isPageIdUpdated = pageId !== prevPageId;
|
|
|
|
|
|
|
|
|
|
if (prevBranch && isBranchUpdated && (applicationId || pageId)) {
|
|
|
|
|
dispatch(
|
|
|
|
|
initAppViewer({
|
|
|
|
|
applicationId,
|
|
|
|
|
branch,
|
|
|
|
|
pageId,
|
|
|
|
|
mode: APP_MODE.PUBLISHED,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
/**
|
|
|
|
|
* First time load is handled by init sagas
|
|
|
|
|
* If we don't check for `prevPageId`: fetch page is retriggered
|
|
|
|
|
* when redirected to the default page
|
|
|
|
|
*/
|
|
|
|
|
if (prevPageId && pageId && isPageIdUpdated) {
|
|
|
|
|
dispatch(fetchPublishedPage(pageId, true));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, [branch, pageId, applicationId, pathname]);
|
2022-05-04 09:45:57 +00:00
|
|
|
|
2023-10-12 05:31:22 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
urlBuilder.setCurrentPageId(pageId);
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
urlBuilder.setCurrentPageId(null);
|
|
|
|
|
};
|
|
|
|
|
}, [pageId]);
|
|
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
useEffect(() => {
|
|
|
|
|
const header = document.querySelector(".js-appviewer-header");
|
|
|
|
|
|
|
|
|
|
dispatch(setAppViewHeaderHeight(header?.clientHeight || 0));
|
|
|
|
|
}, [pages.length, isInitialized]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns the font to be used for the canvas
|
|
|
|
|
*/
|
|
|
|
|
const appFontFamily =
|
|
|
|
|
selectedTheme.properties.fontFamily.appFont === DEFAULT_FONT_NAME
|
|
|
|
|
? "inherit"
|
|
|
|
|
: selectedTheme.properties.fontFamily.appFont;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* loads font for canvas based on theme
|
|
|
|
|
*/
|
|
|
|
|
useEffect(() => {
|
2023-04-13 13:18:37 +00:00
|
|
|
document.body.style.fontFamily = `${appFontFamily}, sans-serif`;
|
2022-06-16 11:16:05 +00:00
|
|
|
|
|
|
|
|
return function reset() {
|
|
|
|
|
document.body.style.fontFamily = "inherit";
|
|
|
|
|
};
|
2022-05-04 09:45:57 +00:00
|
|
|
}, [selectedTheme.properties.fontFamily.appFont]);
|
|
|
|
|
|
2023-07-26 12:40:44 +00:00
|
|
|
const isWDSV2Enabled = useFeatureFlag("ab_wds_enabled");
|
|
|
|
|
const backgroundForBody = isWDSV2Enabled
|
|
|
|
|
? "var(--color-bg)"
|
|
|
|
|
: selectedTheme.properties.colors.backgroundColor;
|
|
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
return (
|
2023-07-26 12:40:44 +00:00
|
|
|
<WDSThemeProvider theme={theme}>
|
|
|
|
|
<ThemeProvider theme={lightTheme}>
|
|
|
|
|
<EditorContextProvider renderMode="PAGE">
|
|
|
|
|
{!isWDSV2Enabled && (
|
|
|
|
|
<WidgetGlobaStyles
|
|
|
|
|
fontFamily={selectedTheme.properties.fontFamily.appFont}
|
|
|
|
|
primaryColor={selectedTheme.properties.colors.primaryColor}
|
|
|
|
|
/>
|
2022-08-03 07:02:49 +00:00
|
|
|
)}
|
2023-07-26 12:40:44 +00:00
|
|
|
<HtmlTitle
|
|
|
|
|
description={pageDescription}
|
|
|
|
|
name={currentApplicationDetails?.name}
|
|
|
|
|
/>
|
|
|
|
|
<AppViewerBodyContainer backgroundColor={backgroundForBody}>
|
|
|
|
|
<AppViewerBody
|
|
|
|
|
className={CANVAS_SELECTOR}
|
|
|
|
|
hasPages={pages.length > 1}
|
|
|
|
|
headerHeight={headerHeight}
|
|
|
|
|
ref={focusRef}
|
|
|
|
|
showBottomBar={showBottomBar}
|
|
|
|
|
showGuidedTourMessage={showGuidedTourMessage}
|
|
|
|
|
>
|
|
|
|
|
{isInitialized && <AppViewerPageContainer />}
|
|
|
|
|
</AppViewerBody>
|
|
|
|
|
{showBottomBar && <BottomBar viewMode />}
|
2023-09-26 12:00:15 +00:00
|
|
|
<div
|
|
|
|
|
className={`fixed hidden right-8 z-3 md:flex ${
|
|
|
|
|
showBottomBar ? "bottom-12" : "bottom-4"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
{!hideWatermark && (
|
|
|
|
|
<a
|
|
|
|
|
className="hover:no-underline"
|
|
|
|
|
href="https://appsmith.com"
|
|
|
|
|
rel="noreferrer"
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
<BrandingBadge />
|
|
|
|
|
</a>
|
|
|
|
|
)}
|
|
|
|
|
<KBViewerFloatingButton />
|
|
|
|
|
</div>
|
2023-07-26 12:40:44 +00:00
|
|
|
</AppViewerBodyContainer>
|
|
|
|
|
</EditorContextProvider>
|
|
|
|
|
</ThemeProvider>
|
|
|
|
|
</WDSThemeProvider>
|
2022-05-04 09:45:57 +00:00
|
|
|
);
|
2019-10-31 08:36:04 +00:00
|
|
|
}
|
|
|
|
|
|
2022-05-04 09:45:57 +00:00
|
|
|
export default withRouter(Sentry.withProfiler(AppViewer));
|