From dcebd53902a9684af30a90e5c8478c663fbb7303 Mon Sep 17 00:00:00 2001 From: shadowusr <58862284+shadowusr@users.noreply.github.com> Date: Thu, 17 Oct 2024 02:43:44 +0300 Subject: [PATCH] feat: implement a button to switch between new and old UI (#609) * feat: implement a button to switch between new and old UI * fix: get rid of unnecessary invisible space * fix: disable settings button while loading * feat: add notification on how to switch back to old UI --- lib/constants/local-storage.ts | 8 ++ .../controls/browser-list/index.jsx | 5 +- lib/static/components/controls/controls.less | 101 ++++++++++++++++++ .../components/controls/report-info.jsx | 63 ++++++----- lib/static/hooks/useLocalStorage.js | 5 + lib/static/new-ui.css | 5 +- lib/static/new-ui/app/App.tsx | 6 +- .../components/AttemptPicker/index.module.css | 2 +- .../components/LoadingBar/index.module.css | 2 +- .../new-ui/components/MainLayout/Footer.tsx | 67 ++++++++++++ .../components/MainLayout/index.module.css | 13 +++ .../new-ui/components/MainLayout/index.tsx | 23 +++- .../components/SettingsPanel/index.module.css | 32 ++++++ .../new-ui/components/SettingsPanel/index.tsx | 56 ++++++++++ .../new-ui/components/SplitViewLayout.tsx | 2 + .../components/SuiteTitle/index.module.css | 6 -- .../new-ui/components/SuiteTitle/index.tsx | 1 - .../UiModeHintNotification/index.module.css | 91 ++++++++++++++++ .../UiModeHintNotification/index.tsx | 26 +++++ .../ScreenshotsTreeViewItem/index.module.css | 2 +- .../VisualChecksPage/index.module.css | 2 +- lib/static/template.html | 12 +++ 22 files changed, 486 insertions(+), 44 deletions(-) create mode 100644 lib/constants/local-storage.ts create mode 100644 lib/static/new-ui/components/MainLayout/Footer.tsx create mode 100644 lib/static/new-ui/components/SettingsPanel/index.module.css create mode 100644 lib/static/new-ui/components/SettingsPanel/index.tsx create mode 100644 lib/static/new-ui/components/UiModeHintNotification/index.module.css create mode 100644 lib/static/new-ui/components/UiModeHintNotification/index.tsx diff --git a/lib/constants/local-storage.ts b/lib/constants/local-storage.ts new file mode 100644 index 000000000..dd3d81081 --- /dev/null +++ b/lib/constants/local-storage.ts @@ -0,0 +1,8 @@ +export enum LocalStorageKey { + UIMode = 'ui-mode' +} + +export enum UiMode { + Old = 'old', + New = 'new', +} diff --git a/lib/static/components/controls/browser-list/index.jsx b/lib/static/components/controls/browser-list/index.jsx index 8b9361608..36023d59b 100644 --- a/lib/static/components/controls/browser-list/index.jsx +++ b/lib/static/components/controls/browser-list/index.jsx @@ -1,5 +1,7 @@ 'use strict'; +import {Button, Select, useSelectOptions} from '@gravity-ui/uikit'; +import classNames from 'classnames'; import React, {useState, useMemo, useEffect} from 'react'; import {compact} from 'lodash'; import PropTypes from 'prop-types'; @@ -8,7 +10,6 @@ import {mkBrowserIcon, buildComplexId} from './utils'; import 'react-checkbox-tree/lib/react-checkbox-tree.css'; import './index.styl'; -import {Button, Select, useSelectOptions} from '@gravity-ui/uikit'; const BrowserList = ({available, onChange, selected: selectedProp}) => { const getOptions = () => { @@ -138,7 +139,7 @@ const BrowserList = ({available, onChange, selected: selectedProp}) => {