-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comment posting, fetching and rendering functionality
- Loading branch information
1 parent
2e68c8e
commit 8a5e6f3
Showing
10 changed files
with
418 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ yarn-error.log* | |
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
.env |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { atom } from "jotai"; | ||
|
||
export const fetchedComments = atom<NostrEvent[] | []>([]); |
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,33 @@ | ||
import { Avatar, Divider, Flex, Text } from "@chakra-ui/react"; | ||
import { useRouter } from "next/router"; | ||
import React from "react"; | ||
|
||
type CommentItemProps = { | ||
comment: NostrEvent; | ||
}; | ||
|
||
const CommentItem: React.FC<CommentItemProps> = ({ comment }) => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<Flex direction="column"> | ||
<Flex columnGap="5px" alignItems="center"> | ||
<Avatar size="sm" /> | ||
<Text | ||
color="gray.500" | ||
cursor="pointer" | ||
maxW={{ base: "250px", md: "500px" }} | ||
onClick={() => router.push(`/user/${comment.pubkey}`)} | ||
> | ||
{comment.pubkey} | ||
</Text> | ||
</Flex> | ||
<Flex mt="5px" ml="38px"> | ||
{JSON.parse(comment.content)} | ||
</Flex> | ||
<Divider mt="10px" /> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default CommentItem; |
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