From 8c743537940ac41cc7b6fa27d6f838a8c0c20e7e Mon Sep 17 00:00:00 2001 From: Sevo Kukol Date: Tue, 12 Sep 2023 14:46:04 +0200 Subject: [PATCH] Fix code formatting issues --- src/Common/StyleConstants.ts | 6 +- src/Explorer/Explorer.tsx | 9 +- .../CommandBar/CommandBarComponentAdapter.tsx | 23 +- .../CommandBarComponentButtonFactory.tsx | 11 +- .../Menus/CommandBar/CommandBarUtil.tsx | 3 +- src/Main.tsx | 11 +- src/Platform/Fabric/FabricPlatform.tsx | 6 +- src/Platform/Fabric/FabricTheme.tsx | 410 +++++++++--------- src/Utils/WindowUtils.ts | 3 +- 9 files changed, 247 insertions(+), 235 deletions(-) diff --git a/src/Common/StyleConstants.ts b/src/Common/StyleConstants.ts index 1fea4cf8e..bbb28da2d 100644 --- a/src/Common/StyleConstants.ts +++ b/src/Common/StyleConstants.ts @@ -1,9 +1,9 @@ import { Platform, configContext } from "../ConfigContext"; -export let StyleConstants = require("less-vars-loader!../../less/Common/Constants.less"); +export const StyleConstants = require("less-vars-loader!../../less/Common/Constants.less"); export function updateStyles(): void { - if (configContext.platform == Platform.Fabric) { + if (configContext.platform === Platform.Fabric) { StyleConstants.AccentMediumHigh = StyleConstants.FabricAccentMediumHigh; StyleConstants.AccentMedium = StyleConstants.FabricAccentMedium; StyleConstants.AccentLight = StyleConstants.FabricAccentLight; @@ -14,4 +14,4 @@ export function updateStyles(): void { StyleConstants.AccentLight = StyleConstants.PortalAccentLight; StyleConstants.AccentAccentExtra = StyleConstants.PortalAccentMediumHigh; } -} \ No newline at end of file +} diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index db10c6602..9832df961 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -1321,10 +1321,11 @@ export default class Explorer { await useNotebook.getState().refreshNotebooksEnabledStateForAccount(); // TODO: remove reference to isNotebookEnabled and isNotebooksEnabledForAccount - const isNotebookEnabled = configContext.platform != Platform.Fabric && ( - userContext.features.notebooksDownBanner || - useNotebook.getState().isPhoenixNotebooks || - useNotebook.getState().isPhoenixFeatures); + const isNotebookEnabled = + configContext.platform !== Platform.Fabric && + (userContext.features.notebooksDownBanner || + useNotebook.getState().isPhoenixNotebooks || + useNotebook.getState().isPhoenixFeatures); useNotebook.getState().setIsNotebookEnabled(isNotebookEnabled); useNotebook .getState() diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx index a5f1d0b7d..bbff92155 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentAdapter.tsx @@ -83,16 +83,19 @@ export const CommandBar: React.FC = ({ container }: Props) => { ); } - const rootStyle = configContext.platform == Platform.Fabric ? { - root: { - backgroundColor: "transparent", - padding: "0px 14px 0px 14px" - } - } : { - root: { - backgroundColor: backgroundColor, - } - } + const rootStyle = + configContext.platform == Platform.Fabric + ? { + root: { + backgroundColor: "transparent", + padding: "0px 14px 0px 14px", + }, + } + : { + root: { + backgroundColor: backgroundColor, + }, + }; return (
diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index 8e7e13e35..d05efe4a7 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -54,7 +54,12 @@ export function createStaticCommandBarButtons( const buttons: CommandButtonComponentProps[] = []; buttons.push(newCollectionBtn); - if (userContext.apiType !== "Tables" && userContext.apiType !== "Cassandra" && configContext.platform != Platform.Fabric) { + if ( + configContext.platform !== Platform.Fabric && + userContext.apiType !== "Tables" && + userContext.apiType !== "Cassandra" + + ) { const addSynapseLink = createOpenSynapseLinkDialogButton(container); if (addSynapseLink) { @@ -257,7 +262,9 @@ export function createDivider(): CommandButtonComponentProps { } function areScriptsSupported(): boolean { - return configContext.platform != Platform.Fabric && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin"); + return ( + configContext.platform !== Platform.Fabric && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") + ); } function createNewCollectionGroup(container: Explorer): CommandButtonComponentProps { diff --git a/src/Explorer/Menus/CommandBar/CommandBarUtil.tsx b/src/Explorer/Menus/CommandBar/CommandBarUtil.tsx index 00bd8be02..fb5260201 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarUtil.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarUtil.tsx @@ -26,7 +26,8 @@ import { MemoryTracker } from "./MemoryTrackerComponent"; export const convertButton = (btns: CommandButtonComponentProps[], backgroundColor: string): ICommandBarItemProps[] => { const buttonHeightPx = StyleConstants.CommandBarButtonHeight; - const hoverColor = configContext.platform == Platform.Fabric ? StyleConstants.FabricAccentLight : StyleConstants.AccentLight; + const hoverColor = + configContext.platform == Platform.Fabric ? StyleConstants.FabricAccentLight : StyleConstants.AccentLight; const getFilter = (isDisabled: boolean): string => { if (isDisabled) { diff --git a/src/Main.tsx b/src/Main.tsx index e13ae9736..6ab1674eb 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -144,14 +144,15 @@ const App: React.FunctionComponent = () => { ReactDOM.render(, document.body); function LoadFabricOverrides(): JSX.Element { - - if (configContext.platform == Platform.Fabric) { + if (configContext.platform === Platform.Fabric) { const FabricStyle = React.lazy(() => import("./Platform/Fabric/FabricPlatform")); return ( -
}> - ) + }> + + + ); } else { - return (<>); + return <>; } } diff --git a/src/Platform/Fabric/FabricPlatform.tsx b/src/Platform/Fabric/FabricPlatform.tsx index d69557ecd..3c4e2cc91 100644 --- a/src/Platform/Fabric/FabricPlatform.tsx +++ b/src/Platform/Fabric/FabricPlatform.tsx @@ -1,7 +1,5 @@ import React from "react"; import "../../../less/documentDBFabric.less"; export default function InitFabric() { - return ( - <> - ); -} \ No newline at end of file + return <>; +} diff --git a/src/Platform/Fabric/FabricTheme.tsx b/src/Platform/Fabric/FabricTheme.tsx index 5cb29441f..5288d91c4 100644 --- a/src/Platform/Fabric/FabricTheme.tsx +++ b/src/Platform/Fabric/FabricTheme.tsx @@ -1,208 +1,208 @@ import { Theme, createTheme } from "@fluentui/react"; export const appThemeFabric: Theme = createTheme({ - palette: { - /** - * Color code for themeDarker. - */ - themeDarker: "#033f38", - /** - * Color code for themeDark. - */ - themeDark: "#0a5c50", - /** - * Color code for themeDarkAlt. - */ - themeDarkAlt: "#0c695a", - /** - * Color code for themePrimary. - */ - themePrimary: "#117865", - /** - * Color code for themeSecondary. - */ - themeSecondary: "#1f937e", - /** - * Color code for themeTertiary. - */ - themeTertiary: "#52c7aa", - /** - * Color code for themeLight. - */ - themeLight: "#9ee0cb", - /** - * Color code for themeLighter. - */ - themeLighter: "#c0ecdd", - /** - * Color code for themeLighterAlt. - */ - themeLighterAlt: "#e3f7ef", - /** - * Color code for the strongest color, which is black in the default theme. - * This is a very light color in inverted themes. - */ - black: "#000000", - /** - * Color code for blackTranslucent40. - */ - blackTranslucent40: "rgba(0, 0, 0, 0.4)", - /** - * Color code for neutralDark. - */ - neutralDark: "#141414", - /** - * Color code for neutralPrimary. - */ - neutralPrimary: "#242424", - /** - * Color code for neutralPrimaryAlt. - */ - neutralPrimaryAlt: "#383838", - /** - * Color code for neutralSecondary. - */ - neutralSecondary: "#5c5c5c", - /** - * Color code for neutralSecondaryAlt. - */ - neutralSecondaryAlt: "#858585", - /** - * Color code for neutralTertiary. - */ - neutralTertiary: "#9e9e9e", - /** - * Color code for neutralTertiaryAlt. - */ - neutralTertiaryAlt: "#c7c7c7", - /** - * Color code for neutralQuaternary. - */ - neutralQuaternary: "#d1d1d1", - /** - * Color code for neutralQuaternaryAlt. - */ - neutralQuaternaryAlt: "#e0e0e0", - /** - * Color code for neutralLight. - */ - neutralLight: "#ebebeb", - /** - * Color code for neutralLighter. - */ - neutralLighter: "#f5f5f5", - /** - * Color code for neutralLighterAlt. - */ - neutralLighterAlt: "#fafafa", - /** - * Color code for the accent. - */ - accent: "#117865", - /** - * Color code for the softest color, which is white in the default theme. This is a very dark color in dark themes. - * This is the page background. - */ - white: "#ffffff", - /** - * Color code for whiteTranslucent40 - */ - whiteTranslucent40: "rgba(255, 255, 255, 0.4)", - /** - * Color code for yellowDark. - */ - yellowDark: "#d39300", - /** - * Color code for yellow. - */ - yellow: "#fde300", - /** - * Color code for yellowLight. - */ - yellowLight: "#fef7b2", - /** - * Color code for orange. - */ - orange: "#f7630c", - /** - * Color code for orangeLight. - */ - orangeLight: "#f98845", - /** - * Color code for orangeLighter. - */ - orangeLighter: "#fdcfb4", - /** - * Color code for redDark. - */ - redDark: "#750b1c", - /** - * Color code for red. - */ - red: "#d13438", - /** - * Color code for magentaDark. - */ - magentaDark: "#6b0043", - /** - * Color code for magenta. - */ - magenta: "#bf0077", - /** - * Color code for magentaLight. - */ - magentaLight: "#d957a8", - /** - * Color code for purpleDark. - */ - purpleDark: "#401b6c", - /** - * Color code for purple. - */ - purple: "#5c2e91", - /** - * Color code for purpleLight. - */ - purpleLight: "#c6b1de", - /** - * Color code for blueDark. - */ - blueDark: "#003966", - /** - * Color code for blueMid. - */ - blueMid: "#004e8c", - /** - * Color code for blue. - */ - blue: "#0078d4", - /** - * Color code for blueLight. - */ - blueLight: "#3a96dd", - /** - * Color code for tealDark. - */ - tealDark: "#006666", - /** - * Color code for teal. - */ - teal: "#038387", - /** - * Color code for tealLight. - */ - tealLight: "#00b7c3", - /** - * Color code for greenDark. - */ - greenDark: "#0b6a0b", - /** - * Color code for green. - */ - green: "#107c10", - /** - * Color code for greenLight. - */ - greenLight: "#13a10e", - } -}); \ No newline at end of file + palette: { + /** + * Color code for themeDarker. + */ + themeDarker: "#033f38", + /** + * Color code for themeDark. + */ + themeDark: "#0a5c50", + /** + * Color code for themeDarkAlt. + */ + themeDarkAlt: "#0c695a", + /** + * Color code for themePrimary. + */ + themePrimary: "#117865", + /** + * Color code for themeSecondary. + */ + themeSecondary: "#1f937e", + /** + * Color code for themeTertiary. + */ + themeTertiary: "#52c7aa", + /** + * Color code for themeLight. + */ + themeLight: "#9ee0cb", + /** + * Color code for themeLighter. + */ + themeLighter: "#c0ecdd", + /** + * Color code for themeLighterAlt. + */ + themeLighterAlt: "#e3f7ef", + /** + * Color code for the strongest color, which is black in the default theme. + * This is a very light color in inverted themes. + */ + black: "#000000", + /** + * Color code for blackTranslucent40. + */ + blackTranslucent40: "rgba(0, 0, 0, 0.4)", + /** + * Color code for neutralDark. + */ + neutralDark: "#141414", + /** + * Color code for neutralPrimary. + */ + neutralPrimary: "#242424", + /** + * Color code for neutralPrimaryAlt. + */ + neutralPrimaryAlt: "#383838", + /** + * Color code for neutralSecondary. + */ + neutralSecondary: "#5c5c5c", + /** + * Color code for neutralSecondaryAlt. + */ + neutralSecondaryAlt: "#858585", + /** + * Color code for neutralTertiary. + */ + neutralTertiary: "#9e9e9e", + /** + * Color code for neutralTertiaryAlt. + */ + neutralTertiaryAlt: "#c7c7c7", + /** + * Color code for neutralQuaternary. + */ + neutralQuaternary: "#d1d1d1", + /** + * Color code for neutralQuaternaryAlt. + */ + neutralQuaternaryAlt: "#e0e0e0", + /** + * Color code for neutralLight. + */ + neutralLight: "#ebebeb", + /** + * Color code for neutralLighter. + */ + neutralLighter: "#f5f5f5", + /** + * Color code for neutralLighterAlt. + */ + neutralLighterAlt: "#fafafa", + /** + * Color code for the accent. + */ + accent: "#117865", + /** + * Color code for the softest color, which is white in the default theme. This is a very dark color in dark themes. + * This is the page background. + */ + white: "#ffffff", + /** + * Color code for whiteTranslucent40 + */ + whiteTranslucent40: "rgba(255, 255, 255, 0.4)", + /** + * Color code for yellowDark. + */ + yellowDark: "#d39300", + /** + * Color code for yellow. + */ + yellow: "#fde300", + /** + * Color code for yellowLight. + */ + yellowLight: "#fef7b2", + /** + * Color code for orange. + */ + orange: "#f7630c", + /** + * Color code for orangeLight. + */ + orangeLight: "#f98845", + /** + * Color code for orangeLighter. + */ + orangeLighter: "#fdcfb4", + /** + * Color code for redDark. + */ + redDark: "#750b1c", + /** + * Color code for red. + */ + red: "#d13438", + /** + * Color code for magentaDark. + */ + magentaDark: "#6b0043", + /** + * Color code for magenta. + */ + magenta: "#bf0077", + /** + * Color code for magentaLight. + */ + magentaLight: "#d957a8", + /** + * Color code for purpleDark. + */ + purpleDark: "#401b6c", + /** + * Color code for purple. + */ + purple: "#5c2e91", + /** + * Color code for purpleLight. + */ + purpleLight: "#c6b1de", + /** + * Color code for blueDark. + */ + blueDark: "#003966", + /** + * Color code for blueMid. + */ + blueMid: "#004e8c", + /** + * Color code for blue. + */ + blue: "#0078d4", + /** + * Color code for blueLight. + */ + blueLight: "#3a96dd", + /** + * Color code for tealDark. + */ + tealDark: "#006666", + /** + * Color code for teal. + */ + teal: "#038387", + /** + * Color code for tealLight. + */ + tealLight: "#00b7c3", + /** + * Color code for greenDark. + */ + greenDark: "#0b6a0b", + /** + * Color code for green. + */ + green: "#107c10", + /** + * Color code for greenLight. + */ + greenLight: "#13a10e", + }, +}); diff --git a/src/Utils/WindowUtils.ts b/src/Utils/WindowUtils.ts index f426572b2..2409d9f62 100644 --- a/src/Utils/WindowUtils.ts +++ b/src/Utils/WindowUtils.ts @@ -5,7 +5,8 @@ export const getDataExplorerWindow = (currentWindow: Window): Window | undefined if (currentWindow.parent === currentWindow) { return undefined; } - if (currentWindow.parent.parent === currentWindow.top) { // Fabric + if (currentWindow.parent.parent === currentWindow.top) { + // Fabric return currentWindow; } if (currentWindow.parent === currentWindow.top) {