From 0a31e132c74cc2d8029cdadd103ea66a3ce16b6a Mon Sep 17 00:00:00 2001 From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 27 Apr 2024 16:48:04 +0900 Subject: fix(frontend): PlayのAiScriptランタイムが停止したときに画面が初期化されていない問題を修正 (#13747) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): PlayのAiScriptランタイムが停止したときに画面が初期化されていない問題を修正 * fix * Update Changelog * typo --- packages/frontend/src/pages/flash/flash.vue | 82 ++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 18 deletions(-) (limited to 'packages/frontend/src/pages/flash') diff --git a/packages/frontend/src/pages/flash/flash.vue b/packages/frontend/src/pages/flash/flash.vue index 4aa3ce1672..40499fde0e 100644 --- a/packages/frontend/src/pages/flash/flash.vue +++ b/packages/frontend/src/pages/flash/flash.vue @@ -15,11 +15,15 @@ SPDX-License-Identifier: AGPL-3.0-only
- {{ flash.likedCount }} - {{ flash.likedCount }} - - - +
+ +
+
+ {{ flash.likedCount }} + {{ flash.likedCount }} + + +
@@ -49,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._play.editThisPage }}
- + @@ -94,12 +98,33 @@ function fetchFlash() { }); } +function share(ev: MouseEvent) { + if (!flash.value) return; + + os.popupMenu([ + { + text: i18n.ts.shareWithNote, + icon: 'ti ti-pencil', + action: shareWithNote, + }, + ...(isSupportShare() ? [{ + text: i18n.ts.share, + icon: 'ti ti-share', + action: shareWithNavigator, + }] : []), + ], ev.currentTarget ?? ev.target); +} + function copyLink() { + if (!flash.value) return; + copyToClipboard(`${url}/play/${flash.value.id}`); os.success(); } -function share() { +function shareWithNavigator() { + if (!flash.value) return; + navigator.share({ title: flash.value.title, text: flash.value.summary, @@ -108,21 +133,28 @@ function share() { } function shareWithNote() { + if (!flash.value) return; + os.post({ - initialText: `${flash.value.title} ${url}/play/${flash.value.id}`, + initialText: `${flash.value.title}\n${url}/play/${flash.value.id}`, + instant: true, }); } function like() { + if (!flash.value) return; + os.apiWithDialog('flash/like', { flashId: flash.value.id, }).then(() => { - flash.value.isLiked = true; - flash.value.likedCount++; + flash.value!.isLiked = true; + flash.value!.likedCount++; }); } async function unlike() { + if (!flash.value) return; + const confirm = await os.confirm({ type: 'warning', text: i18n.ts.unlikeConfirm, @@ -131,8 +163,8 @@ async function unlike() { os.apiWithDialog('flash/unlike', { flashId: flash.value.id, }).then(() => { - flash.value.isLiked = false; - flash.value.likedCount--; + flash.value!.isLiked = false; + flash.value!.likedCount--; }); } @@ -152,6 +184,7 @@ function start() { async function run() { if (aiscript.value) aiscript.value.abort(); + if (!flash.value) return; aiscript.value = new Interpreter({ ...createAiScriptEnv({ @@ -193,12 +226,17 @@ async function run() { } } -onDeactivated(() => { +function reset() { if (aiscript.value) aiscript.value.abort(); + started.value = false; +} + +onDeactivated(() => { + reset(); }); onUnmounted(() => { - if (aiscript.value) aiscript.value.abort(); + reset(); }); const headerActions = computed(() => []); @@ -265,11 +303,19 @@ definePageMetadata(() => ({ } > .actions { - display: flex; - justify-content: center; - gap: 12px; margin-top: 16px; - padding: 16px; + + > .items { + display: flex; + justify-content: center; + gap: 12px; + padding: 16px; + border-bottom: 1px solid var(--divider); + + &:last-child { + border-bottom: none; + } + } } } } -- cgit v1.2.3-freya