Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
ui improments
Browse files Browse the repository at this point in the history
  • Loading branch information
alantoa committed Nov 7, 2023
1 parent f089062 commit c832239
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/app/components/creator-token/creator-token-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ export const TopCreatorTokenListItem = ({
>
{item.owner_profile?.name}
</Text>
<View tw="h-1" />
<View tw="h-2" />
<Text
tw="text-xs text-gray-500 dark:text-gray-400"
numberOfLines={1}
numberOfLines={3}
>
{item.owner_profile?.bio}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const TopCreatorTokens = ({
contentContainerStyle={{
paddingHorizontal: 12,
}}
overscan={12}
overscan={20}
ListHeaderComponent={Header}
containerTw="px-4"
onEndReached={disableFetchMore ? () => {} : fetchMore}
Expand Down
20 changes: 14 additions & 6 deletions packages/app/hooks/creator-token/use-creator-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ export const useTopCreatorToken = (limit: number = 15) => {
[limit]
);

const { data, ...queryState } = useInfiniteListQuerySWR<TopCreatorToken>(
fetchUrl,
{
pageSize: limit,
}
);
const {
data,
fetchMore: fetchMoreData,
...queryState
} = useInfiniteListQuerySWR<TopCreatorToken>(fetchUrl, {
pageSize: limit,
});

const newData = useMemo(() => {
let newData: TopCreatorToken["creator_tokens"] = [];
Expand All @@ -112,8 +113,15 @@ export const useTopCreatorToken = (limit: number = 15) => {
}
return newData;
}, [data]);

const fetchMore = useCallback(() => {
if (newData.length >= 100) return;
fetchMoreData();
}, [fetchMoreData, newData.length]);

return {
...queryState,
fetchMore,
data: newData,
};
};

0 comments on commit c832239

Please sign in to comment.