From ae2752ca0fa17639eabedd71ae570b6b30fafe67 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Tue, 28 Nov 2023 18:01:48 +0100 Subject: [PATCH] upd: ask to reload on like change --- .../frontend/src/pages/settings/reaction.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/pages/settings/reaction.vue b/packages/frontend/src/pages/settings/reaction.vue index 9dd5ee9ee..80fbfc324 100644 --- a/packages/frontend/src/pages/settings/reaction.vue +++ b/packages/frontend/src/pages/settings/reaction.vue @@ -83,6 +83,7 @@ import { defaultStore } from '@/store.js'; import { i18n } from '@/i18n.js'; import { definePageMetadata } from '@/scripts/page-metadata.js'; import { deepClone } from '@/scripts/clone.js'; +import { unisonReload } from '@/scripts/unison-reload.js'; let reactions = $ref(deepClone(defaultStore.state.reactions)); const like = $computed(defaultStore.makeGetterSetter('like')); @@ -92,6 +93,16 @@ const reactionPickerWidth = $computed(defaultStore.makeGetterSetter('reactionPic const reactionPickerHeight = $computed(defaultStore.makeGetterSetter('reactionPickerHeight')); const reactionPickerUseDrawerForMobile = $computed(defaultStore.makeGetterSetter('reactionPickerUseDrawerForMobile')); +async function reloadAsk() { + const { canceled } = await os.confirm({ + type: 'info', + text: i18n.ts.reloadToApplySetting, + }); + if (canceled) return; + + unisonReload(); +} + function save() { defaultStore.set('reactions', reactions); } @@ -135,13 +146,15 @@ function chooseEmoji(ev: MouseEvent) { function chooseNewLike(ev: MouseEvent) { os.pickEmoji(ev.currentTarget ?? ev.target, { showPinned: false, - }).then(emoji => { + }).then(async emoji => { defaultStore.set('like', emoji as string); + await reloadAsk(); }); } -function resetLike() { +async function resetLike() { defaultStore.set('like', null); + await reloadAsk(); } watch($$(reactions), () => {