Skip to content
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
2 changes: 1 addition & 1 deletion directus-config
Submodule directus-config updated 25 files
+626 −1 directus-config/collections/translations.json
+1 −1 directus-config/snapshot/fields/game_star_articles/authors.json
+20 −17 directus-config/snapshot/fields/game_star_articles/published.json
+1 −1 directus-config/snapshot/fields/game_star_articles/slug.json
+0 −63 directus-config/snapshot/fields/game_star_articles/status.json
+1 −1 directus-config/snapshot/fields/game_star_articles_translations/content.json
+1 −1 directus-config/snapshot/fields/game_star_events/end.json
+20 −17 directus-config/snapshot/fields/game_star_events/published.json
+8 −20 directus-config/snapshot/fields/game_star_events/redirection.json
+1 −1 directus-config/snapshot/fields/game_star_events/start.json
+1 −1 directus-config/snapshot/fields/game_star_events/translations.json
+1 −1 directus-config/snapshot/fields/game_star_events_translations/content.json
+1 −1 directus-config/snapshot/fields/game_star_games/embed_id.json
+1 −1 directus-config/snapshot/fields/game_star_games/href.json
+1 −1 directus-config/snapshot/fields/game_star_games/name.json
+20 −17 directus-config/snapshot/fields/game_star_games/published.json
+1 −1 directus-config/snapshot/fields/game_star_games/translations.json
+50 −0 directus-config/snapshot/fields/game_star_projects/published.json
+17 −19 directus-config/snapshot/fields/game_star_projects/redirection.json
+1 −1 directus-config/snapshot/fields/game_star_projects/translations.json
+1 −1 directus-config/snapshot/fields/game_star_projects_translations/content.json
+0 −25 directus-config/snapshot/relations/game_star_articles_translations/cover_image.json
+0 −25 directus-config/snapshot/relations/game_star_events_translations/cover_image.json
+0 −25 directus-config/snapshot/relations/game_star_projects_translations/cover_image.json
+24,663 −25,099 types/schema.d.ts
2 changes: 1 addition & 1 deletion src/app/[lang]/articles/[article]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function getArticle(article_slug: string): Promise<GameStarArticle> {
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[];
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/articles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
10 changes: 7 additions & 3 deletions src/app/[lang]/events/[event]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<GameStarEvent> {
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,
}),
Expand Down Expand Up @@ -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 (
<div className="article">
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/events/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
1 change: 1 addition & 0 deletions src/app/[lang]/games/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
10 changes: 7 additions & 3 deletions src/app/[lang]/projects/[project]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<GameStarProject> {
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,
}),
Expand Down Expand Up @@ -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 (
<div className="article">
Expand Down
2 changes: 1 addition & 1 deletion src/app/[lang]/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
16 changes: 14 additions & 2 deletions src/components/Cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ export async function ProjectCard({

return (
<div key={project.slug} className="card">
<Link href={`/${lang}/projects/${project.slug}`}>
<Link
href={
project.redirection
? project.redirection
: `/${lang}/projects/${project.slug}`
}
>
<div className="card-head">
<h3>{translation.title}</h3>
</div>
Expand All @@ -47,7 +53,13 @@ export function EventCard({
});
return (
<div key={event.slug} className="card">
<Link href={`/${lang}/events/${event.slug}`}>
<Link
href={
event.redirection
? event.redirection
: `/${lang}/events/${event.slug}`
}
>
<div className="card-head">
<h3>{translation.title}</h3>
<div className="event-start">{start_date}</div>
Expand Down
Loading