(null);
-
- useEffect(() => {
- const urls = comment.match(/\bhttps?:\/\/\S+/gi);
- if (urls && urls.length > 0) {
- getLinkPreview(urls[0])
- .then((preview) => setLinkPreview(preview as LinkPreview))
- .catch((error) => console.error(error));
- }
- }, [comment]);
-
return (
@@ -100,22 +79,7 @@ const QuoteEmbed = ({ event, metadata }: { event: Event, metadata: Event | null}
- {isExpanded ? comment : truncatedComment}
- {comment.length > 240 && (
-
- )}
- {linkPreview && linkPreview.images && linkPreview.images.length > 0 && (
-
- )}
+
{file !== "" && (
@@ -130,23 +94,4 @@ const QuoteEmbed = ({ event, metadata }: { event: Event, metadata: Event | null}
);
};
-interface LinkPreview {
- url: string;
- title: string;
- siteName?: string;
- description?: string;
- mediaType: string;
- contentType?: string;
- images: string[];
- videos: {
- url?: string;
- secureUrl?: string;
- type?: string;
- width?: string;
- height?: string;
- [key: string]: any;
- }[];
- [key: string]: any;
-}
-
export default QuoteEmbed;
\ No newline at end of file
diff --git a/client/src/components/Modals/TextModal.tsx b/client/src/components/Modals/TextModal.tsx
index 3d2efd5..3fe93dd 100644
--- a/client/src/components/Modals/TextModal.tsx
+++ b/client/src/components/Modals/TextModal.tsx
@@ -1,8 +1,6 @@
import QuoteEmbed from "./QuoteEmbed";
-import { getLinkPreview } from 'link-preview-js';
import { Event } from 'nostr-tools';
import { useEffect, useState } from "react";
-import { getMetadata, uniqBy } from '../../utils/utils';
import { subNoteOnce } from '../../utils/subscriptions';
import { nip19 } from "nostr-tools";
import LinkModal from "./LinkPreview";
@@ -16,14 +14,13 @@ const ContentPreview = ({ key, comment }: { key: string, comment: string }) => {
// Define your callback function for subGlobalFeed
const onEvent = (event: Event, relay: string) => {
setQuoteEvents((prevEvents) => [...prevEvents, event]);
- console.log(event.id + ' ' + event.kind + ' ' + event.tags);
};
useEffect(() => {
const findUrl = comment.match(/\bhttps?:\/\/\S+/gi);
if (findUrl && findUrl.length > 0) {
setUrl(findUrl[0])
- // setFinalComment(finalComment.replace(findUrl[0], '').trim())
+ setFinalComment(finalComment.replace(findUrl[0], '').trim())
}
const match = comment.match(/\bnostr:([a-z0-9]+)/i);
@@ -33,7 +30,7 @@ const ContentPreview = ({ key, comment }: { key: string, comment: string }) => {
subNoteOnce(id_to_hex, onEvent);
setFinalComment(finalComment.replace('nostr:'+nostrQuoteID, '').trim())
}
- }, [comment]);
+ }, [comment, finalComment]);
const getMetadataEvent = (event: Event) => {
const metadataEvent = quoteEvents.find(e => e.pubkey === event.pubkey && e.kind === 0);
diff --git a/client/src/components/PostCard/NewThreadCard.tsx b/client/src/components/PostCard/NewThreadCard.tsx
index 97c59d8..5049344 100644
--- a/client/src/components/PostCard/NewThreadCard.tsx
+++ b/client/src/components/PostCard/NewThreadCard.tsx
@@ -1,7 +1,7 @@
import CardContainer from './CardContainer';
import { ArrowUpTrayIcon, CpuChipIcon } from '@heroicons/react/24/outline';
import { useState } from 'react';
-import { Event, generatePrivateKey, getPublicKey, finishEvent, relayInit } from 'nostr-tools';
+import { generatePrivateKey, getPublicKey, finishEvent } from 'nostr-tools';
import { minePow } from '../../utils/mine';
import { publish } from '../../utils/relays';
import NostrImg from '../../utils/ImgUpload';
diff --git a/client/src/components/PostCard/PostCard.tsx b/client/src/components/PostCard/PostCard.tsx
index 11f0971..c780107 100644
--- a/client/src/components/PostCard/PostCard.tsx
+++ b/client/src/components/PostCard/PostCard.tsx
@@ -3,7 +3,7 @@ import { FolderIcon } from '@heroicons/react/24/outline';
import { parseContent } from '../../utils/content';
import { Event } from 'nostr-tools';
import { nip19 } from 'nostr-tools';
-import { getMetadata, uniqBy } from '../../utils/utils';
+import { getMetadata } from '../../utils/utils';
import ContentPreview from'../Modals/TextModal';
const colorCombos = [
@@ -89,7 +89,7 @@ const PostCard = ({ key, event, metadata, replyCount }: { key: string, event: Ev
-
+
{file !== "" && (
diff --git a/client/src/components/Settings.tsx b/client/src/components/Settings.tsx
index 6baa8dd..68f967f 100644
--- a/client/src/components/Settings.tsx
+++ b/client/src/components/Settings.tsx
@@ -1,5 +1,4 @@
-import React, { useState, useEffect } from 'react';
-import {generatePrivateKey, getPublicKey} from 'nostr-tools';
+import React, { useState } from 'react';
// import {powEvent} from './system';
// import {publish} from './relays';
diff --git a/client/src/components/Thread/OPCard.tsx b/client/src/components/Thread/OPCard.tsx
index af75249..247d33b 100644
--- a/client/src/components/Thread/OPCard.tsx
+++ b/client/src/components/Thread/OPCard.tsx
@@ -2,11 +2,7 @@ import CardContainer from '../PostCard/CardContainer';
import { FolderIcon } from '@heroicons/react/24/outline';
import { parseContent } from '../../utils/content';
import { Event } from 'nostr-tools';
-import { nip19 } from 'nostr-tools';
-import { useEffect, useState } from 'react';
-import { subNote } from '../../utils/subscriptions';
-import { getMetadata, uniqBy } from '../../utils/utils';
-import { getLinkPreview } from 'link-preview-js';
+import { getMetadata } from '../../utils/utils';
import ContentPreview from '../Modals/TextModal';
const colorCombos = [
@@ -58,28 +54,13 @@ const timeAgo = (unixTime: number) => {
};
const OPCard = ({ event, metadata, replyCount }: { event: Event, metadata: Event | null, replyCount: number}) => {
- // Replace 10 with the actual number of comments for each post
- const numberOfComments = 10;
const { comment, file } = parseContent(event);
const colorCombo = getColorFromHash(event.pubkey, colorCombos);
- const [isExpanded, setIsExpanded] = useState(false);
- const truncatedComment = comment.slice(0, 240);
let metadataParsed = null;
if (metadata !== null) {
metadataParsed = getMetadata(metadata);
}
-
- const [linkPreview, setLinkPreview] = useState(null);
-
- useEffect(() => {
- const urls = comment.match(/\bhttps?:\/\/\S+/gi);
- if (urls && urls.length > 0) {
- getLinkPreview(urls[0])
- .then((preview) => setLinkPreview(preview as LinkPreview))
- .catch((error) => console.error(error));
- }
- }, [comment]);
return (
<>
diff --git a/client/src/components/Thread/ReplyCard.tsx b/client/src/components/Thread/ReplyCard.tsx
index 6361a8a..33e3b3e 100644
--- a/client/src/components/Thread/ReplyCard.tsx
+++ b/client/src/components/Thread/ReplyCard.tsx
@@ -3,8 +3,6 @@ import { FolderIcon } from '@heroicons/react/24/outline';
import { parseContent } from '../../utils/content';
import { Event } from 'nostr-tools';
import { nip19 } from 'nostr-tools';
-import { useEffect, useState } from 'react';
-import { subNote } from '../../utils/subscriptions';
import { getMetadata, uniqBy } from '../../utils/utils';
import ContentPreview from '../Modals/TextModal';
diff --git a/client/src/components/Thread/Thread.tsx b/client/src/components/Thread/Thread.tsx
index 0fd9946..f06229c 100644
--- a/client/src/components/Thread/Thread.tsx
+++ b/client/src/components/Thread/Thread.tsx
@@ -3,11 +3,9 @@ import { useState } from "react";
import { Event, nip19 } from "nostr-tools"
import { subNote } from '../../utils/subscriptions';
import { useEffect } from 'react';
-import PostCard from '../PostCard/PostCard';
import { uniqBy } from '../../utils/utils';
import { DocumentTextIcon, FolderPlusIcon } from '@heroicons/react/24/outline';
-import { ArrowUpTrayIcon, CpuChipIcon } from '@heroicons/react/24/outline';
-import { generatePrivateKey, getPublicKey, finishEvent, relayInit } from 'nostr-tools';
+import { generatePrivateKey, getPublicKey, finishEvent } from 'nostr-tools';
import { minePow } from '../../utils/mine';
import { publish } from '../../utils/relays';
import ThreadPost from './ThreadPost';
@@ -28,7 +26,6 @@ const Thread = () => {
// Define your callback function for subGlobalFeed
const onEvent = (event: Event, relay: string) => {
setEvents((prevEvents) => [...prevEvents, event]);
- console.log(event.id + ' ' + event.kind + ' ' + event.tags);
};
useEffect(() => {
diff --git a/client/src/components/Thread/ThreadPost.tsx b/client/src/components/Thread/ThreadPost.tsx
index 3c14761..27f3dcc 100644
--- a/client/src/components/Thread/ThreadPost.tsx
+++ b/client/src/components/Thread/ThreadPost.tsx
@@ -1,7 +1,7 @@
import { useParams } from 'react-router-dom';
import { useState } from "react";
import { ArrowUpTrayIcon, CpuChipIcon } from '@heroicons/react/24/outline';
-import { generatePrivateKey, getPublicKey, finishEvent, relayInit } from 'nostr-tools';
+import { generatePrivateKey, getPublicKey, finishEvent } from 'nostr-tools';
import { minePow } from '../../utils/mine';
import { publish } from '../../utils/relays';
import NostrImg from '../../utils/ImgUpload';
diff --git a/client/src/index.tsx b/client/src/index.tsx
index 39219e2..949820f 100644
--- a/client/src/index.tsx
+++ b/client/src/index.tsx
@@ -3,7 +3,6 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
-import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
@@ -18,8 +17,3 @@ root.render(
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://cra.link/PWA
serviceWorkerRegistration.unregister();
-
-// If you want to start measuring performance in your app, pass a function
-// to log results (for example: reportWebVitals(console.log))
-// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
-reportWebVitals();
diff --git a/client/src/reportWebVitals.ts b/client/src/reportWebVitals.ts
deleted file mode 100644
index 49a2a16..0000000
--- a/client/src/reportWebVitals.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { ReportHandler } from 'web-vitals';
-
-const reportWebVitals = (onPerfEntry?: ReportHandler) => {
- if (onPerfEntry && onPerfEntry instanceof Function) {
- import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
- getCLS(onPerfEntry);
- getFID(onPerfEntry);
- getFCP(onPerfEntry);
- getLCP(onPerfEntry);
- getTTFB(onPerfEntry);
- });
- }
-};
-
-export default reportWebVitals;
diff --git a/client/src/utils/subscriptions.ts b/client/src/utils/subscriptions.ts
index 71b62f3..d36f053 100644
--- a/client/src/utils/subscriptions.ts
+++ b/client/src/utils/subscriptions.ts
@@ -1,6 +1,5 @@
import {sub, subOnce, unsubAll} from './relays';
import { Event } from 'nostr-tools';
-import { getPow } from './mine';
type SubCallback = (
event: Event,