diff --git a/client/src/Components/Routes/HashtagPage.tsx b/client/src/Components/Routes/HashtagPage.tsx index 466028f..b79f164 100644 --- a/client/src/Components/Routes/HashtagPage.tsx +++ b/client/src/Components/Routes/HashtagPage.tsx @@ -1,4 +1,4 @@ -import PostCard from "../modals/NoteCard.jsx"; +import PostCard from "../modals/PostCard.jsx"; import { verifyPow } from "../../utils/mine.js"; import { Event } from "nostr-tools"; import NewNoteCard from "../forms/PostFormCard.jsx"; diff --git a/client/src/Components/Routes/Home.tsx b/client/src/Components/Routes/Home.tsx index f708ece..f38bb2b 100644 --- a/client/src/Components/Routes/Home.tsx +++ b/client/src/Components/Routes/Home.tsx @@ -4,7 +4,7 @@ import NewNoteCard from "../forms/PostFormCard"; import RepostCard from "../modals/RepostCard"; import { DEFAULT_DIFFICULTY } from "../../config"; import { useUniqEvents } from "../../hooks/useUniqEvents"; -import PostCard from "../modals/NoteCard"; +import PostCard from "../modals/PostCard"; const Home = () => { const filterDifficulty = localStorage.getItem("filterDifficulty") || DEFAULT_DIFFICULTY; diff --git a/client/src/Components/Routes/Notifications.tsx b/client/src/Components/Routes/Notifications.tsx index 311afc9..c38ca41 100644 --- a/client/src/Components/Routes/Notifications.tsx +++ b/client/src/Components/Routes/Notifications.tsx @@ -1,5 +1,5 @@ import { useState, useCallback } from "react"; -import PostCard from "../modals/NoteCard.jsx"; +import PostCard from "../modals/PostCard.jsx"; import { Event } from "nostr-tools"; import RepostCard from "../modals/RepostCard.jsx"; import { useUniqEvents } from "../../hooks/useUniqEvents.js"; diff --git a/client/src/Components/Routes/Thread.tsx b/client/src/Components/Routes/Thread.tsx index 8f70816..2f293ae 100644 --- a/client/src/Components/Routes/Thread.tsx +++ b/client/src/Components/Routes/Thread.tsx @@ -5,10 +5,10 @@ import { subNote, subNotesOnce } from '../../utils/subscriptions'; import { useEffect } from 'react'; import { uniqBy } from '../../utils/otherUtils'; import { DocumentTextIcon, FolderPlusIcon, DocumentDuplicateIcon, ArrowTopRightOnSquareIcon } from '@heroicons/react/24/outline'; -import PostCard from '../modals/NoteCard'; import Placeholder from '../modals/Placeholder'; import NewNoteCard from '../forms/PostFormCard'; import RepostNote from '../forms/RepostNote'; +import PostCard from '../modals/PostCard'; type PostType = "" | "Reply" | "Quote" | undefined; diff --git a/client/src/components/Modals/NoteCard.tsx b/client/src/components/Modals/NoteCard.tsx deleted file mode 100644 index 0bcc9ac..0000000 --- a/client/src/components/Modals/NoteCard.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { FolderIcon, CpuChipIcon } from "@heroicons/react/24/outline"; -// import { parseContent } from "../../utils/content"; -import { Event, nip19 } from "nostr-tools"; -import { getMetadata } from "../../utils/getMetadata"; -// import { renderMedia } from "../../utils/FileUpload"; -import { getIconFromHash, timeAgo } from "../../utils/cardUtils"; -import { verifyPow } from "../../utils/mine"; -import { uniqBy } from "../../utils/otherUtils"; -import ContentPreview from "./CardModals/TextModal"; -import CardContainer from "./CardContainer"; - -interface CardProps { - key?: string | number; - event: Event; - metadata: Event | null; - replies: Event[]; - repliedTo?: Event[] - type?: 'OP' | 'Reply' | 'Post'; -} - -const PostCard = ({ - key, - event, - metadata, - replies, - repliedTo, - type -}: CardProps) => { - // const { files } = parseContent(event); - const icon = getIconFromHash(event.pubkey); - const metadataParsed = metadata ? getMetadata(metadata) : null; - - const handleClick = () => { - if (type !== "OP") { - window.location.href = `/thread/${nip19.noteEncode(event.id)}`; - } - }; - - return ( - -
-
- -
- {repliedTo &&
- Reply to: - {uniqBy(repliedTo, 'pubkey').map((event, index) => ( -
- {event.kind === 0 ? ( - - ) : ( -
- )} -
- ))} -
} -
- {metadataParsed ? - - : -
- } -
-
- {verifyPow(event)} -
- · -
- {timeAgo(event.created_at)} -
- · -
- - {replies.length} -
-
-
-
- - ); -}; - -export default PostCard; \ No newline at end of file diff --git a/client/src/components/modals/NoteCard.tsx b/client/src/components/modals/NoteCard.tsx deleted file mode 100644 index 0bcc9ac..0000000 --- a/client/src/components/modals/NoteCard.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { FolderIcon, CpuChipIcon } from "@heroicons/react/24/outline"; -// import { parseContent } from "../../utils/content"; -import { Event, nip19 } from "nostr-tools"; -import { getMetadata } from "../../utils/getMetadata"; -// import { renderMedia } from "../../utils/FileUpload"; -import { getIconFromHash, timeAgo } from "../../utils/cardUtils"; -import { verifyPow } from "../../utils/mine"; -import { uniqBy } from "../../utils/otherUtils"; -import ContentPreview from "./CardModals/TextModal"; -import CardContainer from "./CardContainer"; - -interface CardProps { - key?: string | number; - event: Event; - metadata: Event | null; - replies: Event[]; - repliedTo?: Event[] - type?: 'OP' | 'Reply' | 'Post'; -} - -const PostCard = ({ - key, - event, - metadata, - replies, - repliedTo, - type -}: CardProps) => { - // const { files } = parseContent(event); - const icon = getIconFromHash(event.pubkey); - const metadataParsed = metadata ? getMetadata(metadata) : null; - - const handleClick = () => { - if (type !== "OP") { - window.location.href = `/thread/${nip19.noteEncode(event.id)}`; - } - }; - - return ( - -
-
- -
- {repliedTo &&
- Reply to: - {uniqBy(repliedTo, 'pubkey').map((event, index) => ( -
- {event.kind === 0 ? ( - - ) : ( -
- )} -
- ))} -
} -
- {metadataParsed ? - - : -
- } -
-
- {verifyPow(event)} -
- · -
- {timeAgo(event.created_at)} -
- · -
- - {replies.length} -
-
-
-
- - ); -}; - -export default PostCard; \ No newline at end of file diff --git a/client/src/Components/Modals/NoteCard.tsx b/client/src/components/modals/PostCard.tsx similarity index 100% rename from client/src/Components/Modals/NoteCard.tsx rename to client/src/components/modals/PostCard.tsx diff --git a/client/src/components/routes/HashtagPage.tsx b/client/src/components/routes/HashtagPage.tsx index 466028f..b79f164 100644 --- a/client/src/components/routes/HashtagPage.tsx +++ b/client/src/components/routes/HashtagPage.tsx @@ -1,4 +1,4 @@ -import PostCard from "../modals/NoteCard.jsx"; +import PostCard from "../modals/PostCard.jsx"; import { verifyPow } from "../../utils/mine.js"; import { Event } from "nostr-tools"; import NewNoteCard from "../forms/PostFormCard.jsx"; diff --git a/client/src/components/routes/Home.tsx b/client/src/components/routes/Home.tsx index f708ece..f38bb2b 100644 --- a/client/src/components/routes/Home.tsx +++ b/client/src/components/routes/Home.tsx @@ -4,7 +4,7 @@ import NewNoteCard from "../forms/PostFormCard"; import RepostCard from "../modals/RepostCard"; import { DEFAULT_DIFFICULTY } from "../../config"; import { useUniqEvents } from "../../hooks/useUniqEvents"; -import PostCard from "../modals/NoteCard"; +import PostCard from "../modals/PostCard"; const Home = () => { const filterDifficulty = localStorage.getItem("filterDifficulty") || DEFAULT_DIFFICULTY; diff --git a/client/src/components/routes/Notifications.tsx b/client/src/components/routes/Notifications.tsx index 311afc9..c38ca41 100644 --- a/client/src/components/routes/Notifications.tsx +++ b/client/src/components/routes/Notifications.tsx @@ -1,5 +1,5 @@ import { useState, useCallback } from "react"; -import PostCard from "../modals/NoteCard.jsx"; +import PostCard from "../modals/PostCard.jsx"; import { Event } from "nostr-tools"; import RepostCard from "../modals/RepostCard.jsx"; import { useUniqEvents } from "../../hooks/useUniqEvents.js"; diff --git a/client/src/components/routes/Thread.tsx b/client/src/components/routes/Thread.tsx index 8f70816..2f293ae 100644 --- a/client/src/components/routes/Thread.tsx +++ b/client/src/components/routes/Thread.tsx @@ -5,10 +5,10 @@ import { subNote, subNotesOnce } from '../../utils/subscriptions'; import { useEffect } from 'react'; import { uniqBy } from '../../utils/otherUtils'; import { DocumentTextIcon, FolderPlusIcon, DocumentDuplicateIcon, ArrowTopRightOnSquareIcon } from '@heroicons/react/24/outline'; -import PostCard from '../modals/NoteCard'; import Placeholder from '../modals/Placeholder'; import NewNoteCard from '../forms/PostFormCard'; import RepostNote from '../forms/RepostNote'; +import PostCard from '../modals/PostCard'; type PostType = "" | "Reply" | "Quote" | undefined;