egirlskey/packages/frontend/src/pages/welcome.timeline.vue
2022-12-30 13:56:22 +09:00

99 lines
2 KiB
Vue

<template>
<div class="civpbkhh">
<div ref="scroll" class="scrollbox" v-bind:class="{ scroll: isScrolling }">
<div v-for="note in notes" class="note">
<div class="content _panel">
<div class="body">
<MkA v-if="note.replyId" class="reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></MkA>
<Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i"/>
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
</div>
<div v-if="note.files.length > 0" class="richcontent">
<MkMediaList :media-list="note.files"/>
</div>
<div v-if="note.poll">
<MkPoll :note="note" :readOnly="true"/>
</div>
</div>
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
import MkMediaList from '@/components/MkMediaList.vue';
import MkPoll from '@/components/MkPoll.vue';
import * as os from '@/os';
export default defineComponent({
components: {
MkReactionsViewer,
MkMediaList,
MkPoll,
},
data() {
return {
notes: [],
isScrolling: false,
};
},
created() {
os.api('notes/featured').then(notes => {
this.notes = notes;
});
},
updated() {
if (this.$refs.scroll.clientHeight > window.innerHeight) {
this.isScrolling = true;
}
},
});
</script>
<style lang="scss" scoped>
@keyframes scroll {
0% {
transform: translate3d(0, 0, 0);
}
5% {
transform: translate3d(0, 0, 0);
}
75% {
transform: translate3d(0, calc(-100% + 90vh), 0);
}
90% {
transform: translate3d(0, calc(-100% + 90vh), 0);
}
}
.civpbkhh {
text-align: right;
> .scrollbox {
&.scroll {
animation: scroll 45s linear infinite;
}
> .note {
margin: 16px 0 16px auto;
> .content {
padding: 16px;
margin: 0 0 0 auto;
max-width: max-content;
border-radius: 16px;
> .richcontent {
min-width: 250px;
}
}
}
}
}
</style>