2021-02-16 06:17:23 +00:00
|
|
|
import localStorage from "utils/localStorage";
|
2022-08-19 10:10:36 +00:00
|
|
|
import { GridDefaults } from "./WidgetConstants";
|
2021-02-16 06:17:23 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export const CANVAS_DEFAULT_HEIGHT_PX = 1292;
|
2022-07-15 10:27:13 +00:00
|
|
|
export const CANVAS_DEFAULT_MIN_HEIGHT_PX = 380;
|
2020-01-16 11:46:21 +00:00
|
|
|
export const CANVAS_DEFAULT_GRID_HEIGHT_PX = 1;
|
|
|
|
|
export const CANVAS_DEFAULT_GRID_WIDTH_PX = 1;
|
2022-08-19 10:10:36 +00:00
|
|
|
export const CANVAS_DEFAULT_MIN_ROWS = Math.ceil(
|
|
|
|
|
CANVAS_DEFAULT_MIN_HEIGHT_PX / GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
|
|
|
|
|
);
|
2020-01-16 11:46:21 +00:00
|
|
|
export const CANVAS_BACKGROUND_COLOR = "#FFFFFF";
|
2021-11-23 08:01:46 +00:00
|
|
|
export const DEFAULT_ENTITY_EXPLORER_WIDTH = 256;
|
2022-12-02 05:49:51 +00:00
|
|
|
export const DEFAULT_PROPERTY_PANE_WIDTH = 288;
|
|
|
|
|
export const APP_SETTINGS_PANE_WIDTH = 525;
|
2020-08-20 15:17:20 +00:00
|
|
|
|
2020-08-24 12:09:17 +00:00
|
|
|
const APP_STORE_NAMESPACE = "APPSMITH_LOCAL_STORE";
|
|
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
export const getAppStoreName = (appId: string, branch?: string) =>
|
|
|
|
|
branch
|
|
|
|
|
? `${APP_STORE_NAMESPACE}-${appId}-${branch}`
|
|
|
|
|
: `${APP_STORE_NAMESPACE}-${appId}`;
|
2020-11-04 11:40:59 +00:00
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
export const getPersistentAppStore = (appId: string, branch?: string) => {
|
|
|
|
|
const appStoreName = getAppStoreName(appId, branch);
|
2020-11-04 11:40:59 +00:00
|
|
|
let storeString = "{}";
|
|
|
|
|
// Check if localStorage exists
|
2021-02-16 06:17:23 +00:00
|
|
|
if (localStorage.isSupported()) {
|
2020-11-04 11:40:59 +00:00
|
|
|
const appStore = localStorage.getItem(appStoreName);
|
|
|
|
|
if (appStore) storeString = appStore;
|
|
|
|
|
}
|
|
|
|
|
let store;
|
|
|
|
|
try {
|
|
|
|
|
store = JSON.parse(storeString);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
store = {};
|
|
|
|
|
}
|
|
|
|
|
return store;
|
|
|
|
|
};
|
2021-10-08 07:05:34 +00:00
|
|
|
|
|
|
|
|
export const TOOLTIP_HOVER_ON_DELAY = 1000;
|
2023-05-19 18:37:06 +00:00
|
|
|
export const TOOLTIP_HOVER_ON_DELAY_IN_S = 1;
|
2022-02-17 16:38:36 +00:00
|
|
|
|
|
|
|
|
export const MOBILE_MAX_WIDTH = 767;
|
|
|
|
|
export const TABLET_MIN_WIDTH = 768;
|
|
|
|
|
export const TABLET_MAX_WIDTH = 991;
|
|
|
|
|
export const DESKTOP_MIN_WIDTH = 992;
|
2023-02-08 11:23:39 +00:00
|
|
|
|
2023-03-23 11:41:58 +00:00
|
|
|
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",
|
|
|
|
|
},
|
2023-05-05 06:49:20 +00:00
|
|
|
LOGO_ASSET_ID: "",
|
2023-03-23 11:41:58 +00:00
|
|
|
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];
|
2023-05-05 06:49:20 +00:00
|
|
|
logoAssetId: string;
|
2023-03-23 11:41:58 +00:00
|
|
|
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",
|
2023-05-05 06:49:20 +00:00
|
|
|
logoAssetId: "logoAssetId",
|
2023-03-23 11:41:58 +00:00
|
|
|
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,
|
2023-05-05 06:49:20 +00:00
|
|
|
logoAssetId: NAVIGATION_SETTINGS.LOGO_ASSET_ID,
|
2023-03-23 11:41:58 +00:00
|
|
|
logoConfiguration:
|
|
|
|
|
NAVIGATION_SETTINGS.LOGO_CONFIGURATION.LOGO_AND_APPLICATION_TITLE,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const SIDEBAR_WIDTH = {
|
|
|
|
|
REGULAR: 270,
|
|
|
|
|
MINIMAL: 66,
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-05 06:49:20 +00:00
|
|
|
export const APPLICATION_TITLE_MAX_WIDTH = 192;
|
2023-03-23 11:41:58 +00:00
|
|
|
export const APPLICATION_TITLE_MAX_WIDTH_MOBILE = 150;
|
2023-02-08 11:23:39 +00:00
|
|
|
//all values are in milliseconds
|
|
|
|
|
export const REQUEST_IDLE_CALLBACK_TIMEOUT = {
|
|
|
|
|
highPriority: 1500,
|
|
|
|
|
lowPriority: 3000,
|
|
|
|
|
};
|