From ad05b78ffa8948e9bb07afb04b0d437258283776 Mon Sep 17 00:00:00 2001 From: Gandharv Date: Wed, 4 Jan 2023 17:18:47 +0530 Subject: [PATCH] fix: add pinned icon for left sidebar items (#5180) --- .../Editor/LeftSidebar/SidebarDebugger.jsx | 16 ++++++++++++- .../Editor/LeftSidebar/SidebarInspector.jsx | 23 ++++++++++++++++--- .../LeftSidebar/SidebarPageSelector/index.jsx | 14 +++++++++++ frontend/src/HomePage/Folders.jsx | 2 +- frontend/src/_ui/Popover/index.jsx | 3 ++- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/frontend/src/Editor/LeftSidebar/SidebarDebugger.jsx b/frontend/src/Editor/LeftSidebar/SidebarDebugger.jsx index fe7ce533a7..f2d4e0935b 100644 --- a/frontend/src/Editor/LeftSidebar/SidebarDebugger.jsx +++ b/frontend/src/Editor/LeftSidebar/SidebarDebugger.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import Popover from '@/_ui/Popover'; import { Button, HeaderSection } from '@/_ui/LeftSidebar'; import { LeftSidebarItem } from './SidebarItem'; @@ -16,6 +16,7 @@ export const LeftSidebarDebugger = ({ currentPageId, }) => { const { t } = useTranslation(); + const [pinned, setPinned] = useState(false); const [errorLogs, setErrorLogs] = React.useState([]); const [errorHistory, setErrorHistory] = React.useState({ appLevel: [], pageLevel: [] }); const [unReadErrorCount, setUnReadErrorCount] = React.useState({ read: 0, unread: 0 }); @@ -92,6 +93,18 @@ export const LeftSidebarDebugger = ({ + @@ -115,6 +128,7 @@ export const LeftSidebarDebugger = ({ handleToggle={(open) => { if (!open) setSelectedSidebarItem(''); }} + {...(pinned && { open: true })} popoverContentClassName="p-0 sidebar-h-100-popover" side="right" popoverContent={popoverContent} diff --git a/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx b/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx index 47f59fd8e7..cbd7be1234 100644 --- a/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx +++ b/frontend/src/Editor/LeftSidebar/SidebarInspector.jsx @@ -1,6 +1,6 @@ -import React, { useMemo } from 'react'; +import React, { useMemo, useState } from 'react'; import { LeftSidebarItem } from './SidebarItem'; -import { HeaderSection } from '@/_ui/LeftSidebar'; +import { Button, HeaderSection } from '@/_ui/LeftSidebar'; import JSONTreeViewer from '@/_ui/JSONTreeViewer'; import _ from 'lodash'; import RunjsIcon from '../Icons/runjs.svg'; @@ -21,6 +21,7 @@ export const LeftSidebarInspector = ({ runQuery, dataSources, }) => { + const [pinned, setPinned] = useState(false); const componentDefinitions = JSON.parse(JSON.stringify(appDefinition))['components']; const queryDefinitions = appDefinition['queries']; const selectedComponent = React.useMemo(() => { @@ -159,7 +160,22 @@ export const LeftSidebarInspector = ({ const popoverContent = (
- + +
+ +
+
{ if (!open) setSelectedSidebarItem(''); }} + {...(pinned && { open: true })} side="right" popoverContentClassName="p-0 sidebar-h-100-popover sidebar-h-100-popover-inspector" popoverContent={popoverContent} diff --git a/frontend/src/Editor/LeftSidebar/SidebarPageSelector/index.jsx b/frontend/src/Editor/LeftSidebar/SidebarPageSelector/index.jsx index de5be78861..9aaf25a3c3 100644 --- a/frontend/src/Editor/LeftSidebar/SidebarPageSelector/index.jsx +++ b/frontend/src/Editor/LeftSidebar/SidebarPageSelector/index.jsx @@ -34,6 +34,7 @@ const LeftSidebarPageSelector = ({ dataQueries, }) => { const [allpages, setPages] = useState(pages); + const [pinned, setPinned] = useState(false); const [newPageBeingCreated, setNewPageBeingCreated] = useState(false); const [showSearch, setShowSearch] = useState(false); @@ -91,6 +92,18 @@ const LeftSidebarPageSelector = ({ > +
{showSearch && ( @@ -160,6 +173,7 @@ const LeftSidebarPageSelector = ({ handleToggle={(open) => { if (!open) setSelectedSidebarItem(''); }} + {...(pinned && { open: true })} popoverContentClassName="p-0 sidebar-h-100-popover" side="right" popoverContent={popoverContent} diff --git a/frontend/src/HomePage/Folders.jsx b/frontend/src/HomePage/Folders.jsx index f34693ba77..600548b39f 100644 --- a/frontend/src/HomePage/Folders.jsx +++ b/frontend/src/HomePage/Folders.jsx @@ -130,7 +130,7 @@ export const Folders = function Folders({ } return ( -
+
+ {children}