refactor: ♻️ use parent/child selector for attachment

This commit is contained in:
ThatOneCalculator 2023-06-12 02:19:27 -07:00
parent f72120bb9a
commit d778f6ad77
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
1 changed files with 36 additions and 29 deletions

View File

@ -306,34 +306,39 @@ async function openSearchFilters(ev) {
}, },
}, },
{ {
icon: "ph-file ph-bold ph-lg", type: "parent",
text: i18n.ts._filters.withFile, text: i18n.ts._filters.withFile,
action: () => { icon: "ph-paperclip ph-bold ph-lg",
os.select({ children: [
title: i18n.ts._filters.withFile,
items: [
{ {
text: i18n.ts.image, text: i18n.ts.image,
value: "image", icon: "ph-image-square ph-bold ph-lg",
action: () => {
inputValue.value += " has:image";
},
}, },
{ {
text: i18n.ts.video, text: i18n.ts.video,
value: "video", icon: "ph-video-camera ph-bold ph-lg",
action: () => {
inputValue.value += " has:video";
},
}, },
{ {
text: i18n.ts.audio, text: i18n.ts.audio,
value: "audio", icon: "ph-music-note ph-bold ph-lg",
action: () => {
inputValue.value += " has:audio";
},
}, },
{ {
text: i18n.ts.file, text: i18n.ts.file,
value: "file", icon: "ph-file ph-bold ph-lg",
action: () => {
inputValue.value += " has:file";
},
}, },
], ],
}).then((res) => {
if (res.canceled) return;
inputValue.value += " has:" + res.result;
});
},
}, },
{ {
icon: "ph-link ph-bold ph-lg", icon: "ph-link ph-bold ph-lg",
@ -350,7 +355,8 @@ async function openSearchFilters(ev) {
title: i18n.ts._filters.notesBefore, title: i18n.ts._filters.notesBefore,
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " before:" + formatDateToYYYYMMDD(res.result); inputValue.value +=
" before:" + formatDateToYYYYMMDD(res.result);
}); });
}, },
}, },
@ -362,7 +368,8 @@ async function openSearchFilters(ev) {
title: i18n.ts._filters.notesAfter, title: i18n.ts._filters.notesAfter,
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " after:" + formatDateToYYYYMMDD(res.result); inputValue.value +=
" after:" + formatDateToYYYYMMDD(res.result);
}); });
}, },
}, },