From e68adda8e368adddabee3e35d68315764050a4ec Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Wed, 13 Sep 2023 18:36:11 +0100 Subject: [PATCH 1/2] fix(advocates): display whole country name in advocate cards A bad type led to the first letter of a string being indexed instead of the first string in an array of length one. --- .../Advocates/MeetTheAdvocates/AdvocatesMeetTheAdvocates.vue | 2 +- hooks/advocate-conversion-utils.ts | 2 +- types/advocates.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Advocates/MeetTheAdvocates/AdvocatesMeetTheAdvocates.vue b/components/Advocates/MeetTheAdvocates/AdvocatesMeetTheAdvocates.vue index 66a746c4e0..dccd744146 100644 --- a/components/Advocates/MeetTheAdvocates/AdvocatesMeetTheAdvocates.vue +++ b/components/Advocates/MeetTheAdvocates/AdvocatesMeetTheAdvocates.vue @@ -58,7 +58,7 @@ :name="advocate.name" :image="advocate.image" :city="advocate.city" - :country="advocate.country[0]" + :country="advocate.country" :region="advocate.region" :slack-id="advocate.slackId" :slack-username="advocate.slackUsername" diff --git a/hooks/advocate-conversion-utils.ts b/hooks/advocate-conversion-utils.ts index 3bb5842921..4d5f5e3d68 100644 --- a/hooks/advocate-conversion-utils.ts +++ b/hooks/advocate-conversion-utils.ts @@ -95,7 +95,7 @@ class AdvocatesAirtableRecords extends AirtableRecords { return record.get(this.recordFields!.city); } - public getCountry(record: any): string[] { + public getCountry(record: any): string { return record.get(this.recordFields!.country); } diff --git a/types/advocates.ts b/types/advocates.ts index 770e22538c..2cf3af7d08 100644 --- a/types/advocates.ts +++ b/types/advocates.ts @@ -16,7 +16,7 @@ const ADVOCATES_WORLD_REGION_OPTIONS = Object.values( interface Advocate { city: string; - country: string[]; + country: string; image: string; location?: string; name: string; From dbce3d142d71ac9bf53a1aff2065f187ead2eccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eddybrando=20V=C3=A1squez?= Date: Thu, 11 Jan 2024 14:45:13 +0100 Subject: [PATCH 2/2] test(advocates): update country property type --- tests/hooks/utils/conversion-utils.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/hooks/utils/conversion-utils.spec.ts b/tests/hooks/utils/conversion-utils.spec.ts index 9651b622f2..1b0627c13b 100644 --- a/tests/hooks/utils/conversion-utils.spec.ts +++ b/tests/hooks/utils/conversion-utils.spec.ts @@ -22,7 +22,7 @@ describe("writeJSONToFile", () => { image: "/images/advocates/downloaded/rec8zXNiryVq3Q6kh.jpg", region: "America (North)", city: "New York", - country: ["United States"], + country: "United States", slackId: "U017XULSMUY", slackUsername: "John.Doe", }, @@ -31,7 +31,7 @@ describe("writeJSONToFile", () => { image: "/images/advocates/downloaded/recFKAk7KoXr3IMTH.jpg", region: "America (North)", city: "Durham", - country: ["United States"], + country: "United States", slackId: "U01313A0AGP", slackUsername: "J.Doe", }, @@ -62,7 +62,7 @@ describe("writeJSONToFile", () => { image: "/images/advocates/downloaded/rec8zXNiryVq3Q6kh.jpg", region: "America (North)", city: "New York", - country: ["United States"], + country: "United States", slackId: "U017XULSMUY", slackUsername: "J.Doe", }, @@ -71,7 +71,7 @@ describe("writeJSONToFile", () => { image: "/images/advocates/downloaded/recFKAk7KoXr3IMTH.jpg", region: "America (North)", city: "Durham", - country: ["United States"], + country: "United States", slackId: "U01313A0AGP", slackUsername: "John.Doe", },