Skip to content

Commit 465d43c

Browse files
authored
Merge pull request #3156 from IntersectMBO/develop
GovTool - v2.0.14
2 parents 832ad7b + 788cdb3 commit 465d43c

37 files changed

+1245
-2853
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ changes.
1818

1919
### Removed
2020

21-
## [v2.0.14](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.14) 2025-03-05
22-
21+
## [v2.0.14](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.14) 2025-03-06
2322

2423
### Added
2524

25+
- Add image tag for DRep in GovTool metadata [Issue 3137](https://github.com/IntersectMBO/govtool/issues/3137)
26+
2627
### Fixed
2728

2829
- Fix calculating withdrawals when rewards records are empty for a given stake key [Issue 3134](https://github.com/IntersectMBO/govtool/issues/3134)

govtool/frontend/package-lock.json

Lines changed: 776 additions & 2464 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@
8888
"@typescript-eslint/parser": "^7.3.1",
8989
"@vitejs/plugin-legacy": "^6.0.0",
9090
"@vitejs/plugin-react-swc": "^3.7.2",
91-
"@vitest/browser": "^2.1.8",
92-
"@vitest/coverage-v8": "^2.1.8",
93-
"@vitest/ui": "^2.1.8",
91+
"@vitest/browser": "^3.0.7",
92+
"@vitest/coverage-v8": "^3.0.7",
93+
"@vitest/ui": "^3.0.7",
9494
"chromatic": "^11.20.0",
9595
"eslint": "^8.38.0",
9696
"eslint-config-airbnb": "^19.0.4",
@@ -108,7 +108,7 @@
108108
"typescript": "^5.0.2",
109109
"vite": "^6.0.3",
110110
"vite-plugin-compression": "^0.5.1",
111-
"vitest": "^2.1.8"
111+
"vitest": "^3.0.7"
112112
},
113113
"optionalDependencies": {
114114
"@rollup/rollup-linux-arm64-musl": "4.12.0"

govtool/frontend/src/components/molecules/DRepDataForm.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
1212
import { Button, InfoText, Spacer, Typography } from "@atoms";
1313
import { Rules } from "@consts";
1414
import { useScreenDimension, useTranslation } from "@hooks";
15-
import { ControlledField } from "../organisms";
1615
import { DRepDataFormValues } from "@/types/dRep";
1716

17+
import { ControlledField } from "../organisms";
18+
1819
const MAX_NUMBER_OF_LINKS = 7;
1920

2021
type Props = {
@@ -100,6 +101,18 @@ export const DRepDataForm = ({ control, errors, register, watch }: Props) => {
100101
maxLength={Rules.QUALIFICATIONS.maxLength.value}
101102
/>
102103
</div>
104+
<div>
105+
<FieldDescription
106+
title={t("forms.dRepData.image")}
107+
subtitle={t("forms.dRepData.imageHelpfulText")}
108+
/>
109+
<ControlledField.Input
110+
{...{ control, errors }}
111+
data-testid="image-input"
112+
name="image"
113+
rules={Rules.IMAGE_URL}
114+
/>
115+
</div>
103116
<Box sx={{ display: "flex", flexDirection: "column", gap: 4, mt: 3 }}>
104117
<Typography
105118
variant="title2"

govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const EditDRepForm = ({
5757
motivations: data?.motivations ?? "",
5858
qualifications: data?.qualifications ?? "",
5959
paymentAddress: data?.paymentAddress ?? "",
60+
image: data?.image ?? "",
6061
linkReferences: groupedReferences?.Link ?? [getEmptyReference("Link")],
6162
identityReferences: groupedReferences?.Identity ?? [
6263
getEmptyReference("Identity"),

govtool/frontend/src/consts/dRepActions/fields.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import i18n from "@/i18n";
2-
import { URL_REGEX, isReceivingAddress, isValidURLLength } from "@/utils";
2+
import {
3+
IMAGE_REGEX,
4+
URL_REGEX,
5+
isReceivingAddress,
6+
isValidURLLength,
7+
} from "@/utils";
38

49
export const Rules = {
510
GIVEN_NAME: {
@@ -66,4 +71,10 @@ export const Rules = {
6671
}),
6772
},
6873
},
74+
IMAGE_URL: {
75+
pattern: {
76+
value: IMAGE_REGEX,
77+
message: i18n.t("registration.fields.validations.image"),
78+
},
79+
},
6980
};

govtool/frontend/src/consts/dRepActions/jsonContext.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ export const DREP_CONTEXT = {
3131
},
3232
paymentAddress: "CIP119:paymentAddress",
3333
givenName: "CIP119:givenName",
34-
image: "CIP119:image",
34+
image: {
35+
"@id": "CIP119:image",
36+
"@context": {
37+
ImageObject: "https://schema.org/ImageObject",
38+
contentUrl: "CIP119:contentUrl",
39+
sha256: "CIP119:sha256",
40+
},
41+
},
3542
objectives: "CIP119:objectives",
3643
motivations: "CIP119:motivations",
3744
qualifications: "CIP119:qualifications",

govtool/frontend/src/context/governanceAction.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const GovernanceActionProvider = ({ children }: PropsWithChildren) => {
5050
const createGovernanceActionJsonLD = useCallback(
5151
async (govActionMetadata: GovActionMetadata) => {
5252
try {
53-
const metadataBody = generateMetadataBody({
53+
const metadataBody = await generateMetadataBody({
5454
data: govActionMetadata,
5555
acceptedKeys: ["title", "abstract", "motivation", "rationale"],
5656
});

govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const useCreateGovernanceActionForm = (
102102
throw new Error("Governance action type is not defined");
103103
}
104104

105-
const body = generateMetadataBody({
105+
const body = await generateMetadataBody({
106106
data: getValues(),
107107
acceptedKeys: ["title", "motivation", "abstract", "rationale"],
108108
});

govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const defaultEditDRepInfoValues: DRepDataFormValues = {
1919
objectives: "",
2020
motivations: "",
2121
qualifications: "",
22+
image: "",
2223
paymentAddress: "",
2324
linkReferences: [{ "@type": "Link", uri: "", label: "" }],
2425
identityReferences: [{ "@type": "Identity", uri: "", label: "" }],
@@ -75,7 +76,7 @@ export const useEditDRepInfoForm = (
7576
// Business Logic
7677
const generateMetadata = useCallback(async () => {
7778
const { linkReferences, identityReferences, ...rest } = getValues();
78-
const body = generateMetadataBody({
79+
const body = await generateMetadataBody({
7980
data: {
8081
...rest,
8182
references: [...(linkReferences ?? []), ...(identityReferences ?? [])],
@@ -87,6 +88,7 @@ export const useEditDRepInfoForm = (
8788
"qualifications",
8889
"paymentAddress",
8990
"doNotList",
91+
"image",
9092
],
9193
});
9294

0 commit comments

Comments
 (0)