diff --git a/assets/css/theme.css b/assets/css/theme.css index 5897c6c..05c4df1 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -62,7 +62,7 @@ --error: #f66; --alert: #f00; - --warn: #fa0; + --warn: #e80; --success: #5c2; --notice: #25c; diff --git a/components/movies/movies.vue b/components/movies/movies.vue index 0031aa6..9e7349b 100644 --- a/components/movies/movies.vue +++ b/components/movies/movies.vue @@ -66,91 +66,8 @@
  • - - - - - - -
    -
    -
    - - - - - {{ movie.channel.name }} -
    - - -
    - - {{ movie.title }} - - - - -
    +
  • @@ -164,7 +81,6 @@ + + diff --git a/components/scenes/scenes.vue b/components/scenes/scenes.vue index a655d84..44228af 100644 --- a/components/scenes/scenes.vue +++ b/components/scenes/scenes.vue @@ -102,7 +102,7 @@ v-for="scene in scenes" :key="`scene-${scene.id}`" > - + @@ -132,7 +132,7 @@ import Filters from '#/components/filters/filters.vue'; import ActorsFilter from '#/components/filters/actors.vue'; import TagsFilter from '#/components/filters/tags.vue'; import ChannelsFilter from '#/components/filters/channels.vue'; -import Scene from '#/components/scenes/tile.vue'; +import SceneTile from '#/components/scenes/tile.vue'; import Pagination from '#/components/pagination/pagination.vue'; import Ellipsis from '#/components/loading/ellipsis.vue'; diff --git a/components/scenes/tile.vue b/components/scenes/tile.vue index 63636a4..438b709 100644 --- a/components/scenes/tile.vue +++ b/components/scenes/tile.vue @@ -9,6 +9,7 @@
    diff --git a/pages/actors/@actorId/+onBeforeRender.js b/pages/actors/@actorId/+onBeforeRender.js index 961a897..890ac26 100644 --- a/pages/actors/@actorId/+onBeforeRender.js +++ b/pages/actors/@actorId/+onBeforeRender.js @@ -1,3 +1,5 @@ +import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */ + import { fetchActorsById } from '#/src/actors.js'; import { fetchScenes } from '#/src/scenes.js'; import { curateScenesQuery } from '#/src/web/scenes.js'; @@ -16,6 +18,10 @@ export async function onBeforeRender(pageContext) { }, pageContext.user), ]); + if (!actor) { + throw render(404, `Cannot find actor '${pageContext.routeParams.actorId}'.`); + } + const { scenes, aggActors, diff --git a/pages/movies/+onBeforeRender.js b/pages/movies/+onBeforeRender.js index 987575f..7167b42 100644 --- a/pages/movies/+onBeforeRender.js +++ b/pages/movies/+onBeforeRender.js @@ -8,7 +8,7 @@ export async function onBeforeRender(pageContext) { }), { page: Number(pageContext.routeParams.page) || 1, limit: Number(pageContext.urlParsed.search.limit) || 50, - }); + }, pageContext.user); const { movies, diff --git a/pages/movies/@movieId/+Page.vue b/pages/movies/@movieId/+Page.vue new file mode 100644 index 0000000..3f2473b --- /dev/null +++ b/pages/movies/@movieId/+Page.vue @@ -0,0 +1,683 @@ + + + + + diff --git a/pages/movies/@movieId/+onBeforeRender.js b/pages/movies/@movieId/+onBeforeRender.js new file mode 100644 index 0000000..ed02c31 --- /dev/null +++ b/pages/movies/@movieId/+onBeforeRender.js @@ -0,0 +1,60 @@ +import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */ + +import { fetchMoviesById } from '#/src/movies.js'; +import { fetchScenes } from '#/src/scenes.js'; +import { curateScenesQuery } from '#/src/web/scenes.js'; + +function getTitle(movie) { + if (movie.title) { + return movie.title; + } + + if (movie.actors.length > 0) { + return `Movie with ${movie.actors.map((actor) => actor.name).join(', ')}`; + } + + return 'Movie'; +} + +export async function onBeforeRender(pageContext) { + const [[movie], movieScenes] = await Promise.all([ + fetchMoviesById([Number(pageContext.routeParams.movieId)], pageContext.user), + fetchScenes(await curateScenesQuery({ + ...pageContext.urlQuery, + scope: pageContext.routeParams.scope || 'latest', + movieId: Number(pageContext.routeParams.movieId), + }), { + page: Number(pageContext.routeParams.page) || 1, + limit: Number(pageContext.urlParsed.search.limit) || 30, + aggregate: true, + }, pageContext.user), + ]); + + if (!movie) { + throw render(404, `Cannot find movie '${pageContext.routeParams.movieId}'.`); + } + + const { + scenes, + aggActors, + aggTags, + aggChannels, + total, + limit, + } = movieScenes; + + return { + pageContext: { + title: getTitle(movie), + pageProps: { + movie, + scenes, + aggActors, + aggTags, + aggChannels, + total, + limit, + }, + }, + }; +} diff --git a/pages/movies/@movieId/+route.js b/pages/movies/@movieId/+route.js new file mode 100644 index 0000000..fb04036 --- /dev/null +++ b/pages/movies/@movieId/+route.js @@ -0,0 +1 @@ +export default '/movie/@movieId/*'; diff --git a/pages/scene/+Page.vue b/pages/scene/+Page.vue index eacac76..585e3fc 100644 --- a/pages/scene/+Page.vue +++ b/pages/scene/+Page.vue @@ -3,7 +3,7 @@