diff --git a/src/components/icons.tsx b/src/components/icons.tsx index 8ac09bd51..91d462fac 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -80,6 +80,12 @@ export const ArrowDownSIcon = createIcon({ defaultProps, }); +export const ArrowUpSIcon = createIcon({ + displayName: "arrow-up-s", + d: "M12 10.828l-4.95 4.95-1.414-1.414L12 8l6.364 6.364-1.414 1.414z", + defaultProps, +}); + export const ArrowLeftSIcon = createIcon({ displayName: "arrow-left-s", d: "M10.828 12l4.95 4.95-1.414 1.414L8 12l6.364-6.364 1.414 1.414z", diff --git a/src/components/note/index.tsx b/src/components/note/index.tsx index 4728db9d8..d3bd658e8 100644 --- a/src/components/note/index.tsx +++ b/src/components/note/index.tsx @@ -1,43 +1,26 @@ import React from "react"; -import { Link as RouterLink, useNavigate } from "react-router-dom"; +import { Link as RouterLink } from "react-router-dom"; import moment from "moment"; -import { - Box, - Button, - ButtonGroup, - Card, - CardBody, - CardFooter, - CardHeader, - Flex, - Heading, - HStack, - IconButton, - VStack, - Link, -} from "@chakra-ui/react"; +import { Box, Card, CardBody, CardHeader, Flex, Heading, Link } from "@chakra-ui/react"; import { NostrEvent } from "../../types/nostr-event"; -import { useUserMetadata } from "../../hooks/use-user-metadata"; import { UserAvatarLink } from "../user-avatar-link"; -import { getUserDisplayName } from "../../helpers/user-metadata"; import { Bech32Prefix, normalizeToBech32 } from "../../helpers/nip-19"; import { NoteContents } from "./note-contents"; import { NoteMenu } from "./note-menu"; -import { NoteCC } from "./note-cc"; -import { isReply } from "../../helpers/nostr-event"; import useSubject from "../../hooks/use-subject"; import identity from "../../services/identity"; import { useUserContacts } from "../../hooks/use-user-contacts"; -import { ArrowDownSIcon } from "../icons"; import { UserTipButton } from "../user-tip-button"; import { NoteRelays } from "./note-relays"; +import { useIsMobile } from "../../hooks/use-is-mobile"; +import { UserLink } from "../user-link"; export type NoteProps = { event: NostrEvent; }; export const Note = React.memo(({ event }: NoteProps) => { - const metadata = useUserMetadata(event.pubkey); + const isMobile = useIsMobile(); const pubkey = useSubject(identity.pubkey); const contacts = useUserContacts(pubkey); @@ -48,18 +31,16 @@ export const Note = React.memo(({ event }: NoteProps) => { - + - - {getUserDisplayName(metadata, event.pubkey)} - + - + + {moment(event.created_at * 1000).fromNow()} - {isReply(event) && } @@ -72,19 +53,6 @@ export const Note = React.memo(({ event }: NoteProps) => { - {/* */} - {/* */} - {/* - - } /> - */} - {/* */} ); }); diff --git a/src/components/note/note-cc.tsx b/src/components/note/note-cc.tsx deleted file mode 100644 index 653356e18..000000000 --- a/src/components/note/note-cc.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Text } from "@chakra-ui/react"; -import { isPTag, NostrEvent } from "../../types/nostr-event"; -import { UserLink } from "../user-link"; - -export const NoteCC = ({ event }: { event: NostrEvent }) => { - const hasCC = event.tags.some(isPTag); - if (!hasCC) return null; - - return ( - - Replying to: - {event.tags - .filter(isPTag) - .map((t) => t[1] && ) - .reduce((arr, el, i, original) => { - if (i !== original.length - 1) { - return arr.concat([el, ", "]); - } - return arr.concat(el); - }, [] as any[])} - - ); -}; diff --git a/src/components/post-modal/post-form.tsx b/src/components/post-modal/post-form.tsx index 884f03b8d..524827175 100644 --- a/src/components/post-modal/post-form.tsx +++ b/src/components/post-modal/post-form.tsx @@ -21,7 +21,7 @@ export const PostForm = ({ onSubmit, onCancel, loading }: PostFormProps) => { return (
-