-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added notification and refactored code
- Loading branch information
1 parent
9f03912
commit aa83377
Showing
39 changed files
with
454 additions
and
364 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
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,38 @@ | ||
import { BsTwitter } from "react-icons/bs"; | ||
|
||
import useNotifications from "@/hooks/useNotifications"; | ||
import useCurrentUser from "@/hooks/useCurrentUser"; | ||
import { useEffect } from "react"; | ||
|
||
const NotificationsFeed = () => { | ||
const { data: currentUser, mutate: mutateCurrentUser } = useCurrentUser(); | ||
const { data: fetchedNotifications = [] } = useNotifications(currentUser?.id); | ||
|
||
useEffect(() => { | ||
mutateCurrentUser(); | ||
}, [mutateCurrentUser]); | ||
|
||
if (fetchedNotifications.length === 0) { | ||
return ( | ||
<div className='text-neutral-600 text-center p-6 text-xl'> | ||
No notifications | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className='flex flex-col'> | ||
{fetchedNotifications.map((notification: Record<string, any>) => ( | ||
<div | ||
key={notification.id} | ||
className='flex flex-row items-center p-6 gap-4 border-b-[1px] border-neutral-800' | ||
> | ||
<BsTwitter color='white' size={32} /> | ||
<p className='text-white'>{notification.body}</p> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotificationsFeed; |
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
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.