From 08c26fc80ce9e8ac5892371ac0e6768247de11ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 14 Feb 2025 13:56:11 +0100 Subject: [PATCH] feat(#2993): allow searching for yourself in DRep directory --- CHANGELOG.md | 1 + .../src/pages/DRepDirectoryContent.tsx | 29 ++++++------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 805838873..af0b046f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ changes. - Add workflow to automatically update any of the @intersect.mbo package [Issue 2968](https://github.com/IntersectMBO/govtool/issues/2968) - Add Propose Governance Action button in governance actions dashboard [Issue 1188](https://github.com/IntersectMBO/govtool/issues/1188) - Add click handlers to non-interactive elements [Issue 2929](https://github.com/IntersectMBO/govtool/issues/2929) +- Allow searching for yourself in DRep Directory [Issue 2993](https://github.com/IntersectMBO/govtool/issues/2993) ### Fixed diff --git a/govtool/frontend/src/pages/DRepDirectoryContent.tsx b/govtool/frontend/src/pages/DRepDirectoryContent.tsx index 7bcc2199d..36e55ae94 100644 --- a/govtool/frontend/src/pages/DRepDirectoryContent.tsx +++ b/govtool/frontend/src/pages/DRepDirectoryContent.tsx @@ -67,12 +67,6 @@ export const DRepDirectoryContent: FC = ({ enabled: !!inProgressDelegation || !!currentDelegation, }); - const { dRep: yourselfDRep } = useGetDRepDetailsQuery(myDRepId, { - enabled: !!inProgressDelegation || !!currentDelegation, - }); - const showYourselfDRep = - debouncedSearchText === myDRepId || debouncedSearchText === ""; - const { dRepData: dRepList, isPreviousData, @@ -106,21 +100,16 @@ export const DRepDirectoryContent: FC = ({ const ada = correctAdaFormat(votingPower); - const listedDRepsWithoutYourself = uniqBy( - dRepList?.filter( - (dRep) => - (typeof dRep.doNotList === "string" - ? !parseBoolean(dRep.doNotList) - : !dRep.doNotList) && !isSameDRep(dRep, myDRepId), - ), + const filteredDoNotListDReps = uniqBy( + dRepList?.filter((dRep) => { + if (typeof dRep.doNotList === "string") { + return !parseBoolean(dRep.doNotList); + } + return !dRep.doNotList; + }), "view", ); - const dRepListToDisplay = - yourselfDRep && showYourselfDRep - ? [yourselfDRep, ...listedDRepsWithoutYourself] - : listedDRepsWithoutYourself; - const isAnAutomatedVotingOptionChosen = currentDelegation?.dRepView && (currentDelegation?.dRepView === @@ -217,8 +206,8 @@ export const DRepDirectoryContent: FC = ({ flex: 1, }} > - {dRepListToDisplay?.length === 0 && } - {dRepListToDisplay?.map((dRep) => ( + {filteredDoNotListDReps?.length === 0 && } + {filteredDoNotListDReps?.map((dRep) => (