Skip to content

Commit e3b3292

Browse files
committed
feat(#2993): allow searching for yourself in DRep directory
1 parent 4c209c2 commit e3b3292

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ changes.
1717
- Add support for submitting all 7 governance action types [Issue 2258](https://github.com/IntersectMBO/govtool/issues/2258)
1818
- Add workflow to automatically update any of the @intersect.mbo package [Issue 2968](https://github.com/IntersectMBO/govtool/issues/2968)
1919
- Add Propose Governance Action button in governance actions dashboard [Issue 1188](https://github.com/IntersectMBO/govtool/issues/1188)
20+
- Allow searching for yourself in DRep Directory [Issue 2993](https://github.com/IntersectMBO/govtool/issues/2993)
2021

2122
### Fixed
2223

govtool/frontend/src/pages/DRepDirectoryContent.tsx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
6767
enabled: !!inProgressDelegation || !!currentDelegation,
6868
});
6969

70-
const { dRep: yourselfDRep } = useGetDRepDetailsQuery(myDRepId, {
71-
enabled: !!inProgressDelegation || !!currentDelegation,
72-
});
73-
const showYourselfDRep =
74-
debouncedSearchText === myDRepId || debouncedSearchText === "";
75-
7670
const {
7771
dRepData: dRepList,
7872
isPreviousData,
@@ -106,21 +100,16 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
106100

107101
const ada = correctAdaFormat(votingPower);
108102

109-
const listedDRepsWithoutYourself = uniqBy(
110-
dRepList?.filter(
111-
(dRep) =>
112-
(typeof dRep.doNotList === "string"
113-
? !parseBoolean(dRep.doNotList)
114-
: !dRep.doNotList) && !isSameDRep(dRep, myDRepId),
115-
),
103+
const filteredDoNotListDReps = uniqBy(
104+
dRepList?.filter((dRep) => {
105+
if (typeof dRep.doNotList === "string") {
106+
return !parseBoolean(dRep.doNotList);
107+
}
108+
return !dRep.doNotList;
109+
}),
116110
"view",
117111
);
118112

119-
const dRepListToDisplay =
120-
yourselfDRep && showYourselfDRep
121-
? [yourselfDRep, ...listedDRepsWithoutYourself]
122-
: listedDRepsWithoutYourself;
123-
124113
const isAnAutomatedVotingOptionChosen =
125114
currentDelegation?.dRepView &&
126115
(currentDelegation?.dRepView ===
@@ -217,8 +206,8 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
217206
flex: 1,
218207
}}
219208
>
220-
{dRepListToDisplay?.length === 0 && <EmptyStateDrepDirectory />}
221-
{dRepListToDisplay?.map((dRep) => (
209+
{filteredDoNotListDReps?.length === 0 && <EmptyStateDrepDirectory />}
210+
{filteredDoNotListDReps?.map((dRep) => (
222211
<Box key={dRep.view} component="li" sx={{ listStyle: "none" }}>
223212
<DRepCard
224213
dRep={dRep}

0 commit comments

Comments
 (0)