improve haptics
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
setActiveNote,
|
||||
getNoteReferences
|
||||
} from '@/composables/useNotes'
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics'
|
||||
|
||||
const props = defineProps<{
|
||||
note: Note
|
||||
@@ -31,14 +32,16 @@ const updateNoteContent = (content: string) => {
|
||||
const references = computed<Note[]>(() => getNoteReferences(props.note))
|
||||
|
||||
const handleAction = async (action: string, closeModal: () => Promise<Boolean>) => {
|
||||
if (action === 'delete') {
|
||||
if (closeModal) await closeModal()
|
||||
setActiveNote(rootNote.value?.id)
|
||||
deleteNote(props.note.id)
|
||||
}
|
||||
if (action === 'setRoot') {
|
||||
setRootNote(props.note.id)
|
||||
if (closeModal) closeModal()
|
||||
Haptics.impact({ style: ImpactStyle.Light })
|
||||
switch (action) {
|
||||
case 'delete':
|
||||
if (closeModal) await closeModal()
|
||||
setActiveNote(rootNote.value?.id)
|
||||
deleteNote(props.note.id)
|
||||
break
|
||||
case 'setRoot':
|
||||
setRootNote(props.note.id)
|
||||
if (closeModal) closeModal()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user