diff --git a/components/scenes/scenes.vue b/components/scenes/scenes.vue index 35f6eb0..2a7826e 100644 --- a/components/scenes/scenes.vue +++ b/components/scenes/scenes.vue @@ -1,60 +1,213 @@ diff --git a/components/scenes/tile.vue b/components/scenes/tile.vue index bc599fe..67d1743 100644 --- a/components/scenes/tile.vue +++ b/components/scenes/tile.vue @@ -141,6 +141,7 @@ defineProps({ width: 1rem; height: 1rem; margin-right: .5rem; + object-fit: contain; } .row { diff --git a/package-lock.json b/package-lock.json index 2fe81cd..f1e9338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "version": "0.4.2", "dependencies": { + "@brillout/json-serializer": "^0.5.8", "@floating-ui/dom": "^1.5.3", "@floating-ui/vue": "^1.0.2", "@vitejs/plugin-vue": "^4.5.2", diff --git a/package.json b/package.json index 9664698..ce36d67 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "server:prod": "cross-env NODE_ENV=production node ./src/web/server" }, "dependencies": { + "@brillout/json-serializer": "^0.5.8", "@floating-ui/dom": "^1.5.3", "@floating-ui/vue": "^1.0.2", "@vitejs/plugin-vue": "^4.5.2", diff --git a/pages/actors/@actorId/+Page.vue b/pages/actors/@actorId/+Page.vue index 6160293..ea8fa6c 100644 --- a/pages/actors/@actorId/+Page.vue +++ b/pages/actors/@actorId/+Page.vue @@ -1,11 +1,45 @@ + + diff --git a/pages/actors/@actorId/+onBeforeRender.js b/pages/actors/@actorId/+onBeforeRender.js new file mode 100644 index 0000000..a3a250d --- /dev/null +++ b/pages/actors/@actorId/+onBeforeRender.js @@ -0,0 +1,35 @@ +import { fetchActorsById } from '#/src/actors.js'; +import { fetchScenes } from '#/src/scenes.js'; +import { curateScenesQuery } from '#/src/web/scenes.js'; + +export async function onBeforeRender(pageContext) { + const [actor] = await fetchActorsById([Number(pageContext.routeParams.actorId)]); + + const { + scenes, + actors, + total, + limit, + } = await fetchScenes(curateScenesQuery({ + ...pageContext.urlQuery, + scope: pageContext.routeParams.scope || 'latest', + actorId: Number(pageContext.routeParams.actorId), + }), { + page: Number(pageContext.routeParams.page) || 1, + limit: Number(pageContext.urlParsed.search.limit) || 30, + aggregate: true, + }); + + return { + pageContext: { + title: actor.name, + pageProps: { + actor, + actors, + scenes, + total, + limit, + }, + }, + }; +} diff --git a/pages/actors/@actorId/+route.js b/pages/actors/@actorId/+route.js index a6742bf..ff36068 100644 --- a/pages/actors/@actorId/+route.js +++ b/pages/actors/@actorId/+route.js @@ -1 +1,23 @@ -export default '/actor/@actorId/*'; +import { match } from 'path-to-regexp'; +// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions + +const path = '/actor/:actorId/:actorSlug?/:scope?/:page?'; +const urlMatch = match(path, { decode: decodeURIComponent }); + +export default (pageContext) => { + const matched = urlMatch(pageContext.urlPathname); + + if (matched) { + return { + routeParams: { + actorId: matched.params.actorId, + actorSlug: matched.params.actorSlug, + scope: matched.params.scope || 'latest', + page: matched.params.page || '1', + path, + }, + }; + } + + return false; +}; diff --git a/pages/updates/+Page.vue b/pages/updates/+Page.vue index b9e3eb1..6745856 100644 --- a/pages/updates/+Page.vue +++ b/pages/updates/+Page.vue @@ -2,6 +2,7 @@
@@ -9,7 +10,7 @@