Skip to content

Commit

Permalink
feat: Store chosen sort column in local storage
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller committed Jul 6, 2023
1 parent bd9a333 commit 6e8ba63
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/constants/local-storage.keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
EthereumTxType: 'app.ethereumTxType',
SupportSignatures: 'app.supportSignatures',
TermsAccepted: 'app.termsAccepted',
PoolSorting: 'app.poolSorting',
},
Swap: {
Gasless: 'swap.gasless',
Expand Down
13 changes: 12 additions & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ import usePoolFilters from '@/composables/pools/usePoolFilters';
import useBreakpoints from '@/composables/useBreakpoints';
import useNetwork from '@/composables/useNetwork';
import usePools from '@/composables/pools/usePools';
import { lsGet, lsSet } from '@/lib/utils';
import LS_KEYS from '@/constants/local-storage.keys';
// COMPOSABLES
/**
* STATE
*/
const initSortCol = lsGet(LS_KEYS.App.PoolSorting) || 'totalLiquidity';
/**
* COMPOSABLES
*/
const router = useRouter();
const { appNetworkConfig } = useNetwork();
const isElementSupported = appNetworkConfig.supportsElementPools;
Expand All @@ -37,6 +46,7 @@ function navigateToCreatePool() {
function onColumnSort(columnId: string) {
poolsSortField.value = columnId;
lsSet(LS_KEYS.App.PoolSorting, columnId);
}
</script>

Expand Down Expand Up @@ -91,6 +101,7 @@ function onColumnSort(columnId: string) {
:isLoading="isLoading"
:selectedTokens="selectedTokens"
class="mb-8"
:sortColumn="initSortCol"
:hiddenColumns="['migrate', 'actions', 'lockEndDate']"
:isLoadingMore="poolsIsFetchingNextPage"
:isPaginated="isPaginated"
Expand Down

0 comments on commit 6e8ba63

Please sign in to comment.