From a80003cde57da44b39189e32d43c5297f963f0cf Mon Sep 17 00:00:00 2001
From: tamaina <tamaina@hotmail.co.jp>
Date: Sun, 28 May 2023 20:58:39 +0900
Subject: [PATCH] =?UTF-8?q?fix(frontend):=20Zen=20UI=E3=81=A7=E3=80=81?=
 =?UTF-8?q?=E3=83=87=E3=83=83=E3=82=AD=E8=A8=AD=E5=AE=9A=E3=81=A7=E7=9B=B4?=
 =?UTF-8?q?=E6=8E=A5/=E4=BB=A5=E5=A4=96=E3=82=92=E8=A1=A8=E7=A4=BA?=
 =?UTF-8?q?=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=83=87=E3=83=83=E3=82=AD?=
 =?UTF-8?q?=E3=81=AB=E6=88=BB=E3=82=8B=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92?=
 =?UTF-8?q?=E8=A1=A8=E7=A4=BA=20(#10909)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* fix(frontend): デッキ設定で直接/以外を表示したときのZen UIでデッキに戻るボタン

* fix style

* ?zenが指定されていた場合はボタンを表示しない
---
 packages/frontend/src/ui/zen.vue | 44 ++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/packages/frontend/src/ui/zen.vue b/packages/frontend/src/ui/zen.vue
index e656f00bb2..d516a5df75 100644
--- a/packages/frontend/src/ui/zen.vue
+++ b/packages/frontend/src/ui/zen.vue
@@ -1,9 +1,17 @@
 <template>
-<div :class="$style.root" style="container-type: inline-size;">
+<div :class="showBottom ? $style.rootWithBottom : $style.root" style="container-type: inline-size;">
 	<RouterView/>
 
 	<XCommon/>
 </div>
+
+<!--
+	デッキUIが設定されている場合はデッキUIに戻れるようにする (ただし?zenが明示された場合は表示しない)
+	See https://github.com/misskey-dev/misskey/issues/10905
+-->
+<div v-if="showBottom" :class="$style.bottom">
+	<button v-tooltip="i18n.ts.goToMisskey" :class="['_button', '_shadow', $style.button]" @click="goToMisskey"><i class="ti ti-home"></i></button>
+</div>
 </template>
 
 <script lang="ts" setup>
@@ -11,10 +19,13 @@ import { provide, ComputedRef } from 'vue';
 import XCommon from './_common_/common.vue';
 import { mainRouter } from '@/router';
 import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
-import { instanceName } from '@/config';
+import { instanceName, ui } from '@/config';
+import { i18n } from '@/i18n';
 
 let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
 
+const showBottom = !(new URLSearchParams(location.search)).has('zen') && ui === 'deck';
+
 provide('router', mainRouter);
 provideMetadataReceiver((info) => {
 	pageMetadata = info;
@@ -23,6 +34,10 @@ provideMetadataReceiver((info) => {
 	}
 });
 
+function goToMisskey() {
+	window.location.href = '/';
+}
+
 document.documentElement.style.overflowY = 'scroll';
 </script>
 
@@ -31,4 +46,29 @@ document.documentElement.style.overflowY = 'scroll';
 	min-height: 100dvh;
 	box-sizing: border-box;
 }
+
+.rootWithBottom {
+	min-height: calc(100dvh - (60px + (var(--margin) * 2) + env(safe-area-inset-bottom, 0px)));
+	box-sizing: border-box;
+}
+
+.bottom {
+	height: calc(60px + (var(--margin) * 2) + env(safe-area-inset-bottom, 0px));
+	width: 100%;
+	margin-top: auto;
+}
+
+.button {
+	position: fixed !important;
+	padding: 0;
+	aspect-ratio: 1;
+	width: 100%;
+	max-width: 60px;
+	margin: auto;
+	border-radius: 100%;
+	background: var(--panel);
+	color: var(--fg);
+	right: var(--margin);
+	bottom: calc(var(--margin) + env(safe-area-inset-bottom, 0px));
+}
 </style>