From 9d367882fb7e5fc375b7d14e6409a735e68fca8a Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 21 Jan 2023 15:30:29 +0900
Subject: add some achievements

---
 packages/frontend/src/components/MkPageWindow.vue | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

(limited to 'packages/frontend/src/components/MkPageWindow.vue')

diff --git a/packages/frontend/src/components/MkPageWindow.vue b/packages/frontend/src/components/MkPageWindow.vue
index 25b9da2d0b..d12aafd06d 100644
--- a/packages/frontend/src/components/MkPageWindow.vue
+++ b/packages/frontend/src/components/MkPageWindow.vue
@@ -24,7 +24,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ComputedRef, inject, provide } from 'vue';
+import { ComputedRef, inject, onMounted, onUnmounted, provide } from 'vue';
 import RouterView from '@/components/global/RouterView.vue';
 import MkWindow from '@/components/MkWindow.vue';
 import { popout as _popout } from '@/scripts/popout';
@@ -35,6 +35,8 @@ import { mainRouter, routes } from '@/router';
 import { Router } from '@/nirax';
 import { i18n } from '@/i18n';
 import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata';
+import { openingWindowsCount } from '@/os';
+import { claimAchievement } from '@/scripts/achievements';
 
 const props = defineProps<{
 	initialPath: string;
@@ -128,6 +130,17 @@ function popout() {
 	windowEl.close();
 }
 
+onMounted(() => {
+	openingWindowsCount.value++;
+	if (openingWindowsCount.value >= 3) {
+		claimAchievement('open3windows');
+	}
+});
+
+onUnmounted(() => {
+	openingWindowsCount.value--;
+});
+
 defineExpose({
 	close,
 });
-- 
cgit v1.2.3-freya

