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