mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 22:13:07 +02:00
upd: ask to reload on like change
This commit is contained in:
parent
c9112b2949
commit
ae2752ca0f
1 changed files with 15 additions and 2 deletions
|
@ -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), () => {
|
||||
|
|
Loading…
Reference in a new issue