diff --git a/CHANGELOG.md b/CHANGELOG.md index c3fb139bf..c8102c766 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,27 @@ changes. - +## [v2.0.6](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.6) 2025-01-16 + +### Added + +- Add support for base64 encoded images [Issue 2633](https://github.com/IntersectMBO/govtool/issues/2633) +- Add searching for metadata [Issue 2634](https://github.com/IntersectMBO/govtool/issues/2634) +- Allow delegation to inactive DRep [Issue 2589](https://github.com/IntersectMBO/govtool/issues/2589) + +### Fixed + +- Fix searching by full DRep IDs on wrong prefix cut [Issue 2639](https://github.com/IntersectMBO/govtool/issues/2639) +- Trim whitespace from search bar input [Issue 2472](https://github.com/IntersectMBO/govtool/issues/2472) + +### Changed + +- + +### Removed + +- + ## [v2.0.5](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.5) 2025-01-10 ### Added diff --git a/govtool/backend/Dockerfile b/govtool/backend/Dockerfile index 639632822..da4ee5635 100644 --- a/govtool/backend/Dockerfile +++ b/govtool/backend/Dockerfile @@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.5/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.6/x/vva-be/build/vva-be/vva-be /usr/local/bin diff --git a/govtool/backend/Dockerfile.qovery b/govtool/backend/Dockerfile.qovery index 0f5aaf1f1..237b09b53 100644 --- a/govtool/backend/Dockerfile.qovery +++ b/govtool/backend/Dockerfile.qovery @@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.5/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-2.0.6/x/vva-be/build/vva-be/vva-be /usr/local/bin # Expose the necessary port EXPOSE 9876 diff --git a/govtool/backend/sql/list-dreps.sql b/govtool/backend/sql/list-dreps.sql index 5872cd13a..e02ba95be 100644 --- a/govtool/backend/sql/list-dreps.sql +++ b/govtool/backend/sql/list-dreps.sql @@ -167,7 +167,11 @@ WHERE COALESCE(?, '') = '' OR (CASE WHEN LENGTH(?) % 2 = 0 AND ? ~ '^[0-9a-fA-F]+$' THEN dh.raw = decode(?, 'hex') ELSE false END) OR dh.view ILIKE ? OR - off_chain_vote_drep_data.given_name ILIKE ? + off_chain_vote_drep_data.given_name ILIKE ? OR + off_chain_vote_drep_data.payment_address ILIKE ? OR + off_chain_vote_drep_data.objectives ILIKE ? OR + off_chain_vote_drep_data.motivations ILIKE ? OR + off_chain_vote_drep_data.qualifications ILIKE ? ) GROUP BY block_first_register.epoch_no, diff --git a/govtool/backend/src/VVA/API.hs b/govtool/backend/src/VVA/API.hs index 180fb55a7..89b37cc3c 100644 --- a/govtool/backend/src/VVA/API.hs +++ b/govtool/backend/src/VVA/API.hs @@ -144,17 +144,17 @@ drepList mSearchQuery statuses mSortMode mPage mPageSize = do let filterDRepsByQuery = case mSearchQuery of Nothing -> filter $ \Types.DRepRegistration {..} -> - dRepRegistrationType == Types.DRep + dRepRegistrationType /= Types.SoleVoter Just query -> filter $ \Types.DRepRegistration {..} -> 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 + in case dRepRegistrationType of + Types.SoleVoter -> + searchLower == viewLower || searchLower == hashLower + Types.DRep -> + True + let filterDRepsByStatus = case statuses of [] -> id @@ -187,7 +187,6 @@ drepList mSearchQuery statuses mSortMode mPage mPageSize = do total = length allValidDReps :: Int let elements = take pageSize $ drop (page * pageSize) allValidDReps - return $ ListDRepsResponse { listDRepsResponsePage = fromIntegral page , listDRepsResponsePageSize = fromIntegral pageSize diff --git a/govtool/backend/src/VVA/DRep.hs b/govtool/backend/src/VVA/DRep.hs index 7422402be..1d0c7a1a8 100644 --- a/govtool/backend/src/VVA/DRep.hs +++ b/govtool/backend/src/VVA/DRep.hs @@ -44,13 +44,18 @@ listDReps :: listDReps mSearchQuery = withPool $ \conn -> do let searchParam = fromMaybe "" mSearchQuery results <- liftIO $ SQL.query conn listDRepsSql - ( searchParam - , searchParam - , searchParam - , searchParam - , "%" <> searchParam <> "%" - , "%" <> searchParam <> "%" + ( searchParam -- COALESCE(?, '') + , searchParam -- LENGTH(?) + , searchParam -- AND ? + , searchParam -- decode(?, 'hex') + , "%" <> searchParam <> "%" -- dh.view + , "%" <> searchParam <> "%" -- given_name + , "%" <> searchParam <> "%" -- payment_address + , "%" <> searchParam <> "%" -- objectives + , "%" <> searchParam <> "%" -- motivations + , "%" <> searchParam <> "%" -- qualifications ) + timeZone <- liftIO getCurrentTimeZone return [ DRepRegistration drepHash drepView isScriptBased url dataHash (floor @Scientific deposit) votingPower status drepType txHash (localTimeToUTC timeZone date) metadataError paymentAddress givenName objectives motivations qualifications imageUrl imageHash diff --git a/govtool/backend/src/VVA/Types.hs b/govtool/backend/src/VVA/Types.hs index 95d0e622e..7a8fa3722 100644 --- a/govtool/backend/src/VVA/Types.hs +++ b/govtool/backend/src/VVA/Types.hs @@ -95,9 +95,9 @@ data DRepInfo , dRepInfoImageHash :: Maybe Text } -data DRepStatus = Active | Inactive | Retired deriving (Eq, Ord) +data DRepStatus = Active | Inactive | Retired deriving (Show, Eq, Ord) -data DRepType = DRep | SoleVoter deriving (Eq) +data DRepType = DRep | SoleVoter deriving (Show, Eq) data DRepRegistration = DRepRegistration @@ -121,6 +121,7 @@ data DRepRegistration , dRepRegistrationImageUrl :: Maybe Text , dRepRegistrationImageHash :: Maybe Text } + deriving (Show) data Proposal = Proposal diff --git a/govtool/backend/vva-be.cabal b/govtool/backend/vva-be.cabal index 634d084cc..7b7dddd6d 100644 --- a/govtool/backend/vva-be.cabal +++ b/govtool/backend/vva-be.cabal @@ -1,6 +1,6 @@ cabal-version: 3.6 name: vva-be -version: 2.0.5 +version: 2.0.6 -- A short (one-line) description of the package. -- synopsis: diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index ed076736d..d4b54a722 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "@govtool/frontend", - "version": "2.0.5", + "version": "2.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@govtool/frontend", - "version": "2.0.5", + "version": "2.0.6", "hasInstallScript": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 97fa61f31..35c3ddbfa 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@govtool/frontend", "private": true, - "version": "2.0.5", + "version": "2.0.6", "type": "module", "scripts": { "build": "vite build", diff --git a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx index c715b7117..a1eae8bd8 100644 --- a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx +++ b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx @@ -2,7 +2,10 @@ import { Avatar, Box, SxProps } from "@mui/material"; import { Typography } from "@atoms"; import { MetadataValidationStatus } from "@models"; -import { getMetadataDataMissingStatusTranslation } from "@/utils"; +import { + getBase64ImageDetails, + getMetadataDataMissingStatusTranslation, +} from "@/utils"; import { ICONS } from "@/consts"; type DataMissingHeaderProps = { @@ -19,54 +22,62 @@ export const DataMissingHeader = ({ titleStyle, isDRep, image, -}: DataMissingHeaderProps) => ( - +}: DataMissingHeaderProps) => { + const base64Image = getBase64ImageDetails(image ?? ""); + + return ( - {isDRep && ( - - )} - - {(isDataMissing && - getMetadataDataMissingStatusTranslation( - isDataMissing as MetadataValidationStatus, - )) || - title} - + {isDRep && ( + + )} + + {(isDataMissing && + getMetadataDataMissingStatusTranslation( + isDataMissing as MetadataValidationStatus, + )) || + title} + + - -); + ); +}; diff --git a/govtool/frontend/src/components/organisms/DRepCard.tsx b/govtool/frontend/src/components/organisms/DRepCard.tsx index 8a64f63d5..5e93f0732 100644 --- a/govtool/frontend/src/components/organisms/DRepCard.tsx +++ b/govtool/frontend/src/components/organisms/DRepCard.tsx @@ -11,6 +11,7 @@ import { correctDRepDirectoryFormat, ellipsizeText, encodeCIP129Identifier, + getBase64ImageDetails, getMetadataDataMissingStatusTranslation, } from "@utils"; @@ -64,6 +65,8 @@ export const DRepCard = ({ bech32Prefix: isScriptBased ? "drep_script" : "drep", }); + const base64Image = getBase64ImageDetails(image ?? ""); + return ( )} - {status === "Active" && + {["Active", "Inactive"].includes(status) && isConnected && onDelegate && !isMyDrep && @@ -304,7 +311,7 @@ export const DRepCard = ({ {t("delegate")} )} - {status === "Active" && !isConnected && ( + {["Active", "Inactive"].includes(status) && !isConnected && (