mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
feat: Keywords Country filter now only shows relevant countries.
This commit is contained in:
parent
bc96dc7de5
commit
a050536814
@ -60,14 +60,19 @@ const KeywordFilters = (props: KeywordFilterProps) => {
|
|||||||
const countryOptions = useMemo(() => {
|
const countryOptions = useMemo(() => {
|
||||||
const optionObject:{label:string, value:string}[] = [];
|
const optionObject:{label:string, value:string}[] = [];
|
||||||
|
|
||||||
Object.keys(countries).forEach((countryISO:string) => {
|
if (!isConsole) {
|
||||||
if (!isConsole || (isConsole && SCcountries.includes(countryISO))) {
|
const allCountries = keywords.reduce((acc: string[], keyword) => [...acc, keyword.country], []).filter((t) => t && t.trim() !== '');
|
||||||
optionObject.push({ label: countries[countryISO][0], value: countryISO });
|
[...new Set(allCountries)].forEach((c) => optionObject.push({ label: countries[c][0], value: c }));
|
||||||
}
|
} else {
|
||||||
});
|
Object.keys(countries).forEach((countryISO:string) => {
|
||||||
|
if ((SCcountries.includes(countryISO))) {
|
||||||
|
optionObject.push({ label: countries[countryISO][0], value: countryISO });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return optionObject;
|
return optionObject;
|
||||||
}, [SCcountries, isConsole]);
|
}, [SCcountries, isConsole, keywords]);
|
||||||
|
|
||||||
const sortOptionChoices: SelectionOption[] = [
|
const sortOptionChoices: SelectionOption[] = [
|
||||||
{ value: 'pos_asc', label: 'Top Position' },
|
{ value: 'pos_asc', label: 'Top Position' },
|
||||||
|
Loading…
Reference in New Issue
Block a user