Expanded edit fields. Added revision history to scene and user pages.
This commit is contained in:
@@ -36,6 +36,12 @@
|
||||
class="domain nolink"
|
||||
:class="{ active: domain === 'templates' }"
|
||||
>Templates</a>
|
||||
|
||||
<a
|
||||
:href="`/user/${profile.username}/revisions`"
|
||||
class="domain nolink"
|
||||
:class="{ active: domain === 'revisions' }"
|
||||
>Revisions</a>
|
||||
</nav>
|
||||
|
||||
<Stashes v-if="domain === 'stashes'" />
|
||||
@@ -46,6 +52,14 @@
|
||||
:release="mockupRelease"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="domain === 'revisions' && profile.id === user?.id"
|
||||
class="profile-section revisions"
|
||||
>
|
||||
<h3 class="section-header heading">Revisions</h3>
|
||||
<Revisions />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -56,6 +70,7 @@ import { formatDistanceStrict } from 'date-fns';
|
||||
import Stashes from '#/components/stashes/stashes.vue';
|
||||
import Alerts from '#/components/alerts/alerts.vue';
|
||||
import Summaries from '#/components/scenes/summaries.vue';
|
||||
import Revisions from '#/components/edit/revisions.vue';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const domain = pageContext.routeParams.domain;
|
||||
@@ -125,8 +140,9 @@ const mockupRelease = {
|
||||
<style scoped>
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
background: var(--background-base-10);
|
||||
}
|
||||
|
||||
@@ -200,6 +216,12 @@ const mockupRelease = {
|
||||
}
|
||||
}
|
||||
|
||||
.revisions {
|
||||
width: 100%; /* necessary for FF */
|
||||
box-sizing: border-box;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
@media(--compact) {
|
||||
.domains {
|
||||
padding: .5rem 1rem;
|
||||
|
||||
@@ -3,19 +3,33 @@ import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
|
||||
import { fetchUser } from '#/src/users.js';
|
||||
import { fetchUserStashes } from '#/src/stashes.js';
|
||||
import { fetchAlerts } from '#/src/alerts.js';
|
||||
import { fetchSceneRevisions } from '#/src/scenes.js';
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
const [profile, alerts] = await Promise.all([
|
||||
const [profile, alerts, userRevisions] = await Promise.all([
|
||||
fetchUser(pageContext.routeParams.username, {}, pageContext.user),
|
||||
pageContext.routeParams.username === pageContext.user?.username
|
||||
pageContext.routeParams.domain === 'stashes' && pageContext.routeParams.username === pageContext.user?.username
|
||||
? fetchAlerts(pageContext.user)
|
||||
: [],
|
||||
pageContext.routeParams.domain === 'revisions' && pageContext.routeParams.username === pageContext.user?.username
|
||||
? fetchSceneRevisions(null, {
|
||||
userId: pageContext.user.id,
|
||||
limit: 100,
|
||||
}, pageContext.user)
|
||||
: {},
|
||||
]);
|
||||
|
||||
if (!profile) {
|
||||
throw render(404, `Cannot find user '${pageContext.routeParams.username}'.`);
|
||||
}
|
||||
|
||||
const {
|
||||
revisions,
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
} = userRevisions;
|
||||
|
||||
const stashes = await fetchUserStashes(profile.id, pageContext.user);
|
||||
|
||||
return {
|
||||
@@ -25,6 +39,10 @@ export async function onBeforeRender(pageContext) {
|
||||
profile, // differentiate from authed 'user'
|
||||
stashes,
|
||||
alerts,
|
||||
revisions,
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user