PromucFlow_constructor/app/client/src/constants/AppConstants.ts
Hetu Nandu c6d0860019
chore: Add Sidebar with Pages Tab (#27965)
## Description
Adds the sidebar with just the pages tab for now. This is just a visual
change, with no way to switch to any other state on the app sidebar.
This change is behind a feature flag.


#### PR fixes following issue(s)
Fixes #27936

#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### 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
- [ ] 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
- [ ] 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:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
2023-10-12 15:02:16 +05:30

137 lines
4.0 KiB
TypeScript

import localStorage from "utils/localStorage";
import { GridDefaults } from "./WidgetConstants";
export const CANVAS_DEFAULT_HEIGHT_PX = 1292;
export const CANVAS_DEFAULT_MIN_HEIGHT_PX = 380;
export const CANVAS_DEFAULT_GRID_HEIGHT_PX = 1;
export const CANVAS_DEFAULT_GRID_WIDTH_PX = 1;
export const CANVAS_DEFAULT_MIN_ROWS = Math.ceil(
CANVAS_DEFAULT_MIN_HEIGHT_PX / GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
);
export const CANVAS_BACKGROUND_COLOR = "#FFFFFF";
export const DEFAULT_ENTITY_EXPLORER_WIDTH = 256;
export const DEFAULT_PROPERTY_PANE_WIDTH = 288;
export const APP_SETTINGS_PANE_WIDTH = 525;
const APP_STORE_NAMESPACE = "APPSMITH_LOCAL_STORE";
export const getAppStoreName = (appId: string, branch?: string) =>
branch
? `${APP_STORE_NAMESPACE}-${appId}-${branch}`
: `${APP_STORE_NAMESPACE}-${appId}`;
export const getPersistentAppStore = (appId: string, branch?: string) => {
const appStoreName = getAppStoreName(appId, branch);
let storeString = "{}";
// Check if localStorage exists
if (localStorage.isSupported()) {
const appStore = localStorage.getItem(appStoreName);
if (appStore) storeString = appStore;
}
let store;
try {
store = JSON.parse(storeString);
} catch (e) {
store = {};
}
return store;
};
export const TOOLTIP_HOVER_ON_DELAY = 1000;
export const TOOLTIP_HOVER_ON_DELAY_IN_S = 1;
export const MOBILE_MAX_WIDTH = 767;
export const TABLET_MIN_WIDTH = 768;
export const TABLET_MAX_WIDTH = 991;
export const DESKTOP_MIN_WIDTH = 992;
export const NAVIGATION_SETTINGS = {
ORIENTATION: {
TOP: "top",
SIDE: "side",
},
NAV_STYLE: {
STACKED: "stacked",
INLINE: "inline",
SIDEBAR: "sidebar",
MINIMAL: "minimal",
},
POSITION: {
STATIC: "static",
STICKY: "sticky",
},
ITEM_STYLE: {
TEXT_ICON: "textIcon",
TEXT: "text",
ICON: "icon",
},
COLOR_STYLE: {
LIGHT: "light",
THEME: "theme",
},
LOGO_ASSET_ID: "",
LOGO_CONFIGURATION: {
LOGO_AND_APPLICATION_TITLE: "logoAndApplicationTitle",
LOGO_ONLY: "logoOnly",
APPLICATION_TITLE_ONLY: "applicationTitleOnly",
NO_LOGO_OR_APPLICATION_TITLE: "noLogoOrApplicationTitle",
},
};
export interface NavigationSetting {
showNavbar: boolean;
showSignIn: boolean;
orientation: (typeof NAVIGATION_SETTINGS.ORIENTATION)[keyof typeof NAVIGATION_SETTINGS.ORIENTATION];
navStyle: (typeof NAVIGATION_SETTINGS.NAV_STYLE)[keyof typeof NAVIGATION_SETTINGS.NAV_STYLE];
position: (typeof NAVIGATION_SETTINGS.POSITION)[keyof typeof NAVIGATION_SETTINGS.POSITION];
itemStyle: (typeof NAVIGATION_SETTINGS.ITEM_STYLE)[keyof typeof NAVIGATION_SETTINGS.ITEM_STYLE];
colorStyle: (typeof NAVIGATION_SETTINGS.COLOR_STYLE)[keyof typeof NAVIGATION_SETTINGS.COLOR_STYLE];
logoAssetId: string;
logoConfiguration: (typeof NAVIGATION_SETTINGS.LOGO_CONFIGURATION)[keyof typeof NAVIGATION_SETTINGS.LOGO_CONFIGURATION];
}
export type StringsFromNavigationSetting = Omit<
NavigationSetting,
"showNavbar" | "showSignIn"
>;
export const keysOfNavigationSetting = {
showNavbar: "showNavbar",
showSignIn: "showSignIn",
orientation: "orientation",
navStyle: "navStyle",
position: "position",
itemStyle: "itemStyle",
colorStyle: "colorStyle",
logoAssetId: "logoAssetId",
logoConfiguration: "logoConfiguration",
};
export const defaultNavigationSetting = {
showNavbar: true,
showSignIn: true,
orientation: NAVIGATION_SETTINGS.ORIENTATION.TOP,
navStyle: NAVIGATION_SETTINGS.NAV_STYLE.STACKED,
position: NAVIGATION_SETTINGS.POSITION.STATIC,
itemStyle: NAVIGATION_SETTINGS.ITEM_STYLE.TEXT,
colorStyle: NAVIGATION_SETTINGS.COLOR_STYLE.LIGHT,
logoAssetId: NAVIGATION_SETTINGS.LOGO_ASSET_ID,
logoConfiguration:
NAVIGATION_SETTINGS.LOGO_CONFIGURATION.LOGO_AND_APPLICATION_TITLE,
};
export const SIDEBAR_WIDTH = {
REGULAR: 270,
MINIMAL: 66,
};
export const APP_SIDEBAR_WIDTH = 50;
export const APPLICATION_TITLE_MAX_WIDTH = 192;
export const APPLICATION_TITLE_MAX_WIDTH_MOBILE = 150;
//all values are in milliseconds
export const REQUEST_IDLE_CALLBACK_TIMEOUT = {
highPriority: 1500,
lowPriority: 3000,
};