2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
2024-02-13 17:59:27 +02:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 08:31:52 +03:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2023-01-21 09:57:23 +02:00
|
|
|
<template>
|
2023-05-19 14:52:15 +03:00
|
|
|
<MkSpacer :contentMax="1200">
|
|
|
|
<MkAchievements :user="user" :withLocked="false" :withDescription="$i != null && (props.user.id === $i.id)"/>
|
2023-01-21 09:57:23 +02:00
|
|
|
</MkSpacer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 16:09:41 +02:00
|
|
|
import { onActivated, onDeactivated, onMounted, onUnmounted } from 'vue';
|
2023-09-04 07:33:38 +03:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-01-21 09:57:23 +02:00
|
|
|
import MkAchievements from '@/components/MkAchievements.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { claimAchievement } from '@/scripts/achievements.js';
|
|
|
|
import { $i } from '@/account.js';
|
2023-01-21 09:57:23 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
2023-09-04 07:33:38 +03:00
|
|
|
user: Misskey.entities.User;
|
2023-01-21 09:57:23 +02:00
|
|
|
}>();
|
|
|
|
|
|
|
|
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>
|