diff --git a/directus-config b/directus-config index 7f0389d..1f4cea4 160000 --- a/directus-config +++ b/directus-config @@ -1 +1 @@ -Subproject commit 7f0389d9d878b49488ef656f9c599e3731809863 +Subproject commit 1f4cea4d3c4784a2ebb844f8ebe55317b6086180 diff --git a/src/app/[lang]/articles/[article]/page.tsx b/src/app/[lang]/articles/[article]/page.tsx index 561e478..fc9aedf 100644 --- a/src/app/[lang]/articles/[article]/page.tsx +++ b/src/app/[lang]/articles/[article]/page.tsx @@ -14,7 +14,7 @@ async function getArticle(article_slug: string): Promise { const articles = (await directus().request( readItems("game_star_articles", { fields: ["*", { translations: ["*"], authors: [{ members_id: ["*"] }] }], - filter: { status: { _eq: "published" }, slug: { _eq: article_slug } }, + filter: { slug: { _eq: article_slug } }, limit: 1, }), )) as GameStarArticle[]; diff --git a/src/app/[lang]/articles/page.tsx b/src/app/[lang]/articles/page.tsx index 3aecd0f..61b7e71 100644 --- a/src/app/[lang]/articles/page.tsx +++ b/src/app/[lang]/articles/page.tsx @@ -27,7 +27,7 @@ export default async function Articles({ let articles = (await directus().request( readItems("game_star_articles", { - filter: { status: { _eq: "published" } }, + filter: { published: { _eq: true } }, fields: ["*", { translations: ["*"], authors: [{ members_id: ["*"] }] }], }), )) as GameStarArticle[]; diff --git a/src/app/[lang]/events/[event]/page.tsx b/src/app/[lang]/events/[event]/page.tsx index a76cb3a..258db74 100644 --- a/src/app/[lang]/events/[event]/page.tsx +++ b/src/app/[lang]/events/[event]/page.tsx @@ -2,13 +2,13 @@ import { directus } from "@/directus"; import { getTranslation, queryTranslations } from "@/locales"; import { GameStarEvent } from "@/types/aliases"; import { readItems } from "@directus/sdk"; -import { notFound } from "next/navigation"; +import { notFound, redirect } from "next/navigation"; import Markdown from "react-markdown"; async function getEvent(event_slug: string): Promise { const events = (await directus().request( readItems("game_star_events", { - filter: { status: { _eq: "published" }, slug: { _eq: event_slug } }, + filter: { slug: { _eq: event_slug } }, limit: 1, ...queryTranslations, }), @@ -44,7 +44,11 @@ export default async function Event({ params: Promise<{ event: string; lang: string }>; }) { const { event: event_slug, lang } = await params; - const translation = getTranslation(await getEvent(event_slug), lang); + const event = await getEvent(event_slug); + + if (event.redirection) redirect(event.redirection); + + const translation = getTranslation(event, lang); return (
diff --git a/src/app/[lang]/events/page.tsx b/src/app/[lang]/events/page.tsx index 12702f4..6fb45ce 100644 --- a/src/app/[lang]/events/page.tsx +++ b/src/app/[lang]/events/page.tsx @@ -27,7 +27,7 @@ export default async function Events({ let events = (await directus().request( readItems("game_star_events", { - filter: { status: { _eq: "published" } }, + filter: { published: { _eq: true } }, ...queryTranslations, }), )) as GameStarEvent[]; diff --git a/src/app/[lang]/games/page.tsx b/src/app/[lang]/games/page.tsx index 207ee74..646506a 100644 --- a/src/app/[lang]/games/page.tsx +++ b/src/app/[lang]/games/page.tsx @@ -27,6 +27,7 @@ export default async function Games({ let games = (await directus().request( readItems("game_star_games", { + filter: { published: { _eq: true } }, ...queryTranslations, }), )) as GameStarGame[]; diff --git a/src/app/[lang]/page.tsx b/src/app/[lang]/page.tsx index 4cf5042..3fa0077 100644 --- a/src/app/[lang]/page.tsx +++ b/src/app/[lang]/page.tsx @@ -50,7 +50,7 @@ export default async function Home({ let events = (await directus().request( readItems("game_star_events", { - filter: { status: { _eq: "published" } }, + filter: { published: { _eq: true } }, ...queryTranslations, }), )) as GameStarEvent[]; diff --git a/src/app/[lang]/projects/[project]/page.tsx b/src/app/[lang]/projects/[project]/page.tsx index fce168b..71adb97 100644 --- a/src/app/[lang]/projects/[project]/page.tsx +++ b/src/app/[lang]/projects/[project]/page.tsx @@ -2,13 +2,13 @@ import { directus } from "@/directus"; import { getTranslation, queryTranslations } from "@/locales"; import { GameStarProject } from "@/types/aliases"; import { readItems } from "@directus/sdk"; -import { notFound } from "next/navigation"; +import { notFound, redirect } from "next/navigation"; import Markdown from "react-markdown"; async function getProject(project_slug: string): Promise { const projects = (await directus().request( readItems("game_star_projects", { - filter: { status: { _eq: "published" }, slug: { _eq: project_slug } }, + filter: { slug: { _eq: project_slug } }, limit: 1, ...queryTranslations, }), @@ -43,7 +43,11 @@ export default async function Project({ params: Promise<{ project: string; lang: string }>; }) { const { project: project_slug, lang } = await params; - const translation = getTranslation(await getProject(project_slug), lang); + const project = await getProject(project_slug); + + if (project.redirection) redirect(project.redirection); + + const translation = getTranslation(project, lang); return (
diff --git a/src/app/[lang]/projects/page.tsx b/src/app/[lang]/projects/page.tsx index aee0ea3..b9d8883 100644 --- a/src/app/[lang]/projects/page.tsx +++ b/src/app/[lang]/projects/page.tsx @@ -27,7 +27,7 @@ export default async function Projects({ let projects = (await directus().request( readItems("game_star_projects", { - filter: { status: { _eq: "published" } }, + filter: { published: { _eq: true } }, ...queryTranslations, }), )) as GameStarProject[]; diff --git a/src/components/Cards.tsx b/src/components/Cards.tsx index aab14f2..a76f956 100644 --- a/src/components/Cards.tsx +++ b/src/components/Cards.tsx @@ -23,7 +23,13 @@ export async function ProjectCard({ return (
- +

{translation.title}

@@ -47,7 +53,13 @@ export function EventCard({ }); return (
- +

{translation.title}

{start_date}