2023-01-21 08:57:23 +01:00
|
|
|
<template>
|
|
|
|
<MkSpacer :content-max="1200">
|
2023-01-23 08:40:31 +01:00
|
|
|
<MkAchievements :user="user" :with-locked="false" :with-description="$i != null && (props.user.id === $i.id)"/>
|
2023-01-21 08:57:23 +01:00
|
|
|
</MkSpacer>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-02-16 15:09:41 +01:00
|
|
|
import { onActivated, onDeactivated, onMounted, onUnmounted } from 'vue';
|
2023-01-21 08:57:23 +01:00
|
|
|
import * as misskey from 'misskey-js';
|
|
|
|
import MkAchievements from '@/components/MkAchievements.vue';
|
|
|
|
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>
|