From 8b5295dd27db1d192ca1e3c40f9eec3bb2904b66 Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Mon, 30 Oct 2023 23:13:27 +1100 Subject: [PATCH] more tings working now --- client/src/components/Home.tsx | 2 +- client/src/components/Settings.tsx | 75 ++++++++++++---------- client/src/components/Thread/ReplyCard.tsx | 1 - client/src/utils/{relays.tsx => relays.ts} | 2 +- client/src/utils/subscriptions.ts | 17 ----- 5 files changed, 42 insertions(+), 55 deletions(-) rename client/src/utils/{relays.tsx => relays.ts} (98%) diff --git a/client/src/components/Home.tsx b/client/src/components/Home.tsx index 0f444d1..2d89dee 100644 --- a/client/src/components/Home.tsx +++ b/client/src/components/Home.tsx @@ -35,7 +35,7 @@ const Home = () => { const filteredAndSortedEvents = uniqEvents .filter(event => - getPow(event.id) > Math.ceil(Number(filterDifficulty)/4) && + getPow(event.id) > Number(filterDifficulty) && event.kind === 1 && !event.tags.some(tag => tag[0] === 'e') ) diff --git a/client/src/components/Settings.tsx b/client/src/components/Settings.tsx index e033f2b..38d5977 100644 --- a/client/src/components/Settings.tsx +++ b/client/src/components/Settings.tsx @@ -1,6 +1,7 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; // import {powEvent} from './system'; // import {publish} from './relays'; +import { addRelay } from '../utils/relays'; const Settings = () => { const [filterDifficulty, setFilterDifficulty] = useState(localStorage.getItem('filterDifficulty') || 20); @@ -19,42 +20,46 @@ const Settings = () => { window.dispatchEvent(event); }; - return ( -
-

Settings

-
-
-
- - setFilterDifficulty(e.target.value)} - className="w-full px-3 py-2 border rounded-md text-black" - /> -
+// useEffect(() => { +// addRelay('wss://powrelay.xyz'); +// }, []); -
- - setDifficulty(e.target.value)} - className="w-full px-3 py-2 border rounded-md text-black" - /> -
+ return ( +
+

Settings

+ +
+
+ + setFilterDifficulty(e.target.value)} + className="w-full px-3 py-2 border rounded-md text-black" + /> +
+ +
+ + setDifficulty(e.target.value)} + className="w-full px-3 py-2 border rounded-md text-black" + /> +
+
+ +
- - -
); }; diff --git a/client/src/components/Thread/ReplyCard.tsx b/client/src/components/Thread/ReplyCard.tsx index 231cef3..c839871 100644 --- a/client/src/components/Thread/ReplyCard.tsx +++ b/client/src/components/Thread/ReplyCard.tsx @@ -6,7 +6,6 @@ import { nip19 } from 'nostr-tools'; import { getMetadata, uniqBy } from '../../utils/utils'; import ContentPreview from '../Modals/TextModal'; import { useEffect, useState } from 'react'; -import { subPubkeysMetadata } from '../../utils/subscriptions'; const colorCombos = [ 'from-red-400 to-yellow-500', diff --git a/client/src/utils/relays.tsx b/client/src/utils/relays.ts similarity index 98% rename from client/src/utils/relays.tsx rename to client/src/utils/relays.ts index 6bb9703..5e2eca3 100644 --- a/client/src/utils/relays.tsx +++ b/client/src/utils/relays.ts @@ -103,4 +103,4 @@ addRelay('wss://nostr.bitcoiner.social'); addRelay('wss://nostr.mom'); addRelay('wss://relay.nostr.bg'); addRelay('wss://nos.lol'); -// addRelay('wss://relay.nostr.ch'); \ No newline at end of file +addRelay('wss://powrelay.xyz'); \ No newline at end of file diff --git a/client/src/utils/subscriptions.ts b/client/src/utils/subscriptions.ts index 345d93b..d36f053 100644 --- a/client/src/utils/subscriptions.ts +++ b/client/src/utils/subscriptions.ts @@ -202,21 +202,4 @@ export const subNoteOnce = ( }); pubkeys.clear(); }, 2000); -}; - -export const subPubkeysMetadata = ( - pubkeys: string[], - onEvent: SubCallback, -) => { - unsubAll(); - // get metadata - sub({ - cb: onEvent, - filter: { - authors: pubkeys, - kinds: [0], - limit: pubkeys.length, - }, - unsub: true, - }); }; \ No newline at end of file