Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/aw 39 404 page #82

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ export default async function PartnersProducts({
slug: string
}) {
const url = `page-partner-and-products/${slug}?locale=${activeLocale.locale}`
const page = await strapi(url)
if (page && page.status === 404) {
return notFound()
}

const { data } = await page.json()
const data = await strapi(url)

const locales = data.localizations.map(
(item: { locale: string; slug: string }) => {
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/app/[locale]/(solutions-group)/solutions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function Solutions({
}) {
const url = `solutions-overview?locale=${activeLocale.locale}`

const { data } = await (await strapi(url)).json()
const data = await strapi(url)
const locales = data.localizations.map((item: { locale: string }) => {
return {
href: `/${item.locale}/${SLUGS[item.locale]}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function SolutionsDetailPage({
isActive: true,
}
const url = `solutions-pages/${slug}`
const { data } = await (await strapi(url)).json()
const data = await strapi(url)
const locales = data.localizations.map((item: { locale: string }) => {
return {
href: `/${item.locale}/${SLUGS[item.locale]}`,
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/app/homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function Homepage({
activeLocale: LinkedLocale
}) {
const url = `homepage?locale=${activeLocale.locale}`
const { data } = await (await strapi(url)).json()
const data = await strapi(url)
const locales = (data?.localizations ?? []).map(
(item: { locale: string }) => {
return {
Expand Down
12 changes: 12 additions & 0 deletions nextjs/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Container from "@/components/container"
import React from "react"

export default async function NotFound() {
return (
<Container background="neutral">
<div>
<h1>404 - Page Not Found</h1>
</div>
</Container>
)
}
2 changes: 1 addition & 1 deletion nextjs/src/components/icons/icon-date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const IconDate: React.FC<{ className?: string }> = ({ className }) => {
<clipPath id="a">
<path d="m0 0h30v30h-30z" />
</clipPath>
<g clip-path="url(#a)" fill="currentColor">
<g clipPath="url(#a)" fill="currentColor">
<path d="m28.388 2.5708h-1.5111v-.65478c0-.89491-.7281-1.623051-1.6231-1.623051-.8949 0-1.6229.728081-1.6229 1.623051v.65478h-1.4237v-.65478c0-.89491-.7281-1.623051-1.623-1.623051-.895 0-1.6231.728081-1.6231 1.623051v.65478h-7.9222v-.65478c0-.89491-.7281-1.623051-1.62306-1.623051-.8949 0-1.62305.728081-1.62305 1.623051v.65478h-1.42365v-.65478c0-.89491-.72809-1.623051-1.62305-1.623051s-1.62304.728081-1.62304 1.623051v.65478h-1.51114c-.888805 0-1.61191.72311-1.61191 1.61197v23.91233c0 .8888.723105 1.6119 1.61197 1.6119h20.88803c.5682 0 .5682-.8789 0-.8789h-20.88803c-.40424 0-.733064-.3288-.733064-.733v-19.15405h2.536814c.56819 0 .56819-.8789 0-.8789h-2.536814v-3.87938c0-.40418.328824-.73306.733064-.73306h1.51114v.68953c0 .8949.72808 1.62305 1.62304 1.62305.8949 0 1.62305-.72809 1.62305-1.62305v-.68953h1.42365v.68953c0 .8949.72809 1.62305 1.62305 1.62305.895 0 1.623-.72809 1.623-1.62305v-.68953h7.9222v.68953c0 .8949.7281 1.62305 1.6231 1.62305.8949 0 1.623-.72809 1.623-1.62305v-.68953h1.4237v.68953c0 .8949.728 1.62305 1.6229 1.62305.895 0 1.6231-.72809 1.6231-1.62305v-.68953h1.5111c.4042 0 .7331.32883.7331.73306v3.87938h-23.05126c-.56818 0-.56818.8789 0 .8789h23.05126v19.15405c0 .4041-.3288.733-.7331.733h-3.2513c-.5682 0-.5682.8789 0 .8789h3.2513c.8889 0 1.612-.7231 1.612-1.6119v-23.91233c0-.88886-.7231-1.61197-1.612-1.61197zm-22.89771 1.56844c0 .41027-.33381.74414-.74414.74414s-.74414-.33381-.74414-.74414v-2.22322c0-.41028.33381-.74414.74414-.74414.41028 0 .74414.3338.74414.74414zm4.66971 0c0 .41027-.33383.74414-.74416.74414-.41027 0-.74414-.33381-.74414-.74414v-2.22322c0-.41028.33381-.74414.74414-.74414s.74416.3338.74416.74414zm11.1683 0c0 .41027-.3338.74414-.7441.74414-.4104 0-.7442-.33381-.7442-.74414v-2.22322c0-.41028.3338-.74414.7442-.74414.4103 0 .7441.3338.7441.74414zm4.6697 0c0 .41027-.3338.74414-.7442.74414-.4102 0-.744-.33381-.744-.74414v-2.22322c0-.41028.3338-.74414.744-.74414.4104 0 .7442.3338.7442.74414z" />
<path d="m8.40755 10.9469c-.88664 0-1.60799.7213-1.60799 1.608 0 .8866.72135 1.608 1.60799 1.608s1.60795-.7214 1.60795-1.608c0-.8867-.72131-1.608-1.60795-1.608zm0 2.3371c-.40201 0-.72908-.3271-.72908-.7291s.32707-.7291.72908-.7291.72908.3271.72908.7291-.32707.7291-.72908.7291z" />
<path d="m12.7505 10.9469c-.8866 0-1.6079.7213-1.6079 1.608 0 .8866.7213 1.608 1.608 1.608.8866 0 1.6079-.7214 1.6079-1.608 0-.8867-.7214-1.608-1.608-1.608zm.0001 2.3371c-.402 0-.7291-.3271-.7291-.7291s.3271-.7291.7291-.7291.729.3271.729.7291-.327.7291-.729.7291z" />
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/components/icons/icon-maps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const IconMaps: React.FC<{ className?: string }> = ({ className }) => {
<clipPath id="a">
<path d="m0 0h30v30h-30z" />
</clipPath>
<g clip-path="url(#a)" fill="currentColor">
<g clipPath="url(#a)" fill="currentColor">
<path d="m15 5.46661c-.8216 0-1.6123.24715-2.2867.71473-.1993.13822-.2497.41309-.1125.61395s.41.2516.6094.11343c.5275-.3658 1.1464-.55916 1.7898-.55916 1.7434 0 3.1617 1.42899 3.1617 3.18545 0 1.75649-1.4183 3.18549-3.1617 3.18549s-3.1618-1.429-3.1618-3.18549c0-.51814.1195-1.01209.3549-1.46806.1117-.21633.0283-.48288-.1864-.59537-.2147-.11245-.4792-.02848-.5909.18785-.2969.57492-.4539 1.22349-.4539 1.87558.0001 2.24339 1.8115 4.06849 4.0381 4.06849 2.2265 0 4.0379-1.8251 4.0379-4.06849 0-2.24332-1.8114-4.0684-4.0379-4.0684z" />
<path d="m29.9663 29.3889-4.3244-10.4686c-.068-.1646-.2275-.2718-.4045-.2718h-4.3094c.8382-1.1425 1.5359-2.2805 2.0807-3.3978.9657-1.9801 1.4552-3.9031 1.4552-5.71562 0-5.25768-4.2455-9.53508-9.4639-9.53508-5.21845 0-9.46392 4.2774-9.46392 9.53502 0 1.81258.48955 3.73558 1.45518 5.71568.5448 1.1173 1.24248 2.2553 2.08072 3.3977h-4.30939c-.17696 0-.33657.1073-.40448.2718l-2.94679 7.1336c-.09299.2251.01271.4835.23613.5771.05508.0231.11203.0341.16816.0341.17168 0 .33463-.1023.40465-.272l.42047-1.0179h2.98277l-1.5457 3.742h-2.98271l.44806-1.0848c.09299-.2251-.01271-.4835-.23613-.5771-.22353-.0939-.479941.0128-.572871.2378l-.700488 1.6959c-.0563086.1363-.04130862.2919.0400195.4146.0812105.1227.2179685.1965.3644535.1965h29.123666c.1464 0 .2832-.0738.3645-.1965s.0963-.2783.04-.4146zm-23.55389-19.85388c0-4.77082 3.85239-8.652129 8.58759-8.652129s8.5875 3.881369 8.5875 8.652129c0 2.00058-.6899 5.19748-3.8815 9.27138-.0032.0038-.0061.0078-.0092.0117-.163.2079-.3323.4179-.5086.6303-1.7538 2.113-3.5286 3.656-4.1883 4.2042-.6577-.5463-2.4241-2.0815-4.1767-4.1905-.1807-.2175-.3541-.4324-.5209-.6451-.0027-.0034-.0052-.0069-.008-.0103-3.19148-4.0736-3.88189-7.2704-3.88189-9.27168zm-1.35762 9.99628h2.98284l-1.08797 2.6337h-2.98278zm2.56219 9.5858 2.73872-6.6298 7.7938 6.6298zm11.89092 0-9.0441-7.6934c-.1067-.0908-.2502-.1249-.3858-.0917-.13567.0331-.2477.1295-.30131.2594l-3.10881 7.5257h-1.64086l1.65797-4.0138c.05631-.1363.04131-.2918-.04002-.4146-.08121-.1227-.21803-.1965-.36451-.1965h-3.27487l.59661-1.4443h3.63972c.17696 0 .33656-.1073.40447-.2719l1.3404-3.2447h.76043c.13201.1658.26618.3317.40398.4975 2.2608 2.7205 4.487 4.4671 4.5806 4.5402.079.0616.1736.0923.2682.0923.0945 0 .1892-.0308.2681-.0923.0515-.0401.7475-.5865 1.7386-1.5211h4.9618c.242 0 .4382-.1976.4382-.4414s-.1962-.4415-.4382-.4415h-4.0587c.6075-.6154 1.2715-1.3329 1.939-2.1361.1378-.1659.272-.3317.404-.4976h4.6923l1.088 2.6337h-2.312c-.242 0-.4381.1977-.4381.4415s.1961.4414.4381.4414h2.6766l.5966 1.4443h-9.0275c-.1829 0-.3465.1144-.4105.287-.0639.1727-.0148.3671.1233.4879l4.4023 3.85zm3.9109 0-4.2788-3.7419h8.2191l1.5458 3.7419z" />
</g>
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/components/icons/icon-time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const IconTime: React.FC<{ className?: string }> = ({ className }) => {
<clipPath id="a">
<path d="m0 0h30v30h-30z" />
</clipPath>
<g clip-path="url(#a)" fill="currentColor">
<g clipPath="url(#a)" fill="currentColor">
<path d="m25.6066 4.39336c-2.8331-2.83307-6.6-4.39336-10.6066-4.39336s-7.77346 1.56029-10.60664 4.39336c-2.83307 2.83318-4.39336 6.60004-4.39336 10.60664s1.56029 7.7735 4.39336 10.6066c2.83318 2.8331 6.60004 4.3934 10.60664 4.3934s7.7735-1.5603 10.6066-4.3934 4.3934-6.6 4.3934-10.6066-1.5603-7.77346-4.3934-10.60664zm-.6215 20.59174c-2.6671 2.6672-6.2132 4.136-9.9851 4.136s-7.31801-1.4688-9.98514-4.136c-2.66713-2.6671-4.135954-6.2132-4.135954-9.9851s1.468824-7.31801 4.135954-9.98514 6.21324-4.135954 9.98514-4.135954 7.318 1.468824 9.9851 4.135954c2.6672 2.66713 4.136 6.21324 4.136 9.98514s-1.4688 7.318-4.136 9.9851z" />
<path d="m15 4.69693c-.2427 0-.4395.19676-.4395.43945v1.87875c0 .2427.1968.43946.4395.43946s.4395-.1967.4395-.4394v-1.87881c0-.24269-.1968-.43945-.4395-.43945z" />
<path d="m15 22.5453c-.2427 0-.4395.1968-.4395.4395v1.8788c0 .2426.1968.4394.4395.4394s.4395-.1968.4395-.4394v-1.8788c0-.2427-.1968-.4395-.4395-.4395z" />
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/components/nav-bar/nav-mobile-item.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react"
import React from "react"
import { type NavItem } from "./nav"
import IconChevronRight from "../icons/icon-chevron-right"
import clsx from "clsx"
Expand Down
8 changes: 3 additions & 5 deletions nextjs/src/components/stapi/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import IconSocial from "@/components/icons/icon-social"
import FooterLegal from "@/components/layout/footer-legal"

export default async function Footer({ locale }: { locale: string }) {
const { data } = await (
await strapi(
`footer/?locale=${locale}&populate=solutions&populate=partner_and_products`,
)
).json()
const data = await strapi(
`footer/?locale=${locale}&populate=solutions&populate=partner_and_products`,
)
if (!data) {
return null
}
Expand Down
2 changes: 1 addition & 1 deletion nextjs/src/components/stapi/hallmarks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function Hallmarks({
hallmarksId: string
}) {
const url = `hallmarks/${hallmarksId}?populate=hallmark`
const { data } = await (await strapi(url)).json()
const data = await strapi(url)
if (!data || !data.hallmark) {
return
}
Expand Down
10 changes: 8 additions & 2 deletions nextjs/src/lib/strapi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { notFound } from "next/navigation"
const STRAPI = process.env.STRAPI_API || ""

export default function strapi(query: string) {
return fetch(`${STRAPI}/${query}`, {
export default async function strapi(query: string) {
const page = await fetch(`${STRAPI}/${query}`, {
cache: "no-cache",
})
if (page && page.status === 404) {
return notFound()
}
const { data } = await page.json()
return data
}
Loading