fix(front) [WIP] Comment out jQuery `search` until we find the correct version
This commit is contained in:
parent
95a78c6bae
commit
c5307fcdcc
|
@ -65,7 +65,8 @@ const el = useCurrentElement()
|
||||||
const query = ref()
|
const query = ref()
|
||||||
|
|
||||||
const enter = () => {
|
const enter = () => {
|
||||||
jQuery(el.value).search('cancel query')
|
// TODO: Find out what jQuery version supports `search`
|
||||||
|
// jQuery(el.value).search('cancel query')
|
||||||
|
|
||||||
// Cancel any API search request to backend…
|
// Cancel any API search request to backend…
|
||||||
return router.push(`/search?q=${query.value}&type=artists`)
|
return router.push(`/search?q=${query.value}&type=artists`)
|
||||||
|
@ -136,107 +137,108 @@ const objectId = computed(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
jQuery(el.value).search({
|
// TODO: Find out what jQuery version supports `search`
|
||||||
type: 'category',
|
// jQuery(el.value).search({
|
||||||
minCharacters: 3,
|
// type: 'category',
|
||||||
showNoResults: true,
|
// minCharacters: 3,
|
||||||
error: {
|
// showNoResults: true,
|
||||||
// @ts-expect-error Semantic is broken
|
// error: {
|
||||||
noResultsHeader: t('components.audio.SearchBar.header.noResults'),
|
// // @ts-expect-error Semantic is broken
|
||||||
noResults: t('components.audio.SearchBar.empty.noResults')
|
// noResultsHeader: t('components.audio.SearchBar.header.noResults'),
|
||||||
},
|
// noResults: t('components.audio.SearchBar.empty.noResults')
|
||||||
|
// },
|
||||||
|
|
||||||
onSelect (result, response) {
|
// onSelect (result, response) {
|
||||||
jQuery(el.value).search('set value', query.value)
|
// jQuery(el.value).search('set value', query.value)
|
||||||
router.push(result.routerUrl)
|
// router.push(result.routerUrl)
|
||||||
jQuery(el.value).search('hide results')
|
// jQuery(el.value).search('hide results')
|
||||||
return false
|
// return false
|
||||||
},
|
// },
|
||||||
onSearchQuery (value) {
|
// onSearchQuery (value) {
|
||||||
// query.value = value
|
// // query.value = value
|
||||||
emit('search')
|
// emit('search')
|
||||||
},
|
// },
|
||||||
apiSettings: {
|
// apiSettings: {
|
||||||
url: store.getters['instance/absoluteUrl']('api/v1/search?query={query}'),
|
// url: store.getters['instance/absoluteUrl']('api/v1/search?query={query}'),
|
||||||
beforeXHR: function (xhrObject) {
|
// beforeXHR: function (xhrObject) {
|
||||||
if (!store.state.auth.authenticated) {
|
// if (!store.state.auth.authenticated) {
|
||||||
return xhrObject
|
// return xhrObject
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (store.state.auth.oauth.accessToken) {
|
// if (store.state.auth.oauth.accessToken) {
|
||||||
xhrObject.setRequestHeader('Authorization', store.getters['auth/header'])
|
// xhrObject.setRequestHeader('Authorization', store.getters['auth/header'])
|
||||||
}
|
// }
|
||||||
|
|
||||||
return xhrObject
|
// return xhrObject
|
||||||
},
|
// },
|
||||||
onResponse: function (initialResponse) {
|
// onResponse: function (initialResponse) {
|
||||||
const id = objectId.value
|
// const id = objectId.value
|
||||||
const results: Partial<Record<CategoryCode, Results>> = {}
|
// const results: Partial<Record<CategoryCode, Results>> = {}
|
||||||
|
|
||||||
let resultsEmpty = true
|
// let resultsEmpty = true
|
||||||
for (const category of categories.value) {
|
// for (const category of categories.value) {
|
||||||
results[category.code] = {
|
// results[category.code] = {
|
||||||
name: category.name,
|
// name: category.name,
|
||||||
results: []
|
// results: []
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (category.code === 'federation' && id) {
|
// if (category.code === 'federation' && id) {
|
||||||
resultsEmpty = false
|
// resultsEmpty = false
|
||||||
results[category.code]?.results.push({
|
// results[category.code]?.results.push({
|
||||||
title: t('components.audio.SearchBar.link.fediverse'),
|
// title: t('components.audio.SearchBar.link.fediverse'),
|
||||||
routerUrl: {
|
// routerUrl: {
|
||||||
name: 'search',
|
// name: 'search',
|
||||||
query: { id }
|
// query: { id }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (category.code === 'podcasts' && id) {
|
// if (category.code === 'podcasts' && id) {
|
||||||
resultsEmpty = false
|
// resultsEmpty = false
|
||||||
results[category.code]?.results.push({
|
// results[category.code]?.results.push({
|
||||||
title: t('components.audio.SearchBar.link.rss'),
|
// title: t('components.audio.SearchBar.link.rss'),
|
||||||
routerUrl: {
|
// routerUrl: {
|
||||||
name: 'search',
|
// name: 'search',
|
||||||
query: { id, type: 'rss' }
|
// query: { id, type: 'rss' }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (category.code === 'more') {
|
// if (category.code === 'more') {
|
||||||
results[category.code]?.results.push({
|
// results[category.code]?.results.push({
|
||||||
title: t('components.audio.SearchBar.link.more'),
|
// title: t('components.audio.SearchBar.link.more'),
|
||||||
routerUrl: {
|
// routerUrl: {
|
||||||
name: 'search',
|
// name: 'search',
|
||||||
query: { type: 'artists', q: query.value }
|
// query: { type: 'artists', q: query.value }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (isCategoryGuard(category)) {
|
// if (isCategoryGuard(category)) {
|
||||||
for (const result of initialResponse[category.code]) {
|
// for (const result of initialResponse[category.code]) {
|
||||||
resultsEmpty = false
|
// resultsEmpty = false
|
||||||
const id = category.getId(result)
|
// const id = category.getId(result)
|
||||||
results[category.code]?.results.push({
|
// results[category.code]?.results.push({
|
||||||
title: category.getTitle(result),
|
// title: category.getTitle(result),
|
||||||
id,
|
// id,
|
||||||
routerUrl: {
|
// routerUrl: {
|
||||||
name: category.route,
|
// name: category.route,
|
||||||
params: { id }
|
// params: { id }
|
||||||
},
|
// },
|
||||||
description: category.getDescription(result)
|
// description: category.getDescription(result)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return {
|
// return {
|
||||||
results: resultsEmpty
|
// results: resultsEmpty
|
||||||
? {}
|
// ? {}
|
||||||
: results
|
// : results
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue