mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-25 07:37:13 +09:00
ユーザーの実績一覧を見れるように
This commit is contained in:
parent
8dc0e0abbb
commit
3bf775c9a8
@ -15,7 +15,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
|
|||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
import { claimAchievement } from '@/scripts/achievements';
|
import { claimAchievement } from '@/scripts/achievements';
|
||||||
|
|
||||||
let timer;
|
let timer: number | null;
|
||||||
|
|
||||||
function viewAchievements3min() {
|
function viewAchievements3min() {
|
||||||
claimAchievement('viewAchievements3min');
|
claimAchievement('viewAchievements3min');
|
||||||
@ -26,8 +26,10 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.clearTimeout(timer);
|
if (timer != null) {
|
||||||
timer = null;
|
window.clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(() => {
|
onActivated(() => {
|
||||||
@ -35,8 +37,10 @@ onActivated(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onDeactivated(() => {
|
onDeactivated(() => {
|
||||||
window.clearTimeout(timer);
|
if (timer != null) {
|
||||||
timer = null;
|
window.clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
definePageMetadata({
|
definePageMetadata({
|
||||||
|
52
packages/frontend/src/pages/user/achievements.vue
Normal file
52
packages/frontend/src/pages/user/achievements.vue
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<MkSpacer :content-max="1200">
|
||||||
|
<MkAchievements :user="user" :with-locked="false"/>
|
||||||
|
</MkSpacer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onActivated, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
|
import MkAchievements from '@/components/MkAchievements.vue';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import { claimAchievement } from '@/scripts/achievements';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
user: misskey.entities.User;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
let timer: number | null;
|
||||||
|
|
||||||
|
function viewAchievements3min() {
|
||||||
|
if ($i && (props.user.id === $i.id)) {
|
||||||
|
claimAchievement('viewAchievements3min');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (timer != null) {
|
||||||
|
window.clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onActivated(() => {
|
||||||
|
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
onDeactivated(() => {
|
||||||
|
if (timer != null) {
|
||||||
|
window.clearTimeout(timer);
|
||||||
|
timer = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
|
||||||
|
</style>
|
@ -6,6 +6,7 @@
|
|||||||
<div v-if="user">
|
<div v-if="user">
|
||||||
<XHome v-if="tab === 'home'" :user="user"/>
|
<XHome v-if="tab === 'home'" :user="user"/>
|
||||||
<XActivity v-else-if="tab === 'activity'" :user="user"/>
|
<XActivity v-else-if="tab === 'activity'" :user="user"/>
|
||||||
|
<XAchievements v-else-if="tab === 'achievements'" :user="user"/>
|
||||||
<XReactions v-else-if="tab === 'reactions'" :user="user"/>
|
<XReactions v-else-if="tab === 'reactions'" :user="user"/>
|
||||||
<XClips v-else-if="tab === 'clips'" :user="user"/>
|
<XClips v-else-if="tab === 'clips'" :user="user"/>
|
||||||
<XPages v-else-if="tab === 'pages'" :user="user"/>
|
<XPages v-else-if="tab === 'pages'" :user="user"/>
|
||||||
@ -34,6 +35,7 @@ import { $i } from '@/account';
|
|||||||
|
|
||||||
const XHome = defineAsyncComponent(() => import('./home.vue'));
|
const XHome = defineAsyncComponent(() => import('./home.vue'));
|
||||||
const XActivity = defineAsyncComponent(() => import('./activity.vue'));
|
const XActivity = defineAsyncComponent(() => import('./activity.vue'));
|
||||||
|
const XAchievements = defineAsyncComponent(() => import('./achievements.vue'));
|
||||||
const XReactions = defineAsyncComponent(() => import('./reactions.vue'));
|
const XReactions = defineAsyncComponent(() => import('./reactions.vue'));
|
||||||
const XClips = defineAsyncComponent(() => import('./clips.vue'));
|
const XClips = defineAsyncComponent(() => import('./clips.vue'));
|
||||||
const XPages = defineAsyncComponent(() => import('./pages.vue'));
|
const XPages = defineAsyncComponent(() => import('./pages.vue'));
|
||||||
@ -76,7 +78,11 @@ const headerTabs = $computed(() => user ? [{
|
|||||||
key: 'activity',
|
key: 'activity',
|
||||||
title: i18n.ts.activity,
|
title: i18n.ts.activity,
|
||||||
icon: 'ti ti-chart-line',
|
icon: 'ti ti-chart-line',
|
||||||
}, ...($i && ($i.id === user.id)) || user.publicReactions ? [{
|
}, ...(user.host == null ? [{
|
||||||
|
key: 'achievements',
|
||||||
|
title: i18n.ts.achievements,
|
||||||
|
icon: 'ti ti-military-award',
|
||||||
|
}] : []), ...($i && ($i.id === user.id)) || user.publicReactions ? [{
|
||||||
key: 'reactions',
|
key: 'reactions',
|
||||||
title: i18n.ts.reaction,
|
title: i18n.ts.reaction,
|
||||||
icon: 'ti ti-mood-happy',
|
icon: 'ti ti-mood-happy',
|
||||||
|
Loading…
Reference in New Issue
Block a user