mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 12:13:00 +00: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 { i18n } from '@/i18n.js';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||||
import { deepClone } from '@/scripts/clone.js';
|
import { deepClone } from '@/scripts/clone.js';
|
||||||
|
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||||
|
|
||||||
let reactions = $ref(deepClone(defaultStore.state.reactions));
|
let reactions = $ref(deepClone(defaultStore.state.reactions));
|
||||||
const like = $computed(defaultStore.makeGetterSetter('like'));
|
const like = $computed(defaultStore.makeGetterSetter('like'));
|
||||||
|
@ -92,6 +93,16 @@ const reactionPickerWidth = $computed(defaultStore.makeGetterSetter('reactionPic
|
||||||
const reactionPickerHeight = $computed(defaultStore.makeGetterSetter('reactionPickerHeight'));
|
const reactionPickerHeight = $computed(defaultStore.makeGetterSetter('reactionPickerHeight'));
|
||||||
const reactionPickerUseDrawerForMobile = $computed(defaultStore.makeGetterSetter('reactionPickerUseDrawerForMobile'));
|
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() {
|
function save() {
|
||||||
defaultStore.set('reactions', reactions);
|
defaultStore.set('reactions', reactions);
|
||||||
}
|
}
|
||||||
|
@ -135,13 +146,15 @@ function chooseEmoji(ev: MouseEvent) {
|
||||||
function chooseNewLike(ev: MouseEvent) {
|
function chooseNewLike(ev: MouseEvent) {
|
||||||
os.pickEmoji(ev.currentTarget ?? ev.target, {
|
os.pickEmoji(ev.currentTarget ?? ev.target, {
|
||||||
showPinned: false,
|
showPinned: false,
|
||||||
}).then(emoji => {
|
}).then(async emoji => {
|
||||||
defaultStore.set('like', emoji as string);
|
defaultStore.set('like', emoji as string);
|
||||||
|
await reloadAsk();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetLike() {
|
async function resetLike() {
|
||||||
defaultStore.set('like', null);
|
defaultStore.set('like', null);
|
||||||
|
await reloadAsk();
|
||||||
}
|
}
|
||||||
|
|
||||||
watch($$(reactions), () => {
|
watch($$(reactions), () => {
|
||||||
|
|
Loading…
Reference in a new issue