-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
react: add useProfileActionHistory and useWhoReactedToPublication
- Loading branch information
Showing
17 changed files
with
577 additions
and
1 deletion.
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,37 @@ | ||
import { useProfileActionHistory } from '@lens-protocol/react'; | ||
|
||
import { ErrorMessage } from '../components/error/ErrorMessage'; | ||
import { Loading } from '../components/loading/Loading'; | ||
import { useInfiniteScroll } from '../hooks/useInfiniteScroll'; | ||
|
||
// TODO requires authenticated profile | ||
export function UseProfileActionHistory() { | ||
const { | ||
data: history, | ||
error, | ||
loading, | ||
hasMore, | ||
observeRef, | ||
} = useInfiniteScroll(useProfileActionHistory()); | ||
|
||
if (loading) return <Loading />; | ||
|
||
if (error) return <ErrorMessage error={error} />; | ||
|
||
return ( | ||
<div> | ||
<h1> | ||
<code>useProfileActionHistory</code> | ||
</h1> | ||
<div> | ||
{history.map((item) => ( | ||
<div key={item.id}> | ||
{item.actionType} {item.actionedOn} | ||
</div> | ||
))} | ||
|
||
{hasMore && <p ref={observeRef}>Loading more...</p>} | ||
</div> | ||
</div> | ||
); | ||
} |
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
5 changes: 5 additions & 0 deletions
5
...ges/api-bindings/src/apollo/cache/field-policies/createProfileActionHistoryFieldPolicy.ts
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,5 @@ | ||
import { cursorBasedPagination } from '../utils/cursorBasedPagination'; | ||
|
||
export function createProfileActionHistoryFieldPolicy() { | ||
return cursorBasedPagination([]); | ||
} |
5 changes: 5 additions & 0 deletions
5
...es/api-bindings/src/apollo/cache/field-policies/createWhoReactedPublicationFieldPolicy.ts
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,5 @@ | ||
import { cursorBasedPagination } from '../utils/cursorBasedPagination'; | ||
|
||
export function createWhoReactedPublicationFieldPolicy() { | ||
return cursorBasedPagination([['request', ['for', 'where', ['anyOf']]]]); | ||
} |
4 changes: 3 additions & 1 deletion
4
packages/api-bindings/src/apollo/cache/field-policies/index.ts
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,9 +1,11 @@ | ||
export * from './createFollowersFieldPolicy'; | ||
export * from './createFollowingFieldPolicy'; | ||
export * from './createMutualFollowersFieldPolicy'; | ||
export * from './createProfileActionHistoryFieldPolicy'; | ||
export * from './createProfileRecommendationsFieldPolicy'; | ||
export * from './createProfilesFieldPolicy'; | ||
export * from './createPublicationsFieldPolicy'; | ||
export * from './createSearchProfilesFieldPolicy'; | ||
export * from './createSearchPublicationsFieldPolicy'; | ||
export * from './createProfileRecommendationsFieldPolicy'; | ||
export * from './createWhoActedOnPublicationFieldPolicy'; | ||
export * from './createWhoReactedPublicationFieldPolicy'; |
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
Oops, something went wrong.