misskey/packages/frontend/src/pages/achievements.vue

55 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<MkStickyContainer>
<template #header><MkPageHeader/></template>
<MkSpacer :content-max="1200">
<MkAchievements :user="$i"/>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
2023-01-21 08:06:49 +01:00
import { onActivated, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
import MkAchievements from '@/components/MkAchievements.vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { $i } from '@/account';
2023-01-21 08:06:49 +01:00
import { claimAchievement } from '@/scripts/achievements';
let timer: number | null;
2023-01-21 08:06:49 +01:00
function viewAchievements3min() {
claimAchievement('viewAchievements3min');
}
onMounted(() => {
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
});
onUnmounted(() => {
if (timer != null) {
window.clearTimeout(timer);
timer = null;
}
2023-01-21 08:06:49 +01:00
});
onActivated(() => {
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
});
onDeactivated(() => {
if (timer != null) {
window.clearTimeout(timer);
timer = null;
}
2023-01-21 08:06:49 +01:00
});
definePageMetadata({
title: i18n.ts.achievements,
2023-01-24 06:10:26 +01:00
icon: 'ti ti-medal',
});
</script>
<style lang="scss" module>
</style>