From 6a5f5aa424f4044cb3e3eb135b61222be7da3f1c Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:32:52 +0100 Subject: [PATCH] fix(sidebar): qa feedback [EE-5666] (#10452) --- app/assets/css/app.css | 6 ++ app/react/sidebar/DockerSidebar.tsx | 4 +- app/react/sidebar/SettingsSidebar.tsx | 2 +- app/react/sidebar/SidebarItem/Menu.tsx | 99 ------------------- .../sidebar/SidebarItem/SidebarParent.tsx | 2 +- app/react/sidebar/SidebarItem/index.ts | 3 - 6 files changed, 10 insertions(+), 106 deletions(-) delete mode 100644 app/react/sidebar/SidebarItem/Menu.tsx diff --git a/app/assets/css/app.css b/app/assets/css/app.css index 8f7944d92..057cf34f7 100644 --- a/app/assets/css/app.css +++ b/app/assets/css/app.css @@ -19,6 +19,12 @@ html { overflow-y: scroll; } +html[theme='dark'], +html[theme='highcontrast'] { + /* make the scrollbars dark theme when in the dark modes */ + color-scheme: dark; +} + body { background: var(--bg-body-color); font-family: 'Inter'; diff --git a/app/react/sidebar/DockerSidebar.tsx b/app/react/sidebar/DockerSidebar.tsx index b82256682..eb7b2dc6c 100644 --- a/app/react/sidebar/DockerSidebar.tsx +++ b/app/react/sidebar/DockerSidebar.tsx @@ -4,11 +4,11 @@ import { Layers, List, Lock, - Share2, Shuffle, Trello, Clipboard, Edit, + Network, } from 'lucide-react'; import { @@ -136,7 +136,7 @@ export function DockerSidebar({ environmentId, environment }: Props) { diff --git a/app/react/sidebar/SettingsSidebar.tsx b/app/react/sidebar/SettingsSidebar.tsx index 16bf16852..7e6f49bae 100644 --- a/app/react/sidebar/SettingsSidebar.tsx +++ b/app/react/sidebar/SettingsSidebar.tsx @@ -29,7 +29,7 @@ export function SettingsSidebar({ isAdmin, isTeamLeader }: Props) { !window.ddExtension && (isAdmin || (isTeamLeader && !teamSyncQuery.data)); return ( - + {showUsersSection && ( ) { - const { isOpen: isSidebarOpen } = useSidebarState(); - - const paths = useMemo( - () => [...getPaths(head, []), ...openOnPaths], - [openOnPaths, head] - ); - - const { isOpen, toggleOpen } = useIsOpen(isSidebarOpen, paths); - - const CollapseButtonIcon = isOpen ? ChevronUp : ChevronDown; - - if (!isSidebarOpen) { - return head as JSX.Element; - } - - return ( - - - {head} - {isSidebarOpen && Children.count(children) > 0 && ( - - - - )} - - - {isOpen && {children}} - - ); - - function handleClickArrow(e: React.MouseEvent) { - e.preventDefault(); - e.stopPropagation(); - toggleOpen(); - } -} - -function useIsOpen( - isSidebarOpen: boolean, - - paths: string[] = [] -) { - const { state } = useCurrentStateAndParams(); - const currentStateName = state.name || ''; - const isOpenByState = paths.some((path) => currentStateName.startsWith(path)); - - const [forceOpen, toggleForceOpen] = useReducer((state) => !state, false); - - const isOpen = checkIfOpen(); - - return { isOpen, toggleOpen }; - - function toggleOpen() { - if (!isOpenByState) { - toggleForceOpen(); - } - } - - function checkIfOpen() { - if (!isSidebarOpen) { - return false; - } - - if (forceOpen) { - return true; - } - - return isOpenByState; - } -} diff --git a/app/react/sidebar/SidebarItem/SidebarParent.tsx b/app/react/sidebar/SidebarItem/SidebarParent.tsx index 723ba0705..b4c84ffb3 100644 --- a/app/react/sidebar/SidebarItem/SidebarParent.tsx +++ b/app/react/sidebar/SidebarItem/SidebarParent.tsx @@ -63,7 +63,7 @@ export function SidebarParent({ to={to} params={params} className={clsx( - 'w-full h-full font-medium items-center flex list-none border-none text-gray-5 hover:text-gray-5 hover:no-underline focus:text-gray-5 focus:no-underline', + 'w-full h-full font-medium items-center flex list-none border-none text-inherit hover:text-inherit hover:no-underline focus:text-inherit focus:no-underline', { 'justify-start': isSidebarOpen, 'justify-center': !isSidebarOpen, diff --git a/app/react/sidebar/SidebarItem/index.ts b/app/react/sidebar/SidebarItem/index.ts index 9e5da2bbd..6fda1cdec 100644 --- a/app/react/sidebar/SidebarItem/index.ts +++ b/app/react/sidebar/SidebarItem/index.ts @@ -1,14 +1,11 @@ import { SidebarItem as MainComponent } from './SidebarItem'; -import { Menu } from './Menu'; import { Wrapper } from './Wrapper'; interface SubComponents { - Menu: typeof Menu; Wrapper: typeof Wrapper; } export const SidebarItem: typeof MainComponent & SubComponents = MainComponent as typeof MainComponent & SubComponents; -SidebarItem.Menu = Menu; SidebarItem.Wrapper = Wrapper;