merge: Add a clear filter option to the search widget if set (!722)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/722

Closes #786

Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
This commit is contained in:
Hazelnoot 2024-11-01 18:01:19 +00:00
commit 8824422cb5

View file

@ -72,7 +72,7 @@ function options(ev) {
{
type: 'button',
icon: 'ph-image ph-bold ph-lg',
text: 'With Images',
text: `With Images ${filetype.value === 'image' ? '✔' : ''}`,
action: () => {
filetype.value = 'image';
},
@ -80,7 +80,7 @@ function options(ev) {
{
type: 'button',
icon: 'ph-music-notes-simple ph-bold ph-lg',
text: 'With Audios',
text: `With Audios ${filetype.value === 'audio' ? '✔' : ''}`,
action: () => {
filetype.value = 'audio';
},
@ -88,12 +88,19 @@ function options(ev) {
{
type: 'button',
icon: 'ph-video ph-bold ph-lg',
text: 'With Videos',
text: `With Videos ${filetype.value === 'video' ? '✔' : ''}`,
action: () => {
filetype.value = 'video';
},
}],
}], ev.currentTarget ?? ev.target);
},
...(filetype.value ? [{
text: 'Clear Filter',
icon: 'ti ti-trash',
action: () => {
filetype.value = null;
},
}] : [])], ev.currentTarget ?? ev.target);
}
async function search() {