Added visibility toggle to stash tile. Collapsed stash page directory structure.
This commit is contained in:
10
pages/stashes/actors/+Page.vue
Normal file
10
pages/stashes/actors/+Page.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<Stash>
|
||||
<Actors />
|
||||
</Stash>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Stash from '#/components/stashes/stash.vue';
|
||||
import Actors from '#/components/actors/actors.vue';
|
||||
</script>
|
||||
49
pages/stashes/actors/+onBeforeRender.js
Normal file
49
pages/stashes/actors/+onBeforeRender.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
|
||||
|
||||
import { fetchStashByUsernameAndSlug } from '#/src/stashes.js';
|
||||
import { fetchActors } from '#/src/actors.js';
|
||||
import { curateActorsQuery } from '#/src/web/actors.js';
|
||||
import { HttpError } from '#/src/errors.js';
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
try {
|
||||
const stash = await fetchStashByUsernameAndSlug(pageContext.routeParams.username, pageContext.routeParams.stashSlug, pageContext.user);
|
||||
|
||||
const stashActors = await fetchActors(curateActorsQuery({
|
||||
...pageContext.urlQuery,
|
||||
stashId: stash.id,
|
||||
}), {
|
||||
page: Number(pageContext.routeParams.page) || 1,
|
||||
limit: Number(pageContext.urlParsed.search.limit) || 120,
|
||||
order: pageContext.urlParsed.search.order?.split('.') || ['stashed', 'desc'],
|
||||
}, pageContext.user);
|
||||
|
||||
const {
|
||||
actors,
|
||||
countries,
|
||||
cupRange,
|
||||
limit,
|
||||
total,
|
||||
} = stashActors;
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: `${stash.name} by ${stash.user.username}`,
|
||||
pageProps: {
|
||||
stash,
|
||||
actors,
|
||||
countries,
|
||||
cupRange,
|
||||
limit,
|
||||
total,
|
||||
},
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (error instanceof HttpError) {
|
||||
throw render(error.httpCode, error.message);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
24
pages/stashes/actors/+route.js
Normal file
24
pages/stashes/actors/+route.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { match } from 'path-to-regexp';
|
||||
// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions
|
||||
|
||||
const path = '/stash/:username/:stashSlug/:domain(actors)/:page?';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
username: matched.params.username,
|
||||
stashSlug: matched.params.stashSlug,
|
||||
domain: matched.params.domain,
|
||||
order: 'stashed.desc',
|
||||
page: matched.params.page || '1',
|
||||
path,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user