トップページを強化
This commit is contained in:
parent
feca9940bc
commit
97165fbaf5
3 changed files with 107 additions and 10 deletions
|
@ -1,9 +1,27 @@
|
|||
<template>
|
||||
<div class="rsqzvsbo _section" v-if="meta">
|
||||
<h2># {{ $t('pinnedNotes') }}</h2>
|
||||
<MkPagination :pagination="pagination" #default="{items}">
|
||||
<XNote class="kmkqjgkl" v-for="note in items" :note="note" :key="note.id"/>
|
||||
</MkPagination>
|
||||
<div class="overview _monospace" v-if="stats">
|
||||
<div class="stats">
|
||||
<div><span>Users</span><span>{{ number(stats.originalUsersCount) }}</span></div>
|
||||
<div><span>Notes</span><span>{{ number(stats.originalNotesCount) }}</span></div>
|
||||
<div><span>Reactions</span><span>{{ number(stats.reactionsCount) }}</span></div>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<MkA class="tag" v-for="tag in tags" :to="`/tags/${encodeURIComponent(tag.tag)}`">#{{ tag.tag }}</MkA>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="meta.pinnedClipId">
|
||||
<h2># {{ $t('pinnedNotes') }}</h2>
|
||||
<MkPagination :pagination="clipPagination" #default="{items}">
|
||||
<XNote class="kmkqjgkl" v-for="note in items" :note="note" :key="note.id"/>
|
||||
</MkPagination>
|
||||
</template>
|
||||
<template v-else>
|
||||
<h2># {{ $t('featured') }}</h2>
|
||||
<MkPagination :pagination="featuredPagination" #default="{items}">
|
||||
<XNote class="kmkqjgkl" v-for="note in items" :note="note" :key="note.id"/>
|
||||
</MkPagination>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -17,6 +35,7 @@ import XNote from '@/components/note.vue';
|
|||
import MkPagination from '@/components/ui/pagination.vue';
|
||||
import { host, instanceName } from '@/config';
|
||||
import * as os from '@/os';
|
||||
import number from '@/filters/number';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -30,13 +49,20 @@ export default defineComponent({
|
|||
host: toUnicode(host),
|
||||
instanceName,
|
||||
meta: null,
|
||||
pagination: {
|
||||
stats: null,
|
||||
tags: [],
|
||||
clipPagination: {
|
||||
endpoint: 'clips/notes',
|
||||
limit: 10,
|
||||
params: () => ({
|
||||
clipId: this.meta.pinnedClipId,
|
||||
})
|
||||
},
|
||||
featuredPagination: {
|
||||
endpoint: 'notes/featured',
|
||||
limit: 10,
|
||||
offsetMode: true
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -48,6 +74,13 @@ export default defineComponent({
|
|||
os.api('stats').then(stats => {
|
||||
this.stats = stats;
|
||||
});
|
||||
|
||||
os.api('hashtags/list', {
|
||||
sort: '+mentionedLocalUsers',
|
||||
limit: 8
|
||||
}).then(tags => {
|
||||
this.tags = tags;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -61,7 +94,9 @@ export default defineComponent({
|
|||
os.popup(XSignupDialog, {
|
||||
autoSet: true
|
||||
}, {}, 'closed');
|
||||
}
|
||||
},
|
||||
|
||||
number
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -77,15 +112,64 @@ export default defineComponent({
|
|||
padding: 8px 12px;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
> .overview {
|
||||
> .stats, > .tags {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 530px;
|
||||
padding: 32px;
|
||||
margin: 16px;
|
||||
box-sizing: border-box;
|
||||
|
||||
@media (max-width: 800px) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin: 12px 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .stats {
|
||||
background: var(--accent);
|
||||
border-radius: 12px;
|
||||
color: #fff;
|
||||
font-size: 1.5em;
|
||||
|
||||
> div {
|
||||
display: flex;
|
||||
|
||||
> span:first-child {
|
||||
opacity: 0.7;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
> span:last-child {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .tags {
|
||||
background: var(--panel);
|
||||
border-radius: 12px;
|
||||
color: var(--fg);
|
||||
font-size: 1.5em;
|
||||
|
||||
> .tag {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.kmkqjgkl {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 600px;
|
||||
width: 530px;
|
||||
margin: 16px;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
box-shadow: 0 6px 46px rgb(0 0 0 / 30%);
|
||||
box-shadow: 0 6px 46px rgb(0 0 0 / 25%);
|
||||
border-radius: 12px;
|
||||
|
||||
@media (max-width: 800px) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue