From 46382e88250d9734a6e634fa79376334ee1fbe24 Mon Sep 17 00:00:00 2001 From: Arseny Lisin Date: Wed, 1 Feb 2023 11:45:22 +0300 Subject: [PATCH] Fix dark theme bugs Updates #5375 Squashed commit of the following: commit 40666b010697381e11b3a36d9c2ed1c1507f27ed Author: Arseny Lisin Date: Tue Jan 31 18:34:06 2023 +0200 Review fix commit 44f3d6095bc9b426e8142f8c9d915a1441f3d791 Author: Arseny Lisin Date: Tue Jan 31 17:02:38 2023 +0200 Clear commit 44274ba54c9ff2bd2caf5fa69bf06c587f8858e5 Author: Arseny Lisin Date: Tue Jan 31 13:25:01 2023 +0200 Clear commit 8b48c523cbbe3f73160331a9c516388c7965a7a2 Author: Arseny Lisin Date: Tue Jan 31 12:14:37 2023 +0200 Review fix commit 3b8cd94cdd8d3fc90cdc27053964489414055cc9 Author: Arseny Lisin Date: Mon Jan 30 16:13:15 2023 +0200 Fix query log popup bg commit 14d4c87164200f7c918bac02c9cc5f1cffb83932 Author: Arseny Lisin Date: Mon Jan 30 15:03:06 2023 +0200 revert icons commit 98b042726e1510f85c9cf5a4caba2d56885f120b Author: Arseny Lisin Date: Mon Jan 30 14:45:35 2023 +0200 Fix dark theme bugs --- client/src/components/App/index.css | 9 ++- client/src/components/Dashboard/Dashboard.css | 2 +- client/src/components/Header/Header.css | 8 +-- .../src/components/Logs/Cells/IconTooltip.css | 2 +- client/src/components/Logs/Logs.css | 37 ++++++++++ client/src/components/Logs/index.js | 4 +- .../components/Settings/Clients/Service.css | 2 +- client/src/components/ui/Dropdown.css | 2 +- client/src/components/ui/Footer.js | 55 ++++++++++----- client/src/components/ui/Line.css | 4 ++ client/src/components/ui/Line.js | 4 +- client/src/components/ui/Loading.css | 2 +- client/src/components/ui/ReactTable.css | 19 +++++- client/src/components/ui/Tabler.css | 68 +++++++++++++++++-- client/src/components/ui/Tabs.css | 6 +- client/src/install/Setup/Setup.css | 11 ++- client/src/login/Login/Login.css | 4 ++ client/src/login/Login/index.js | 2 +- 18 files changed, 200 insertions(+), 41 deletions(-) diff --git a/client/src/components/App/index.css b/client/src/components/App/index.css index 751a8e22..b20bd424 100644 --- a/client/src/components/App/index.css +++ b/client/src/components/App/index.css @@ -1,4 +1,5 @@ :root { + --black: #131313; --bgcolor: #f5f7fb; --mcolor: #495057; --scolor: rgba(74, 74, 74, 0.7); @@ -26,11 +27,13 @@ --gray-a5: #a5a5a5; --gray-d8: #d8d8d8; --gray-f3: #f3f3f3; + --loading-bg: rgba(255, 255, 255, 0.48); --font-family-monospace: Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace; --font-size-disable-autozoom: 1rem; } [data-theme="dark"] { + --black: #ffffff; --bgcolor: #131313; --mcolor: #e6e6e6; --scolor: #a5a5a5; @@ -44,16 +47,18 @@ --ctrl-dropdown-bgcolor-focus: #000; --ctrl-dropdown-color-focus: #fff; --btn-success-bgcolor: #67b279; - --form-disabled-bgcolor: #3d3d3d; + --form-disabled-bgcolor: #2d2d2d; --form-disabled-color: #a5a5a5; --logs__text-color: #f3f3f3; --rt-nodata-bgcolor: #1c1c1c; --rt-nodata-color: #fff; - --modal-overlay-bgcolor: #1c1c1c; + --modal-overlay-bgcolor: rgba(19, 19, 19, 0.75); --logs__table-bgcolor: #3d3d3d; --logs__row--blue-bgcolor: #467fcf; --logs__row--white-bgcolor: #1c1c1c; --detailed-info-color: #fff; + --gray300: #f3f3f3; + --loading-bg: #131313; } body { diff --git a/client/src/components/Dashboard/Dashboard.css b/client/src/components/Dashboard/Dashboard.css index ee36d265..415a3f6b 100644 --- a/client/src/components/Dashboard/Dashboard.css +++ b/client/src/components/Dashboard/Dashboard.css @@ -54,7 +54,7 @@ display: flex; align-items: center; justify-content: space-between; - border-top: 1px solid #dee2e6; + border-top: 1px solid var(--card-border-color); padding: 0.75rem 1.5rem; } diff --git a/client/src/components/Header/Header.css b/client/src/components/Header/Header.css index c5412f7a..93d45f3e 100644 --- a/client/src/components/Header/Header.css +++ b/client/src/components/Header/Header.css @@ -1,12 +1,12 @@ .nav-tabs .nav-link.active { - border-color: var(--green-74); - color: var(--green-74); + border-color: var(--btn-success-bgcolor); + color: var(--btn-success-bgcolor); background: transparent; } .nav-tabs .nav-link.active:hover { - border-color: #58a273; - color: #58a273; + border-color: #4b9400; + color: #4b9400; } .nav-icon { diff --git a/client/src/components/Logs/Cells/IconTooltip.css b/client/src/components/Logs/Cells/IconTooltip.css index 8f7eb453..0b55ee6a 100644 --- a/client/src/components/Logs/Cells/IconTooltip.css +++ b/client/src/components/Logs/Cells/IconTooltip.css @@ -5,7 +5,7 @@ border-radius: 4px !important; pointer-events: auto !important; background-color: var(--ctrl-bgcolor); - color: var(--scolor); + color: var(--mcolor); z-index: 102; overflow-y: auto; max-height: 100%; diff --git a/client/src/components/Logs/Logs.css b/client/src/components/Logs/Logs.css index 358c2a6a..bf0689e6 100644 --- a/client/src/components/Logs/Logs.css +++ b/client/src/components/Logs/Logs.css @@ -24,6 +24,12 @@ --option-border-radius: 4px; } +[data-theme="dark"] { + --red: rgba(223, 56, 18, 0.25); + --green-pale: rgba(103, 178, 121, 0.25); + --yellow: rgba(247, 181, 0, 0.2); +} + .logs__text { padding: 0 1px; text-overflow: ellipsis; @@ -36,6 +42,14 @@ line-height: 1.5rem; } +[data-theme="dark"] .logs__text a { + color: var(--gray-f3); +} + +[data-theme="dark"] .logs__text a:hover { + color: var(--gray-f3); +} + .logs__text--bold { font-weight: 600; } @@ -66,6 +80,10 @@ border-radius: 4px; } +[data-theme=dark] .icon--selected { + opacity: 0.75; +} + .text-pre { white-space: pre-wrap !important; overflow-wrap: break-word; @@ -205,6 +223,12 @@ position: relative; } +@media screen and (min-width: 1025px) { + .logs__cell--client { + width: 13rem; + } +} + .logs__cell--header__container > .logs__cell--header__item { border-right: 0; font-size: 1rem; @@ -340,6 +364,10 @@ overflow: hidden; } +[data-theme="dark"] .tooltip-custom__container .button-action--arrow-option:not(:disabled):hover { + background: var(--ctrl-dropdown-bgcolor-focus); +} + .button-action--arrow-option-container { overflow: visible; transform-origin: left; @@ -482,6 +510,10 @@ color: var(--green79); } +[data-theme="dark"] .logs__question.icon--lightgray { + color: var(--gray-f3); +} + @media (max-width: 1024px) { .logs__question { display: none; @@ -491,3 +523,8 @@ .logs__modal { max-width: 720px; } + +.logs__modal-wrap { + padding: 1rem 1.5rem; + background-color: var(--card-bgcolor); +} diff --git a/client/src/components/Logs/index.js b/client/src/components/Logs/index.js index b4b4c636..ac8b168b 100644 --- a/client/src/components/Logs/index.js +++ b/client/src/components/Logs/index.js @@ -195,11 +195,11 @@ const Logs = () => { onRequestClose={closeModal} style={{ content: { - width: '100%', + width: 'calc(100% - 32px)', height: 'fit-content', left: '50%', top: 47, - padding: '1rem 1.5rem 1rem', + padding: '0', maxWidth: '720px', transform: 'translateX(-50%)', }, diff --git a/client/src/components/Settings/Clients/Service.css b/client/src/components/Settings/Clients/Service.css index 153cf2d8..6cfcf40a 100644 --- a/client/src/components/Settings/Clients/Service.css +++ b/client/src/components/Settings/Clients/Service.css @@ -4,7 +4,7 @@ align-items: center; margin-bottom: 15px; padding: 10px 15px; - border: 1px solid #eee; + border: 1px solid var(--card-border-color); border-radius: 4px; cursor: pointer; } diff --git a/client/src/components/ui/Dropdown.css b/client/src/components/ui/Dropdown.css index 25efec81..860769ee 100644 --- a/client/src/components/ui/Dropdown.css +++ b/client/src/components/ui/Dropdown.css @@ -1,6 +1,6 @@ .dropdown-item.active, .dropdown-item:active { - background-color: var(--green-74); + background-color: var(--btn-success-bgcolor); } .dropdown-menu { diff --git a/client/src/components/ui/Footer.js b/client/src/components/ui/Footer.js index c1d1b40e..3ac6aa61 100644 --- a/client/src/components/ui/Footer.js +++ b/client/src/components/ui/Footer.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import classNames from 'classnames'; @@ -10,7 +10,7 @@ import i18n from '../../i18n'; import Version from './Version'; import './Footer.css'; import './Select.css'; -import { setHtmlLangAttr } from '../../helpers/helpers'; +import { setHtmlLangAttr, setUITheme } from '../../helpers/helpers'; import { changeTheme } from '../../actions'; const linksData = [ @@ -36,6 +36,13 @@ const Footer = () => { const currentTheme = useSelector((state) => (state.dashboard ? state.dashboard.theme : 'auto')); const profileName = useSelector((state) => (state.dashboard ? state.dashboard.name : '')); const isLoggedIn = profileName !== ''; + const [currentThemeLocal, setCurrentThemeLocal] = useState('auto'); + + useEffect(() => { + if (!isLoggedIn) { + setUITheme(window.matchMedia('(prefers-color-scheme: dark)').matches ? THEMES.dark : THEMES.light); + } + }, []); const getYear = () => { const today = new Date(); @@ -53,6 +60,12 @@ const Footer = () => { dispatch(changeTheme(value)); }; + const onThemeChangedLocal = (event) => { + const { value } = event.target; + setUITheme(value); + setCurrentThemeLocal(value); + }; + const renderCopyright = () =>
{t('copyright')} © {getYear()}{' '} @@ -70,24 +83,34 @@ const Footer = () => { {t(name)} ); - const renderThemeSelect = (currentTheme, isLoggedIn) => { - if (!isLoggedIn) { - return ''; - } + const themeSelectOptions = () => ( + Object.values(THEMES) + .map((theme) => ( + + )) + ); - return - {Object.values(THEMES) - .map((theme) => ( - - ))} - ; - }; + {themeSelectOptions()} + + ); + + const renderThemeSelectLocal = () => ( + + ); return ( <> @@ -98,7 +121,7 @@ const Footer = () => { {renderLinks(linksData)}
- {renderThemeSelect(currentTheme, isLoggedIn)} + {isLoggedIn ? renderThemeSelect() : renderThemeSelectLocal()}