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

60 lines
1.3 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><MkPageHeader/></template>
2023-05-19 10:20:53 +03:00
<MkSpacer :contentMax="1200">
<MkAchievements :user="$i"/>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { onActivated, onDeactivated, onMounted, onUnmounted } from 'vue';
import MkAchievements from '@/components/MkAchievements.vue';
2023-09-19 10:37:43 +03:00
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { $i } from '@/account.js';
import { claimAchievement } from '@/scripts/achievements.js';
2023-01-21 09:06:49 +02:00
let timer: number | null;
2023-01-21 09:06:49 +02: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 09:06:49 +02:00
});
onActivated(() => {
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
});
onDeactivated(() => {
if (timer != null) {
window.clearTimeout(timer);
timer = null;
}
2023-01-21 09:06:49 +02:00
});
definePageMetadata({
title: i18n.ts.achievements,
2023-01-24 07:10:26 +02:00
icon: 'ti ti-medal',
});
</script>
<style lang="scss" module>
</style>