mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
Allow filter search for country and region.
This commit is contained in:
parent
2ed7628997
commit
a18d1a923c
5 changed files with 55 additions and 17 deletions
|
|
@ -28,12 +28,15 @@ export function useWebsiteValues({
|
|||
const getSearch = (type: string, value: string) => {
|
||||
if (value) {
|
||||
const values = names[type];
|
||||
return Object.keys(values).reduce((code: string, key: string) => {
|
||||
if (!code && values[key].toLowerCase().includes(value.toLowerCase())) {
|
||||
code = key;
|
||||
}
|
||||
return code;
|
||||
}, '');
|
||||
return Object.keys(values)
|
||||
.reduce((arr: string[], key: string) => {
|
||||
if (values[key].toLowerCase().includes(value.toLowerCase())) {
|
||||
return arr.concat(key);
|
||||
}
|
||||
return arr;
|
||||
}, [])
|
||||
.slice(0, 5)
|
||||
.join(',');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue