Added actor stash.
This commit is contained in:
@@ -1,108 +0,0 @@
|
||||
<template>
|
||||
<div class="stash">
|
||||
<div class="header">
|
||||
<h2 class="title">
|
||||
<Icon
|
||||
v-if="stash.primary"
|
||||
icon="heart7"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
v-else
|
||||
icon="box"
|
||||
/>
|
||||
|
||||
{{ stash.name }}
|
||||
</h2>
|
||||
|
||||
<a
|
||||
:href="`/user/${stash.user.username}`"
|
||||
class="user nolink"
|
||||
>
|
||||
<img
|
||||
:src="stash.user.avatar"
|
||||
class="avatar"
|
||||
><span class="userame ellipsis">{{ stash.user.username }}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="scenes-container">
|
||||
<Scenes />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { inject } from 'vue';
|
||||
|
||||
import Scenes from '#/components/scenes/scenes.vue';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const stash = pageContext.pageProps.stash;
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.stash {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: .5rem 1rem;
|
||||
color: var(--text-light);
|
||||
background: var(--grey-dark-40);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
text-transform: capitalize;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 1.2rem;
|
||||
margin-right: 1rem;
|
||||
|
||||
.icon {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
margin-right: .75rem;
|
||||
fill: var(--text-light);
|
||||
}
|
||||
}
|
||||
|
||||
.user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
margin-right: .75rem;
|
||||
border-radius: .25rem;
|
||||
}
|
||||
|
||||
.scenes-container {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@media(--small-50) {
|
||||
.title {
|
||||
font-size: 1rem;
|
||||
|
||||
.icon {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
10
pages/stashes/@username/@stashSlug/actors/+Page.vue
Normal file
10
pages/stashes/@username/@stashSlug/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/@username/@stashSlug/actors/+onBeforeRender.js
Normal file
49
pages/stashes/@username/@stashSlug/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/@username/@stashSlug/actors/+route.js
Normal file
24
pages/stashes/@username/@stashSlug/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;
|
||||
};
|
||||
10
pages/stashes/@username/@stashSlug/movies/+Page.vue
Normal file
10
pages/stashes/@username/@stashSlug/movies/+Page.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<Stash>
|
||||
<h2>Movies</h2>
|
||||
</Stash>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Stash from '#/components/stashes/stash.vue';
|
||||
// import Actors from '#/components/actors/actors.vue';
|
||||
</script>
|
||||
25
pages/stashes/@username/@stashSlug/movies/+onBeforeRender.js
Normal file
25
pages/stashes/@username/@stashSlug/movies/+onBeforeRender.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
|
||||
|
||||
import { fetchStashByUsernameAndSlug } from '#/src/stashes.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);
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: `${stash.name} by ${stash.user.username}`,
|
||||
pageProps: {
|
||||
stash,
|
||||
},
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
if (error instanceof HttpError) {
|
||||
throw render(error.httpCode, error.message);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { match } from 'path-to-regexp';
|
||||
// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions
|
||||
|
||||
const path = '/stash/:username/:stashSlug/:scope?/:page?';
|
||||
const path = '/stash/:username/:stashSlug/:domain(movies)/:scope?/:page?';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
@@ -12,6 +12,7 @@ export default (pageContext) => {
|
||||
routeParams: {
|
||||
username: matched.params.username,
|
||||
stashSlug: matched.params.stashSlug,
|
||||
domain: matched.params.domain,
|
||||
scope: matched.params.scope || 'stashed',
|
||||
page: matched.params.page || '1',
|
||||
path,
|
||||
10
pages/stashes/@username/@stashSlug/scenes/+Page.vue
Normal file
10
pages/stashes/@username/@stashSlug/scenes/+Page.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<Stash>
|
||||
<Scenes />
|
||||
</Stash>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Stash from '#/components/stashes/stash.vue';
|
||||
import Scenes from '#/components/scenes/scenes.vue';
|
||||
</script>
|
||||
24
pages/stashes/@username/@stashSlug/scenes/+route.js
Normal file
24
pages/stashes/@username/@stashSlug/scenes/+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?/:scope?/: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 || 'scenes',
|
||||
scope: matched.params.scope || 'stashed',
|
||||
page: matched.params.page || '1',
|
||||
path,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user