diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b7bbe320..7f7439b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,8 @@ changes. ### Fixed -- +- Fix searching by DRep Given name +- Fix displaying the wallet connected modal ### Changed diff --git a/govtool/backend/src/VVA/API.hs b/govtool/backend/src/VVA/API.hs index 104b903b8..d13150d44 100644 --- a/govtool/backend/src/VVA/API.hs +++ b/govtool/backend/src/VVA/API.hs @@ -140,15 +140,21 @@ delegationToResponse Types.Delegation {..} = drepList :: App m => Maybe Text -> [DRepStatus] -> Maybe DRepSortMode -> Maybe Natural -> Maybe Natural -> m ListDRepsResponse drepList mSearchQuery statuses mSortMode mPage mPageSize = do CacheEnv {dRepListCache} <- asks vvaCache - dreps <- cacheRequest dRepListCache () (DRep.listDReps mSearchQuery) + dreps <- cacheRequest dRepListCache (fromMaybe "" mSearchQuery) (DRep.listDReps mSearchQuery) let filterDRepsByQuery = case mSearchQuery of - Nothing -> filter $ \Types.DRepRegistration {..} -> dRepRegistrationType == Types.DRep + Nothing -> filter $ \Types.DRepRegistration {..} -> + dRepRegistrationType == Types.DRep Just query -> filter $ \Types.DRepRegistration {..} -> - case dRepRegistrationType of - Types.SoleVoter -> query == dRepRegistrationView || query == dRepRegistrationDRepHash - Types.DRep -> query `isInfixOf` dRepRegistrationView - || query `isInfixOf` dRepRegistrationDRepHash + let searchLower = Text.toLower query + viewLower = Text.toLower dRepRegistrationView + hashLower = Text.toLower dRepRegistrationDRepHash + nameLower = maybe "" Text.toLower dRepRegistrationGivenName + in case dRepRegistrationType of + Types.SoleVoter -> searchLower == viewLower || searchLower == hashLower + Types.DRep -> searchLower `isInfixOf` viewLower + || searchLower `isInfixOf` hashLower + || searchLower `isInfixOf` nameLower let filterDRepsByStatus = case statuses of [] -> id diff --git a/govtool/backend/src/VVA/Types.hs b/govtool/backend/src/VVA/Types.hs index 4811ce463..c67e70189 100644 --- a/govtool/backend/src/VVA/Types.hs +++ b/govtool/backend/src/VVA/Types.hs @@ -196,7 +196,7 @@ data CacheEnv , dRepGetVotesCache :: Cache.Cache Text ([Vote], [Proposal]) , dRepInfoCache :: Cache.Cache Text DRepInfo , dRepVotingPowerCache :: Cache.Cache Text Integer - , dRepListCache :: Cache.Cache () [DRepRegistration] + , dRepListCache :: Cache.Cache Text [DRepRegistration] , networkMetricsCache :: Cache.Cache () NetworkMetrics } diff --git a/govtool/frontend/src/context/dataActionsBar.tsx b/govtool/frontend/src/context/dataActionsBar.tsx index c6fb920e6..e71cbd450 100644 --- a/govtool/frontend/src/context/dataActionsBar.tsx +++ b/govtool/frontend/src/context/dataActionsBar.tsx @@ -118,7 +118,7 @@ const DataActionsBarProvider: FC = ({ children }) => { ); return ( - + {children} );