Skip to content

Commit

Permalink
Merge pull request #4239 from balancer/feat/default-network-filter
Browse files Browse the repository at this point in the history
feat: add default network filter on vebal table
  • Loading branch information
alter-eggo authored Sep 26, 2023
2 parents 178fd72 + 466151d commit 8023e3c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const networkFiltersArr = ref([...props.activeNetworkFilters]);
* otherwise activeFiltersNum would change only after 500ms debounce which lead to poor UX
*/
const isExpiredFilterActive = ref(false);
const activeNetworksArr = ref<number[]>([]);
const activeNetworksArr = ref<number[]>(props.activeNetworkFilters);
/**
* COMPUTED
Expand Down
27 changes: 25 additions & 2 deletions src/components/contextual/pages/vebal/LMVoting/LMVoting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ import { bpsToPercentage, isGaugeExpired } from '../voting-utils';
import useNumbers from '@/composables/useNumbers';
import { isVotingCompleted, useVoting } from '../providers/voting.provider';
/**
* COMPOSABLES
*/
const router = useRouter();
/**
* DATA
*/
const tokenFilter = useDebouncedRef<string>('', 500);
const showExpiredGauges = useDebouncedRef<boolean>(false, 500);
const activeNetworkFilters = useDebouncedRef<Network[]>([], 500);
const activeNetworkFilters = useDebouncedRef<Network[]>(
getDefaultActiveNetworkFilter(),
500
);
const networkFilters: Network[] = Object.entries(configs)
.filter(details => {
Expand Down Expand Up @@ -51,7 +60,6 @@ const { isWalletReady } = useWeb3();
const { hasVeBalBalance, noVeBalBalance } = useVeBal();
const { fNum } = useNumbers();
const {
isLoading,
isLoadingVotingPools,
Expand Down Expand Up @@ -143,6 +151,21 @@ function addIntersectionObserver(): void {
observer = new IntersectionObserver(callback, options);
observer.observe(intersectionSentinel.value);
}
function getDefaultActiveNetworkFilter() {
const param = router.currentRoute.value.query.chain;
if (!param || typeof param !== 'string') {
return [];
}
const networkToFilter = Network[param.toUpperCase()];
if (!networkToFilter) {
return [];
}
return [networkToFilter];
}
onMounted(() => {
addIntersectionObserver();
});
Expand Down

1 comment on commit 8023e3c

@vercel
Copy link

@vercel vercel bot commented on 8023e3c Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.