style(components): fix formatting on story listing components
This commit is contained in:
parent
dd30f08d9a
commit
6f770a1cb8
@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = defineProps<{ label?: string }>()
|
const props = defineProps<{ label?: string }>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<b>{{ label }}</b>: <slot/>
|
<b>{{ label }}</b> : <slot />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,240 +1,268 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { IStory } from "~/models/stories/index";
|
import type { IStory } from "~/models/stories/index";
|
||||||
import { format } from "date-fns";
|
import { log } from "~/lib/server/logger";
|
||||||
import icon from "../icon.vue";
|
import { format } from "date-fns";
|
||||||
import { theme } from "ant-design-vue";
|
import icon from "../icon.vue";
|
||||||
import metaItem from "./metaItem.vue";
|
import { theme } from "ant-design-vue";
|
||||||
|
import metaItem from "./metaItem.vue";
|
||||||
const { useToken } = theme;
|
|
||||||
const { token } = useToken()
|
const { useToken } = theme;
|
||||||
const dark = inject<Ref<boolean>>("dark")
|
const { token } = useToken();
|
||||||
let prop = defineProps<{ story: IStory, last?: boolean }>()
|
const dark = inject<Ref<boolean>>("dark");
|
||||||
const idxo = ((prop.last || false) ? prop.story.chapters.length : 1) - 1
|
let prop = defineProps<{ story: IStory; last?: boolean }>();
|
||||||
console.log("posti->", prop.story.chapters[ prop.story.chapters.length - 1 ])
|
const idxo = (prop.last || false ? prop.story.chapters.length : 1) - 1;
|
||||||
const shortDate = format(Date.parse(
|
// log.debug("posti->", prop.story.chapters[ prop.story.chapters.length - 1 ]);
|
||||||
prop.story.chapters[ prop.story.chapters.length - 1 ].posted.toString()
|
const shortDate = format(
|
||||||
),
|
Date.parse(
|
||||||
"yyyy/MM/dd"
|
prop.story.chapters[prop.story.chapters.length - 1]?.posted!.toString(),
|
||||||
)
|
),
|
||||||
const longDate = format(Date.parse(
|
"yyyy/MM/dd",
|
||||||
prop.story.chapters[ prop.story.chapters.length - 1 ].posted.toString()
|
);
|
||||||
),
|
const longDate = format(
|
||||||
"iiii',' yyyy-MM-dd"
|
Date.parse(
|
||||||
)
|
prop.story.chapters[prop.story.chapters.length - 1]?.posted!.toString(),
|
||||||
</script>
|
),
|
||||||
<template>
|
"iiii',' yyyy-MM-dd",
|
||||||
<a-card>
|
);
|
||||||
<template #title>
|
</script>
|
||||||
<div style="padding-top: 1em; padding-bottom: 0.8em;">
|
<template>
|
||||||
<NuxtLink :to="`/story/${story._id}/${idxo + 1}`">
|
<a-card>
|
||||||
{{ story.title }}
|
<template #title>
|
||||||
</NuxtLink>
|
<div style="padding-top: 1em; padding-bottom: 0.8em">
|
||||||
<div style="display: flex; font-size: 0.9em; align-items: baseline;" class="headerthing">
|
<NuxtLink :to="`/story/${story._id}/${idxo + 1}`">
|
||||||
<span>
|
{{ story.title }}
|
||||||
a
|
</NuxtLink>
|
||||||
</span>
|
<div
|
||||||
<div style="" v-for="(band, idx) in story.chapters[ idxo ].bands.filter(a => !!a)">
|
style="display: flex; font-size: 0.9em; align-items: baseline"
|
||||||
<span>
|
class="headerthing"
|
||||||
<NuxtLink :to="`/band/${band._id}`">
|
>
|
||||||
{{ band.name }}
|
<span> a </span>
|
||||||
</NuxtLink>{{ idx < story.chapters[ idxo ].bands.length - 1 ? ", " : "" }}
|
<div
|
||||||
</span>
|
style=""
|
||||||
</div>
|
v-for="(band, idx) in story.chapters[idxo].bands.filter((a) => !!a)"
|
||||||
<span>
|
>
|
||||||
fic by
|
<span>
|
||||||
</span>
|
<NuxtLink :to="`/band/${band._id}`"> {{ band.name }} </NuxtLink
|
||||||
<span>
|
>{{ idx < story.chapters[idxo].bands.length - 1 ? ", " : "" }}
|
||||||
<NuxtLink :to="`/user/${story.author._id}`">
|
</span>
|
||||||
{{ story.author.username }}
|
</div>
|
||||||
</NuxtLink>
|
<span> fic by </span>
|
||||||
</span>
|
<span>
|
||||||
</div>
|
<NuxtLink :to="`/user/${story.author._id}`">
|
||||||
</div>
|
{{ story.author.username }}
|
||||||
</template>
|
</NuxtLink>
|
||||||
<div v-html="story.chapters[ idxo ].summary"/>
|
</span>
|
||||||
<a-card v-if="story.ficmas != null" class="ficmasBlurb lessPadding">
|
</div>
|
||||||
Written as a gift for
|
</div>
|
||||||
<NuxtLink :to="`/user/${story.ficmas.wisher?._id || 1}`">
|
</template>
|
||||||
{{ story.ficmas.wisher?.username || "<...>" }}
|
<div v-html="story.chapters[idxo].summary" />
|
||||||
</NuxtLink> as part of {{ story.ficmas.year }}’s
|
<a-card v-if="story.ficmas != null" class="ficmasBlurb lessPadding">
|
||||||
<span v-if="story.ficmas.anniversary">
|
Written as a gift for
|
||||||
Anniversary Ficmas Fest
|
<NuxtLink :to="`/user/${story.ficmas.wisher?._id || 1}`">
|
||||||
</span>
|
{{ story.ficmas.wisher?.username || "<...>" }}
|
||||||
<span v-else>
|
</NuxtLink>
|
||||||
A Very Kinky Rockfic Ficmas Fest.
|
as part of {{ story.ficmas.year }}’s
|
||||||
</span>
|
<span v-if="story.ficmas.anniversary"> Anniversary Ficmas Fest </span>
|
||||||
</a-card>
|
<span v-else> A Very Kinky Rockfic Ficmas Fest. </span>
|
||||||
<a-card v-if="story.challenge != null" :style="{
|
</a-card>
|
||||||
background: story.challenge.color
|
<a-card
|
||||||
}" class="lessPadding">
|
v-if="story.challenge != null"
|
||||||
Entry for the
|
:style="{
|
||||||
<NuxtLink :to="`/challenge/${story.challenge._id}`">
|
background: story.challenge.color,
|
||||||
{{ story.challenge.name }}
|
}"
|
||||||
</NuxtLink>
|
class="lessPadding"
|
||||||
challenge.
|
>
|
||||||
</a-card>
|
Entry for the
|
||||||
<a-divider :style="{ borderColor: token[ 'pink-5' ], marginBottom: '1em' }"/>
|
<NuxtLink :to="`/challenge/${story.challenge._id}`">
|
||||||
<div class="storyMeta">
|
{{ story.challenge.name }}
|
||||||
<div class="inner">
|
</NuxtLink>
|
||||||
<span v-if="story.chapters.length > 1">
|
challenge.
|
||||||
<NuxtLink :to="`/story/${story._id}/chapters`">
|
</a-card>
|
||||||
{{ story.chapters.length }} chapters
|
<a-divider :style="{ borderColor: token['pink-5'], marginBottom: '1em' }" />
|
||||||
</NuxtLink>
|
<div class="storyMeta">
|
||||||
</span>
|
<div class="inner">
|
||||||
<span v-else>
|
<span v-if="story.chapters.length > 1">
|
||||||
{{ story.chapters.length }} chapter
|
<NuxtLink :to="`/story/${story._id}/chapters`">
|
||||||
</span>
|
{{ story.chapters.length }} chapters
|
||||||
<span>
|
</NuxtLink>
|
||||||
{{ story.chapters[ idxo ].nsfw ? "Adult" : "Not so adult" }}
|
</span>
|
||||||
</span>
|
<span v-else> {{ story.chapters.length }} chapter </span>
|
||||||
<span>
|
<span>
|
||||||
{{ story.completed ? "Completed" : "WIP" }}
|
{{ story.chapters[idxo].nsfw ? "Adult" : "Not so adult" }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<span>
|
||||||
|
{{ story.completed ? "Completed" : "WIP" }}
|
||||||
<div class="outer">
|
</span>
|
||||||
<meta-item :span="1" label="Genre(s)">
|
</div>
|
||||||
{{ story.chapters[ idxo ].genre.join(", ") }}
|
|
||||||
</meta-item>
|
<div class="outer">
|
||||||
<meta-item label="Characters">
|
<meta-item :span="1" label="Genre(s)">
|
||||||
{{ story.chapters[ idxo ].characters.join(", ") }}
|
{{ story.chapters[idxo].genre.join(", ") }}
|
||||||
</meta-item>
|
</meta-item>
|
||||||
<meta-item label="Relationship(s)">
|
<meta-item label="Characters">
|
||||||
<div style="display: inline-block" v-for="(rel, idx) in story.chapters[ idxo ].relationships">
|
{{ story.chapters[idxo].characters.join(", ") }}
|
||||||
<span>
|
</meta-item>
|
||||||
{{ Array.isArray(rel) ? rel.join("/") : rel }}
|
<meta-item label="Relationship(s)">
|
||||||
{{ idx < story.chapters[ idxo ].relationships.length - 1 ? "," : "" }}
|
<div
|
||||||
</span>
|
style="display: inline-block"
|
||||||
</div>
|
v-for="(rel, idx) in story.chapters[idxo].relationships"
|
||||||
<span v-if="story.chapters[ idxo ].relationships.length < 1">
|
>
|
||||||
<i>N/A</i>
|
<span>
|
||||||
</span>
|
{{ Array.isArray(rel) ? rel.join("/") : rel }}
|
||||||
</meta-item>
|
{{
|
||||||
<meta-item label="Last updated">
|
idx < story.chapters[idxo].relationships.length - 1 ? "," : ""
|
||||||
<a-tooltip>
|
}}
|
||||||
<template #title>
|
</span>
|
||||||
{{ longDate }}
|
</div>
|
||||||
</template>
|
<span v-if="story.chapters[idxo].relationships.length < 1">
|
||||||
{{ shortDate }}
|
<i>N/A</i>
|
||||||
</a-tooltip>
|
</span>
|
||||||
</meta-item>
|
</meta-item>
|
||||||
</div>
|
<meta-item label="Last updated">
|
||||||
</div>
|
<a-tooltip>
|
||||||
<div class="stats">
|
<template #title>
|
||||||
<span>
|
{{ longDate }}
|
||||||
<span class="staticon">
|
</template>
|
||||||
<icon :istyle="!dark ? 'solid' : 'regular'" icolor="#ff2883" :size="12" name="heart"/>
|
{{ shortDate }}
|
||||||
</span>
|
</a-tooltip>
|
||||||
<span>
|
</meta-item>
|
||||||
{{ story.favs }}
|
</div>
|
||||||
</span>
|
</div>
|
||||||
</span>
|
<div class="stats">
|
||||||
<span>
|
<span>
|
||||||
<span class="staticon">
|
<span class="staticon">
|
||||||
<icon :istyle="!dark ? 'solid' : 'regular'" icolor="#1787d7" :size="12" name="book-open" />
|
<icon
|
||||||
</span>
|
:istyle="!dark ? 'solid' : 'regular'"
|
||||||
<span>
|
icolor="#ff2883"
|
||||||
{{ story.views }}
|
:size="12"
|
||||||
</span>
|
name="heart"
|
||||||
</span>
|
/>
|
||||||
<span>
|
</span>
|
||||||
<span class="staticon">
|
<span>
|
||||||
<icon :istyle="!dark ? 'solid' : 'regular'" icolor="#51e07c" :size="12" name="thumbs-up" />
|
{{ story.favs }}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
</span>
|
||||||
{{ story.recs }}
|
<span>
|
||||||
</span>
|
<span class="staticon">
|
||||||
</span>
|
<icon
|
||||||
<span>
|
:istyle="!dark ? 'solid' : 'regular'"
|
||||||
<span class="staticon">
|
icolor="#1787d7"
|
||||||
<icon :istyle="!dark ? 'solid' : 'regular'" icolor="#c2d420" :size="12" name="download" />
|
:size="12"
|
||||||
</span>
|
name="book-open"
|
||||||
<span>
|
/>
|
||||||
{{ story.downloads }}
|
</span>
|
||||||
</span>
|
<span>
|
||||||
</span>
|
{{ story.views }}
|
||||||
<span>
|
</span>
|
||||||
<span class="staticon">
|
</span>
|
||||||
<icon istyle="solid" icolor="#0083aa" :size="12" name="comment" />
|
<span>
|
||||||
</span>
|
<span class="staticon">
|
||||||
<span>
|
<icon
|
||||||
{{ story.reviews }}
|
:istyle="!dark ? 'solid' : 'regular'"
|
||||||
</span>
|
icolor="#51e07c"
|
||||||
</span>
|
:size="12"
|
||||||
</div>
|
name="thumbs-up"
|
||||||
</a-card>
|
/>
|
||||||
</template>
|
</span>
|
||||||
<style>
|
<span>
|
||||||
.lessPadding>.ant-card-body {
|
{{ story.recs }}
|
||||||
padding: 0.8em !important;
|
</span>
|
||||||
}
|
</span>
|
||||||
|
<span>
|
||||||
.ant-descriptions-view tr {
|
<span class="staticon">
|
||||||
border: none;
|
<icon
|
||||||
}
|
:istyle="!dark ? 'solid' : 'regular'"
|
||||||
|
icolor="#c2d420"
|
||||||
.ant-descriptions-item {
|
:size="12"
|
||||||
padding-bottom: 0 !important;
|
name="download"
|
||||||
}
|
/>
|
||||||
|
</span>
|
||||||
.storyMeta .ant-descriptions-item-container,
|
<span>
|
||||||
.storyMeta .ant-descriptions-item-container>* {
|
{{ story.downloads }}
|
||||||
font-size: 1em !important;
|
</span>
|
||||||
}
|
</span>
|
||||||
</style>
|
<span>
|
||||||
<style scoped>
|
<span class="staticon">
|
||||||
.stats {
|
<icon istyle="solid" icolor="#0083aa" :size="12" name="comment" />
|
||||||
padding-top: 0.25em;
|
</span>
|
||||||
}
|
<span>
|
||||||
|
{{ story.reviews }}
|
||||||
.stats>*+* {
|
</span>
|
||||||
margin-left: 0.5em;
|
</span>
|
||||||
}
|
</div>
|
||||||
|
</a-card>
|
||||||
.stats>*>*+* {
|
</template>
|
||||||
margin-left: 0.5em;
|
<style>
|
||||||
}
|
.lessPadding > .ant-card-body {
|
||||||
|
padding: 0.8em !important;
|
||||||
.headerthing>*+* {
|
}
|
||||||
margin-left: 0.3em;
|
|
||||||
font-size: 0.9em !important;
|
.ant-descriptions-view tr {
|
||||||
}
|
border: none;
|
||||||
|
}
|
||||||
hr {
|
|
||||||
background-color: #aaa !important;
|
.ant-descriptions-item {
|
||||||
border: none !important;
|
padding-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ficmasBlurb {
|
.storyMeta .ant-descriptions-item-container,
|
||||||
background-color: #13b658;
|
.storyMeta .ant-descriptions-item-container > * {
|
||||||
color: white;
|
font-size: 1em !important;
|
||||||
/* border-radius: */
|
}
|
||||||
}
|
</style>
|
||||||
|
<style scoped>
|
||||||
.ficmasBlurb a {
|
.stats {
|
||||||
color: #000;
|
padding-top: 0.25em;
|
||||||
font-weight: bold;
|
}
|
||||||
}
|
|
||||||
|
.stats > * + * {
|
||||||
.ficmasBlurb a:hover {
|
margin-left: 0.5em;
|
||||||
text-decoration: underline;
|
}
|
||||||
}
|
|
||||||
|
.stats > * > * + * {
|
||||||
.storyMeta {
|
margin-left: 0.5em;
|
||||||
display: flex;
|
}
|
||||||
flex-direction: column;
|
|
||||||
font-size: 0.857em !important;
|
.headerthing > * + * {
|
||||||
}
|
margin-left: 0.3em;
|
||||||
|
font-size: 0.9em !important;
|
||||||
.storyMeta .outer {
|
}
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
hr {
|
||||||
margin-top: 0.5em;
|
background-color: #aaa !important;
|
||||||
}
|
border: none !important;
|
||||||
|
}
|
||||||
.storyMeta .inner>*+*::before {
|
|
||||||
content: "♪";
|
.ficmasBlurb {
|
||||||
color: #ff2883;
|
background-color: #13b658;
|
||||||
margin: 0 0.7em;
|
color: white;
|
||||||
}
|
/* border-radius: */
|
||||||
</style>
|
}
|
||||||
|
|
||||||
|
.ficmasBlurb a {
|
||||||
|
color: #000;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ficmasBlurb a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.storyMeta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
font-size: 0.857em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.storyMeta .outer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.storyMeta .inner > * + *::before {
|
||||||
|
content: "♪";
|
||||||
|
color: #ff2883;
|
||||||
|
margin: 0 0.7em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -1,52 +1,63 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
;
|
import singleStory from "~/components/listings/singleStory.vue";
|
||||||
import singleStory from '~/components/listings/singleStory.vue';
|
import { IStory } from "~/models/stories";
|
||||||
const route = useRoute()
|
const route = useRoute();
|
||||||
let curPage = ref(route.query.page || 1)
|
let curPage = ref(route.query.page || 1);
|
||||||
const props = defineProps<{ prefix: string; }>()
|
const props = defineProps<{ prefix?: string; items?: IStory[] }>();
|
||||||
let { data }: any = await useApiFetch(`${props.prefix}/stories`, {
|
let data;
|
||||||
query: {
|
if (!props.prefix) {
|
||||||
page: curPage
|
data = props.items;
|
||||||
}
|
} else if (!props.items) {
|
||||||
})
|
data = (
|
||||||
let rdata = ref(data)
|
await useApiFetch<any>(`${props.prefix}`, {
|
||||||
const pagiChange = async (page, pageSize) => {
|
query: {
|
||||||
curPage.value = page;
|
page: curPage,
|
||||||
// await navigateTo({
|
},
|
||||||
// path: useRoute().fullPath,
|
})
|
||||||
// query: {
|
).data;
|
||||||
// page
|
}
|
||||||
// }
|
let rdata = ref(data);
|
||||||
// })
|
const pagiChange = async (page, pageSize) => {
|
||||||
// let { data }: any = await useApiFetch(`${props.prefix}/stories`, {
|
curPage.value = page;
|
||||||
// query: {
|
// await navigateTo({
|
||||||
// page: curPage
|
// path: useRoute().fullPath,
|
||||||
// }
|
// query: {
|
||||||
// })
|
// page
|
||||||
// rdata.value = data;
|
// }
|
||||||
}
|
// })
|
||||||
</script>
|
// let {data: data } = await useApiFetch(`${props.prefix}/stories`, {
|
||||||
<template>
|
// query: {
|
||||||
<a-list :pagination="{
|
// page: curPage
|
||||||
defaultPageSize: 20,
|
// }
|
||||||
total: rdata.total,
|
// })
|
||||||
defaultCurrent: curPage as number,
|
// rdata.value = data;
|
||||||
// onChange: pagiChange,
|
};
|
||||||
hideOnSinglePage: true,
|
</script>
|
||||||
showSizeChanger: false
|
<template>
|
||||||
}" :data-source="rdata.stories" item-layout="vertical">
|
<a-list
|
||||||
<template #renderItem="{ item }">
|
:pagination="{
|
||||||
<!-- {{ item.title }} -->
|
defaultPageSize: 20,
|
||||||
<single-story :story="item"/>
|
total: rdata.total,
|
||||||
</template>
|
defaultCurrent: curPage as number,
|
||||||
</a-list>
|
// onChange: pagiChange,
|
||||||
</template>
|
hideOnSinglePage: true,
|
||||||
<style scoped>
|
showSizeChanger: false,
|
||||||
.ant-list-items>*+* {
|
}"
|
||||||
margin-top: 1.2em;
|
:data-source="rdata.stories"
|
||||||
}
|
item-layout="vertical"
|
||||||
|
>
|
||||||
.ant-pagination {
|
<template #renderItem="{ item }">
|
||||||
text-align: center;
|
<!-- {{ item.title }} -->
|
||||||
}
|
<single-story :story="item" />
|
||||||
</style>
|
</template>
|
||||||
|
</a-list>
|
||||||
|
</template>
|
||||||
|
<style scoped>
|
||||||
|
.ant-list-items > * + * {
|
||||||
|
margin-top: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-pagination {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user