-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(WIP): follow / unfollow and comments handling #330
Merged
Merged
Changes from 3 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
89eb240
feat: add type safety to LoaderContainer with BoxProps
cswni 9669913
feat(redux-followers): integrate followers management state
cswni e5b3005
feat(comments): support pending comments in state and UI
cswni 2e12a99
fix(user-profile-view): handle undefined profile id
cswni d561dc9
refactor: posting comments effects
cswni 0e76fff
refactor: optimize UI styles and improve comment handling
cswni d633328
feat(publication-comment-item): adjust like icon color for pending co…
cswni 4e05263
refactor(publication): remove unused updateCommentStatus import
cswni 93b190c
refactor(layout): remove unused LoaderDuringCreationProfile
cswni 8afbb1b
feat(auth): add currentStep state and relevant actions
cswni 0b52e76
feat: add customizable padding prop to NeonPaperContainer
cswni 12f0a99
feat: improve profile creation UI with dynamic button logic
cswni bed2c7d
refactor(wip): change sessionData flow
cswni 327ac9b
fix: session data redux
Jadapema c00e73d
refactor: replace useSession with useSelector for session handling
cswni 0f98755
fix(modal): adjust BackdropProps and remove unused import
cswni 28bf2c4
feat: close login modal after profile actions complete
cswni 30957b6
feat: added background task middleware and worker
Jadapema 24db1e5
refactor(view): update profile filtering logic
cswni 2e8b34f
feat(profile-header): add hide/unhide profile functionality
cswni fec9a68
Merge remote-tracking branch 'origin/app/refactor/follow-comments' in…
cswni e5a6e84
feat: add dynamic borderRadius and rainbow effect with NeonPaper
cswni e1259db
feat: added update metadata background task
Jadapema 879ee33
feat: added update metadata background task
Jadapema 9386037
refactor: profile update in bg
cswni 454e3c6
Merge remote-tracking branch 'origin/app/refactor/follow-comments' in…
cswni 5d0db30
fix: empty image
Jadapema b023b3f
fix: empty image
Jadapema 0c5fa25
fix: empty image
Jadapema a274b75
fix: timing on create profile
Jadapema 851cbc2
fix: some small fixes
Jadapema File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 { createSlice, PayloadAction } from '@reduxjs/toolkit'; | ||
import { Profile } from '@lens-protocol/api-bindings'; | ||
|
||
interface FollowersState { | ||
followers: Profile[]; | ||
followings: Profile[]; | ||
} | ||
|
||
const initialState: FollowersState = { | ||
followers: [], | ||
followings: [], | ||
}; | ||
|
||
const followersSlice = createSlice({ | ||
name: 'followers', | ||
initialState, | ||
reducers: { | ||
setFollowers: (state, action: PayloadAction<Profile[]>) => { | ||
state.followers = action.payload; | ||
}, | ||
setFollowings: (state, action: PayloadAction<Profile[]>) => { | ||
state.followings = action.payload; | ||
}, | ||
|
||
addFollowing: (state, action: PayloadAction<Profile>) => { | ||
state.followings.push(action.payload); | ||
}, | ||
|
||
removeFollowing: (state, action: PayloadAction<string>) => { | ||
state.followings = state.followings.filter(following => following.id !== action.payload); | ||
}, | ||
}, | ||
}); | ||
|
||
export const { setFollowers, setFollowings, removeFollowing, addFollowing } = followersSlice.actions; | ||
|
||
export default followersSlice.reducer; |
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 | ||||
---|---|---|---|---|---|---|
|
@@ -14,6 +14,7 @@ type Props = { | |||||
}; | ||||||
|
||||||
export default function PostCommentList({ publicationId: id, showReplies }: Props) { | ||||||
const pendingComments = useSelector((state: any) => state.comments.pendingComments); | ||||||
const { data: comments, error, loading, execute } = useLazyPublications(); | ||||||
const { hiddenComments, refetchTriggerByPublication } = useSelector((state: any) => state.comments); | ||||||
const refetchTrigger = refetchTriggerByPublication[id] || 0; | ||||||
|
@@ -37,7 +38,13 @@ export default function PostCommentList({ publicationId: id, showReplies }: Prop | |||||
|
||||||
if (error) return <p>Error loading comments: {error.message}</p>; | ||||||
|
||||||
const commentsFiltered = (comments ?? []) | ||||||
// Join the comments with the pending comments but append the pending comments at the beginning of the list | ||||||
const commentsWithPending = pendingComments[id] ? [...pendingComments[id], ...(comments ?? [])] : comments; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The commentsWithPending variable should default to an empty array if comments are null or undefined to avoid potential runtime errors.
Suggested change
Copilot is powered by AI, so mistakes are possible. Review output carefully before use. |
||||||
|
||||||
console.log('comments', comments); | ||||||
console.log('comments pending', pendingComments[id]); | ||||||
|
||||||
const commentsFiltered = (commentsWithPending ?? []) | ||||||
.filter((comment) => !hiddenComments.some((hiddenComment: any) => hiddenComment.id === comment.id)) | ||||||
.filter((comment) => !comment.isHidden) | ||||||
|
||||||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateCommentStatus reducer removes the comment from the state.comments array but does not update its status. Ensure the comment's status is updated correctly.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.