From 18726f12dabcfdb85669792103a34efd8918a4fc Mon Sep 17 00:00:00 2001 From: Miro Date: Fri, 5 Sep 2025 16:04:21 +0200 Subject: [PATCH] Issue 4062 Filter ans Sorting Icons goes to new line --- .../components/molecules/DataActionsBar.tsx | 75 +++++----- .../organisms/DashboardDrawerMobile.tsx | 129 ++++++++++-------- 2 files changed, 114 insertions(+), 90 deletions(-) diff --git a/govtool/frontend/src/components/molecules/DataActionsBar.tsx b/govtool/frontend/src/components/molecules/DataActionsBar.tsx index 7839af965..f8de6e97c 100644 --- a/govtool/frontend/src/components/molecules/DataActionsBar.tsx +++ b/govtool/frontend/src/components/molecules/DataActionsBar.tsx @@ -74,8 +74,9 @@ export const DataActionsBar: FC = ({ alignItems="center" display="flex" justifyContent="space-between" - gap={1.5} - flexWrap="wrap" + gap={{ xs: 0.75, sm: 1.5 }} + flexWrap="nowrap" + width="100%" > = ({ fontWeight: 500, height: 48, padding: "16px 24px", - maxWidth: 500, - flex: "0 0 auto", + flex: "1 1 auto", + minWidth: 0, + maxWidth: "none", }} /> - - {effectiveFiltersOpen && ( - - )} - {effectiveSortOpen && ( - - )} - + + {effectiveFiltersOpen && ( + + )} + {effectiveSortOpen && ( + + )} + + {selectedFilterItems.length > 0 && ( @@ -153,10 +163,7 @@ export const DataActionsBar: FC = ({ flexWrap="wrap" gap={1} alignItems="flex-start" - sx={{ - mt: 2, - "& > *": { flex: "0 0 auto", alignSelf: "flex-start" }, - }} + sx={{ mt: 2, "& > *": { flex: "0 0 auto", alignSelf: "flex-start" } }} > {selectedFilterItems.map(({ key, label }) => ( { - const { isProposalDiscussionForumEnabled, isGovernanceOutcomesPillarEnabled } = useFeatureFlag(); + const { + isProposalDiscussionForumEnabled, + isGovernanceOutcomesPillarEnabled, + } = useFeatureFlag(); const { screenWidth } = useScreenDimension(); const { voter } = useGetVoterInfo(); - const openDrawer = () => { - setIsDrawerOpen(true); - }; + const openDrawer = () => setIsDrawerOpen(true); + const closeDrawer = () => setIsDrawerOpen(false); - const closeDrawer = () => { - setIsDrawerOpen(false); - }; + const navItems = CONNECTED_NAV_ITEMS as unknown as NavItem[]; return ( + - {CONNECTED_NAV_ITEMS.map((navItem) => ( - + {navItems.map((navItem, i) => ( + { - if (navItem.newTabLink) { - openInNewTab(navItem.newTabLink); - } - setIsDrawerOpen(false); - }} + if (navItem.newTabLink) openInNewTab(navItem.newTabLink); + setIsDrawerOpen(false); + }} isConnectWallet /> - {navItem.childNavItems && ( - - {navItem.childNavItems.map((childItem) => { - if ( - !isProposalDiscussionForumEnabled && - childItem.dataTestId === "proposal-discussion-link" - ) { - return null; - } - - if ( - !isGovernanceOutcomesPillarEnabled && - (childItem.dataTestId === "governance-actions-voted-by-me-link" || - childItem.dataTestId === "governance-actions-outcomes-link") - ) { - return null; - } - return ( - { - if (childItem.newTabLink) { - openInNewTab(childItem.newTabLink); - } - setIsDrawerOpen(false); - }} - isConnectWallet - /> - ); - })} - - )} + {!!navItem.childNavItems?.length && ( + + {navItem.childNavItems.map((childItem, ci) => { + if ( + !isProposalDiscussionForumEnabled && + childItem.dataTestId === "proposal-discussion-link" + ) { + return null; + } + if ( + !isGovernanceOutcomesPillarEnabled && + (childItem.dataTestId === + "governance-actions-voted-by-me-link" || + childItem.dataTestId === + "governance-actions-outcomes-link") + ) { + return null; + } + return ( + { + if (childItem.newTabLink) + openInNewTab(childItem.newTabLink); + setIsDrawerOpen(false); + }} + isConnectWallet + /> + ); + })} + + )} - ))} + ))} + {(voter?.isRegisteredAsDRep || voter?.isRegisteredAsSoleVoter) && ( )}