-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 5597286.
- Loading branch information
1 parent
259d66a
commit 93a2e6c
Showing
10 changed files
with
67 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import { ContextMenuButton } from 'react-native-ios-context-menu'; | ||
|
||
export default function ContextMenu(props) { | ||
return <ContextMenuButton activeOpacity={0} isMenuPrimaryAction useActionSheetFallback={false} wrapNativeComponent={false} {...props} />; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
import { NftCollectionSortCriterion, SortDirection } from '@/graphql/__generated__/arc'; | ||
import { useCallback } from 'react'; | ||
import { MMKV, useMMKVString } from 'react-native-mmkv'; | ||
import useAccountSettings from './useAccountSettings'; | ||
import { NftCollectionSortCriterion } from '@/graphql/__generated__/arc'; | ||
|
||
const mmkv = new MMKV(); | ||
const getStorageKey = (accountAddress: string) => `nfts-sort-${accountAddress}`; | ||
|
||
const parseNftSort = (s: string | undefined) => { | ||
const [sortBy = NftCollectionSortCriterion.MostRecent, sortDirection = SortDirection.Desc] = (s?.split('|') || []) as [ | ||
sortBy?: NftCollectionSortCriterion, | ||
sortDirection?: SortDirection, | ||
]; | ||
return { sortBy, sortDirection } as const; | ||
}; | ||
|
||
export const getNftSortForAddress = (accountAddress: string) => { | ||
return parseNftSort(mmkv.getString(getStorageKey(accountAddress))); | ||
return mmkv.getString(getStorageKey(accountAddress)) as NftCollectionSortCriterion; | ||
}; | ||
|
||
export type NftSort = `${NftCollectionSortCriterion}|${SortDirection}`; | ||
|
||
export function useNftSort() { | ||
export default function useNftSort(): { | ||
nftSort: NftCollectionSortCriterion; | ||
updateNFTSort: (sortBy: NftCollectionSortCriterion) => void; | ||
} { | ||
const { accountAddress } = useAccountSettings(); | ||
const [nftSortData, setNftSortData] = useMMKVString(getStorageKey(accountAddress)); | ||
const { sortBy, sortDirection } = parseNftSort(nftSortData); | ||
const [nftSort, setNftSort] = useMMKVString(getStorageKey(accountAddress)); | ||
|
||
const updateNFTSort = useCallback( | ||
(sortBy: NftCollectionSortCriterion) => { | ||
setNftSort(sortBy); | ||
}, | ||
[setNftSort] | ||
); | ||
|
||
return { | ||
updateNFTSort: (nftSort: NftSort) => setNftSortData(nftSort), | ||
nftSort: sortBy, | ||
nftSortDirection: sortDirection, | ||
updateNFTSort, | ||
nftSort: (nftSort as NftCollectionSortCriterion) || NftCollectionSortCriterion.MostRecent, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters