From b0a2ad829d287be47a361db150b2f88ac2fa5251 Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:16:10 +1300 Subject: [PATCH 01/14] imported strapi into footer.ts, footer.tsx --- next/components/footer/footer.tsx | 10 ++++++- next/schemas/single/Footer.ts | 19 ++++++++++++ .../footer/content-types/footer/schema.json | 29 +++++++++++++++++++ strapi/src/api/footer/controllers/footer.js | 9 ++++++ strapi/src/api/footer/routes/footer.js | 9 ++++++ strapi/src/api/footer/services/footer.js | 9 ++++++ strapi/src/components/misc/links.json | 5 +++- 7 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 next/schemas/single/Footer.ts create mode 100644 strapi/src/api/footer/content-types/footer/schema.json create mode 100644 strapi/src/api/footer/controllers/footer.js create mode 100644 strapi/src/api/footer/routes/footer.js create mode 100644 strapi/src/api/footer/services/footer.js diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 573f648..fc48ed5 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -1,5 +1,7 @@ import Image from "next/image"; import styles from "./footer.module.css"; +import fetchStrapi from "@/util/strapi"; +import { footerSchema } from "@/schemas/single/Footer"; // socials import facebookLogo from "@/assets/footer/facebookLogo.svg"; import instagramLogo from "@/assets/footer/instagramLogo.svg"; @@ -10,7 +12,13 @@ import lakeHouseLogo from "@/assets/footer/lakeHouseLogo.png"; import localBoardLogo from "@/assets/footer/localBoardLogo.png"; import shoreJunctionLogo from "@/assets/footer/shoreJunction.png"; -export default function Footer() { +async function getFooterData() { + const resData = await fetchStrapi("footer", footerSchema); + return resData; +} + +export default async function Footer() { + const data = await getFooterData(); return ( ); diff --git a/strapi/src/api/footer/content-types/footer/schema.json b/strapi/src/api/footer/content-types/footer/schema.json index 196ffbd..e441fc0 100644 --- a/strapi/src/api/footer/content-types/footer/schema.json +++ b/strapi/src/api/footer/content-types/footer/schema.json @@ -19,7 +19,7 @@ }, "younite": { "type": "component", - "repeatable": true, + "repeatable": false, "component": "misc.links" }, "CreditsPrivacy": { From f1135e2a272747ad3ffaf761513a5d69c805c817 Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Mon, 21 Oct 2024 00:20:21 +1300 Subject: [PATCH 05/14] pushed changes to create pull requests to get the previous data that was lost in strapi --- next/components/footer/footer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 447b07c..dd8da79 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -7,7 +7,7 @@ import styles from "./footer.module.css"; import lakeHouseLogo from "@/assets/footer/lakeHouseLogo.png"; import localBoardLogo from "@/assets/footer/localBoardLogo.png"; import shoreJunctionLogo from "@/assets/footer/shoreJunction.png"; - +//lost links to socials async function getFooterData() { const resData = await fetchStrapi("footer", footerSchema); return resData; From 4a54efb10179b61ebef89a021da8b5aa709a8485 Mon Sep 17 00:00:00 2001 From: Oculux Date: Mon, 21 Oct 2024 00:54:00 +1300 Subject: [PATCH 06/14] :bricks: edit Strapi Header schema to have just title and url --- strapi/src/components/misc/links.json | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/strapi/src/components/misc/links.json b/strapi/src/components/misc/links.json index c1fef7b..1e3c1b6 100644 --- a/strapi/src/components/misc/links.json +++ b/strapi/src/components/misc/links.json @@ -14,19 +14,6 @@ "title": { "type": "string", "required": true - }, - "isExternal": { - "type": "boolean" - }, - "image": { - "allowedTypes": [ - "images", - "files", - "videos", - "audios" - ], - "type": "media", - "multiple": false } } } From 80c9ab2a922974e56fb9ec9b8f79a0c269b8879c Mon Sep 17 00:00:00 2001 From: Oculux Date: Mon, 21 Oct 2024 01:00:58 +1300 Subject: [PATCH 07/14] :bricks: make CreditsPrivacy a required Strapi field --- strapi/src/api/footer/content-types/footer/schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/strapi/src/api/footer/content-types/footer/schema.json b/strapi/src/api/footer/content-types/footer/schema.json index e441fc0..f29b8cc 100644 --- a/strapi/src/api/footer/content-types/footer/schema.json +++ b/strapi/src/api/footer/content-types/footer/schema.json @@ -23,7 +23,8 @@ "component": "misc.links" }, "CreditsPrivacy": { - "type": "string" + "type": "string", + "required": true } } } From ba70cd7039d1c5c5d707a46ef92ab364c31ba14c Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Sat, 16 Nov 2024 18:45:30 +1300 Subject: [PATCH 08/14] deleted the social logos from the code and have added to strapi but the pngs arent showing on the footer --- next/components/footer/footer.tsx | 10 +++++----- next/schemas/single/Footer.ts | 2 +- .../footer/content-types/footer/schema.json | 3 +-- strapi/src/components/misc/links.json | 18 +++++++++++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index dd8da79..35aca0b 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -16,7 +16,7 @@ async function getFooterData() { export default async function Footer() { const data = await getFooterData(); const { logoSection, younite, CreditsPrivacy } = data; - const links = data.logoSection; + const logos = data.logoSection; return (
@@ -60,18 +60,18 @@ export default async function Footer() {
- {logoSection.map((item, index) => ( + {logos.map((logo, index) => ( {item.title} ))} diff --git a/next/schemas/single/Footer.ts b/next/schemas/single/Footer.ts index d812ed0..46b23f9 100644 --- a/next/schemas/single/Footer.ts +++ b/next/schemas/single/Footer.ts @@ -5,7 +5,7 @@ export const footerSchema = z.object({ z.object({ url: z.string(), title: z.string(), - image: z.any() + image: z.any(), }), ), younite: z.object({ diff --git a/strapi/src/api/footer/content-types/footer/schema.json b/strapi/src/api/footer/content-types/footer/schema.json index f29b8cc..e441fc0 100644 --- a/strapi/src/api/footer/content-types/footer/schema.json +++ b/strapi/src/api/footer/content-types/footer/schema.json @@ -23,8 +23,7 @@ "component": "misc.links" }, "CreditsPrivacy": { - "type": "string", - "required": true + "type": "string" } } } diff --git a/strapi/src/components/misc/links.json b/strapi/src/components/misc/links.json index 1e3c1b6..9085eb2 100644 --- a/strapi/src/components/misc/links.json +++ b/strapi/src/components/misc/links.json @@ -6,14 +6,22 @@ }, "options": {}, "attributes": { - "url": { - "type": "string", - "required": true, - "unique": false - }, "title": { "type": "string", "required": true + }, + "url": { + "type": "string" + }, + "image": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": true } } } From 40b78cfefcb57ddb89444dc03d4ddeaf408c511a Mon Sep 17 00:00:00 2001 From: Nate Williamson Date: Sat, 16 Nov 2024 17:34:48 +1100 Subject: [PATCH 09/14] :bug: add image schema to footer schema --- next/schemas/single/Footer.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/next/schemas/single/Footer.ts b/next/schemas/single/Footer.ts index 46b23f9..14b1614 100644 --- a/next/schemas/single/Footer.ts +++ b/next/schemas/single/Footer.ts @@ -1,17 +1,18 @@ import { z } from "zod"; +import { imageSchema } from "../Image"; export const footerSchema = z.object({ logoSection: z.array( z.object({ url: z.string(), title: z.string(), - image: z.any(), + image: imageSchema, }), ), younite: z.object({ - url: z.string(), - title: z.string(), - }), + url: z.string(), + title: z.string(), + }), CreditsPrivacy: z.string(), }); From e122ab58e651a02dfc4e705b10cbd6fb98e6aeb3 Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Sat, 16 Nov 2024 23:30:37 +1300 Subject: [PATCH 10/14] used getlargestImageUrl to fetch images and change back to links --- next/components/footer/footer.tsx | 11 ++++---- .../footer/content-types/footer/schema.json | 6 +++-- .../content-block/logo-section.json | 26 +++++++++++++++++++ .../src/components/content-block/younite.json | 15 +++++++++++ strapi/src/components/misc/links.json | 10 ------- 5 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 strapi/src/components/content-block/logo-section.json create mode 100644 strapi/src/components/content-block/younite.json diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 35aca0b..2cdaee5 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -1,3 +1,4 @@ +import { getLargestImageUrl } from "@/util/image"; import { footerSchema } from "@/schemas/single/Footer"; import fetchStrapi from "@/util/strapi"; import Image from "next/image"; @@ -16,7 +17,7 @@ async function getFooterData() { export default async function Footer() { const data = await getFooterData(); const { logoSection, younite, CreditsPrivacy } = data; - const logos = data.logoSection; + const links = data.logoSection; return (
@@ -60,18 +61,18 @@ export default async function Footer() {
- {logos.map((logo, index) => ( + {links.map((item, index) => ( {logo.title} ))} diff --git a/strapi/src/api/footer/content-types/footer/schema.json b/strapi/src/api/footer/content-types/footer/schema.json index e441fc0..e9c4bc3 100644 --- a/strapi/src/api/footer/content-types/footer/schema.json +++ b/strapi/src/api/footer/content-types/footer/schema.json @@ -13,14 +13,16 @@ "pluginOptions": {}, "attributes": { "logoSection": { + "displayName": "logoSection", "type": "component", "repeatable": true, - "component": "misc.links" + "component": "content-block.logo-section" }, "younite": { + "displayName": "younite", "type": "component", "repeatable": false, - "component": "misc.links" + "component": "content-block.younite" }, "CreditsPrivacy": { "type": "string" diff --git a/strapi/src/components/content-block/logo-section.json b/strapi/src/components/content-block/logo-section.json new file mode 100644 index 0000000..80757f7 --- /dev/null +++ b/strapi/src/components/content-block/logo-section.json @@ -0,0 +1,26 @@ +{ + "collectionName": "components_content_block_logo_sections", + "info": { + "displayName": "logoSection", + "description": "" + }, + "options": {}, + "attributes": { + "title": { + "type": "string" + }, + "url": { + "type": "string" + }, + "logo": { + "allowedTypes": [ + "images", + "files", + "videos", + "audios" + ], + "type": "media", + "multiple": false + } + } +} diff --git a/strapi/src/components/content-block/younite.json b/strapi/src/components/content-block/younite.json new file mode 100644 index 0000000..75d7625 --- /dev/null +++ b/strapi/src/components/content-block/younite.json @@ -0,0 +1,15 @@ +{ + "collectionName": "components_content_block_younites", + "info": { + "displayName": "younite" + }, + "options": {}, + "attributes": { + "title": { + "type": "string" + }, + "url": { + "type": "string" + } + } +} diff --git a/strapi/src/components/misc/links.json b/strapi/src/components/misc/links.json index 9085eb2..1e79032 100644 --- a/strapi/src/components/misc/links.json +++ b/strapi/src/components/misc/links.json @@ -12,16 +12,6 @@ }, "url": { "type": "string" - }, - "image": { - "allowedTypes": [ - "images", - "files", - "videos", - "audios" - ], - "type": "media", - "multiple": true } } } From 731d2e6ac0990659b92a010eb1c726296615f5fd Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:27:07 +1300 Subject: [PATCH 11/14] ensure images data can be null so now the logo are showing --- next/components/footer/footer.tsx | 1 + next/schemas/Image.ts | 2 +- next/util/image.ts | 3 +++ strapi/src/components/content-block/logo-section.json | 9 +++++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 2cdaee5..5e540ae 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -70,6 +70,7 @@ export default async function Footer() { > {item.title}; diff --git a/next/util/image.ts b/next/util/image.ts index b822c63..24cf27f 100644 --- a/next/util/image.ts +++ b/next/util/image.ts @@ -1,6 +1,9 @@ import { ImageType } from "@/schemas/Image"; export const getLargestImageUrl = (img: ImageType) => { + if (!img.data || !img.data.attributes) { + return ""; + } const { large, medium, small, thumbnail } = img.data.attributes.formats; const largestFormat = large ?? medium ?? small ?? thumbnail ?? { url: "" }; const isRelativeUrl = process.env.NODE_ENV === "development"; diff --git a/strapi/src/components/content-block/logo-section.json b/strapi/src/components/content-block/logo-section.json index 80757f7..932c810 100644 --- a/strapi/src/components/content-block/logo-section.json +++ b/strapi/src/components/content-block/logo-section.json @@ -12,15 +12,16 @@ "url": { "type": "string" }, - "logo": { + "image": { + "type": "media", + "multiple": false, + "required": false, "allowedTypes": [ "images", "files", "videos", "audios" - ], - "type": "media", - "multiple": false + ] } } } From f1f3f076f8588618fb082d8714857afcf92a694a Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:18:46 +1300 Subject: [PATCH 12/14] fixed the css so the footer for the yellow bar has the same layout --- next/components/footer/footer.module.css | 34 +++++++++++++++++------- next/components/footer/footer.tsx | 6 +++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/next/components/footer/footer.module.css b/next/components/footer/footer.module.css index 7fbe2ce..58b9289 100644 --- a/next/components/footer/footer.module.css +++ b/next/components/footer/footer.module.css @@ -1,10 +1,11 @@ .footer { - display: grid; + display: flex; + flex-direction: column; } .top { display: grid; - grid-template-columns: 1fr 1fr 1fr; + grid-template-columns: repeat(3, 1fr); align-items: center; background-color: white; padding: 1.5rem calc(var(--gutter) + 2rem); @@ -12,33 +13,46 @@ .bottom { @apply bg-b-orange text-b-dark-blue; - display: grid; - grid-template-columns: 1fr 1fr 1fr; + display: flex; + /* grid-template-columns: 1fr 1fr 1fr; */ + justify-content: space-between; align-items: center; + gap: 1rem; padding: 1rem var(--gutter); } -.top :nth-child(2), +/* .top :nth-child(2), .bottom :nth-child(2) { justify-self: center; -} +} */ -.top :nth-child(3), +/* .top :nth-child(3), .bottom :nth-child(3) { justify-self: end; -} +} */ .brandLogo { object-fit: contain; max-width: 100px; } -.socialsContainer { +.bottom .younite { + flex: 0; + text-align: center; +} + +.bottom .creditsPrivacy { + flex: 1; + text-align: end; +} + +.bottom .socialsContainer { display: flex; + flex: 1; gap: 0.5rem; - justify-content: center; } + .socialLogo { object-fit: contain; height: 32px; diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 5e540ae..8473b68 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -61,6 +61,7 @@ export default async function Footer() {
+
{links.map((item, index) => ( ))} - +
+ {younite.title} - {CreditsPrivacy} + {CreditsPrivacy}
); From e81d512cd6fd86f68f6d8f3092f36c7bb22a8213 Mon Sep 17 00:00:00 2001 From: belleyong <136943913+belleyong@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:26:05 +1300 Subject: [PATCH 13/14] added the white bit for footer --- next/components/footer/footer.module.css | 18 ++---- next/components/footer/footer.tsx | 58 +++++++------------ next/schemas/single/Footer.ts | 6 ++ .../footer/content-types/footer/schema.json | 7 ++- .../components/content-block/top-footer.json | 24 ++++++++ 5 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 strapi/src/components/content-block/top-footer.json diff --git a/next/components/footer/footer.module.css b/next/components/footer/footer.module.css index 58b9289..aca2bab 100644 --- a/next/components/footer/footer.module.css +++ b/next/components/footer/footer.module.css @@ -4,8 +4,10 @@ } .top { - display: grid; - grid-template-columns: repeat(3, 1fr); + display: flex; + justify-content: space-between; + /* gap: 1rem; */ + /* grid-template-columns: repeat(3, 1fr); */ align-items: center; background-color: white; padding: 1.5rem calc(var(--gutter) + 2rem); @@ -14,26 +16,16 @@ .bottom { @apply bg-b-orange text-b-dark-blue; display: flex; - /* grid-template-columns: 1fr 1fr 1fr; */ justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem var(--gutter); } -/* .top :nth-child(2), -.bottom :nth-child(2) { - justify-self: center; -} */ - -/* .top :nth-child(3), -.bottom :nth-child(3) { - justify-self: end; -} */ - .brandLogo { object-fit: contain; max-width: 100px; + flex: 1 0 auto; } .bottom .younite { diff --git a/next/components/footer/footer.tsx b/next/components/footer/footer.tsx index 8473b68..910ae2c 100644 --- a/next/components/footer/footer.tsx +++ b/next/components/footer/footer.tsx @@ -16,49 +16,31 @@ async function getFooterData() { export default async function Footer() { const data = await getFooterData(); - const { logoSection, younite, CreditsPrivacy } = data; + const { topFooter, logoSection, younite, CreditsPrivacy } = data; + const brands = data.topFooter; const links = data.logoSection; return (