PromucFlow_constructor/app/client/src/constants/AppConstants.ts
Dhruvik Neharia 099859134d
feat: Improved App Navigation (#19312)
## TL;DR
A new revamped experience for navigation for Appsmith users.

## Description 
Introduces new navigation styles with better default navigation - Top
(Stacked), a variant for Top (Inline), and a collapsible Sidebar.
Configure your app's navigation by navigating to the navigation settings
tab inside the app settings pane and observe how your app with the
selected navigation settings will look side by side as you change them.

This PR pushes the v1 for EPIC #17766.

Fixes #19157
Fixes #19158
Fixes #19174
Fixes #19173
Fixes #19160
Fixes #20712
Fixes #19161
Fixes #20554
Fixes #20938
Fixes #21129

## Media
<video
src="https://user-images.githubusercontent.com/22471214/227187245-84e4e3fa-18e4-4690-8237-cfce29f432e5.mp4"></video>

## Type of change
- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## How Has This Been Tested?
- Manual
- Cypress

### Test Plan

https://www.notion.so/appsmith/Test-Plan-a7883ae4980d470690de5c62a41dd168

### Issues raised during DP testing

https://docs.google.com/spreadsheets/d/1Kocq8h1H3EXlbqDgiNruzBr9MeNPyY26zct8IWYEY40/edit#gid=0

## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] 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
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] 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: Pawan Kumar <pawan@appsmith.com>
2023-03-23 17:11:58 +05:30

130 lines
3.8 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 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_CONFIGURATION: {
LOGO_AND_APPLICATION_TITLE: "logoAndApplicationTitle",
LOGO_ONLY: "logoOnly",
APPLICATION_TITLE_ONLY: "applicationTitleOnly",
NO_LOGO_OR_APPLICATION_TITLE: "noLogoOrApplicationTitle",
},
};
export type 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];
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",
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,
logoConfiguration:
NAVIGATION_SETTINGS.LOGO_CONFIGURATION.LOGO_AND_APPLICATION_TITLE,
};
export const SIDEBAR_WIDTH = {
REGULAR: 270,
MINIMAL: 66,
};
export const APPLICATION_TITLE_MAX_WIDTH = 224;
export const APPLICATION_TITLE_MAX_WIDTH_MOBILE = 150;
//all values are in milliseconds
export const REQUEST_IDLE_CALLBACK_TIMEOUT = {
highPriority: 1500,
lowPriority: 3000,
};