feat: Routes de l'arborescence
All checks were successful
Deploy WordPress and Nuxt / deploy (push) Successful in 57s

This commit is contained in:
2025-09-15 14:38:14 -04:00
parent 0f00615f35
commit 4c3f0a26bf
14 changed files with 132 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
fragment TheArticle on Post {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheArticleFragment } from "#graphql-operations";
defineProps<{ node: TheArticleFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -0,0 +1,3 @@
fragment TheEvent on Event {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheEventFragment } from "#graphql-operations";
defineProps<{ node: TheEventFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -0,0 +1,3 @@
fragment TheLocation on Location {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheLocationFragment } from "#graphql-operations";
defineProps<{ node: TheLocationFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -0,0 +1,3 @@
fragment TheMembership on Membership {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheMembershipFragment } from "#graphql-operations";
defineProps<{ node: TheMembershipFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -0,0 +1,3 @@
fragment TheProject on Project {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheProjectFragment } from "#graphql-operations";
defineProps<{ node: TheProjectFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -0,0 +1,3 @@
fragment TheResource on Resource {
title
}

View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { TheResourceFragment } from "#graphql-operations";
defineProps<{ node: TheResourceFragment }>();
</script>
<template>
<UPage>
<UPageSection v-if="node.title" :title="node.title" />
</UPage>
</template>

View File

@@ -5,5 +5,23 @@ query nodeByUri($uri: String!) {
... on Page { ... on Page {
...ThePage ...ThePage
} }
... on Post {
...TheArticle
}
... on Event {
...TheEvent
}
... on Location {
...TheLocation
}
... on Membership {
...TheMembership
}
... on Project {
...TheProject
}
... on Resource {
...TheResource
}
} }
} }

View File

@@ -1,5 +1,21 @@
import type { ThePageFragment } from "#graphql-operations"; import type {
import { ThePage } from "#components"; ThePageFragment,
TheArticleFragment,
TheEventFragment,
TheLocationFragment,
TheMembershipFragment,
TheProjectFragment,
TheResourceFragment,
} from "#graphql-operations";
import {
ThePage,
TheArticle,
TheEvent,
TheLocation,
TheMembership,
TheProject,
TheResource,
} from "#components";
export async function useNodeByUri() { export async function useNodeByUri() {
const route = useRoute(); const route = useRoute();
@@ -12,6 +28,18 @@ export async function useNodeByUri() {
switch (node?.__typename) { switch (node?.__typename) {
case "Page": case "Page":
return { component: ThePage, node: node as ThePageFragment }; return { component: ThePage, node: node as ThePageFragment };
case "Post":
return { component: TheArticle, node: node as TheArticleFragment };
case "Event":
return { component: TheEvent, node: node as TheEventFragment };
case "Location":
return { component: TheLocation, node: node as TheLocationFragment };
case "Membership":
return { component: TheMembership, node: node as TheMembershipFragment };
case "Project":
return { component: TheProject, node: node as TheProjectFragment };
case "Resource":
return { component: TheResource, node: node as TheResourceFragment };
default: default:
throw createError({ statusCode: 404, message: "Page non trouvée", fatal: true }); throw createError({ statusCode: 404, message: "Page non trouvée", fatal: true });
} }