summaryrefslogtreecommitdiff
path: root/gui/src/components/post/wrappers
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 10:13:39 +0700
committerpolwex <polwex@sortug.com>2025-10-06 10:13:39 +0700
commit8751ba26ebf7b7761b9e237f2bf3453623dd1018 (patch)
treedc37f12b3fd9b1a1e7a1b54a51c80697f37a04e8 /gui/src/components/post/wrappers
parent6704650dcfccf609ccc203308df9004e0b511bb6 (diff)
added frontend WS connection for demonstration purposes
Diffstat (limited to 'gui/src/components/post/wrappers')
-rw-r--r--gui/src/components/post/wrappers/Nostr.tsx15
-rw-r--r--gui/src/components/post/wrappers/NostrIcon.tsx25
2 files changed, 40 insertions, 0 deletions
diff --git a/gui/src/components/post/wrappers/Nostr.tsx b/gui/src/components/post/wrappers/Nostr.tsx
new file mode 100644
index 0000000..2782fb8
--- /dev/null
+++ b/gui/src/components/post/wrappers/Nostr.tsx
@@ -0,0 +1,15 @@
+import type { NostrMetadata, NostrPost } from "@/types/nostrill";
+import Post from "../Post";
+import useLocalState from "@/state/state";
+
+export default NostrPost;
+function NostrPost({ data }: { data: NostrPost }) {
+ const { profiles } = useLocalState((s) => ({ profiles: s.profiles }));
+ const profile = profiles.get(data.event.pubkey);
+
+ return <Post poast={data.post} profile={profile} />;
+}
+
+export function NostrSnippet({ eventId, pubkey, relay }: NostrMetadata) {
+ return <div>wtf</div>;
+}
diff --git a/gui/src/components/post/wrappers/NostrIcon.tsx b/gui/src/components/post/wrappers/NostrIcon.tsx
new file mode 100644
index 0000000..30fbfe9
--- /dev/null
+++ b/gui/src/components/post/wrappers/NostrIcon.tsx
@@ -0,0 +1,25 @@
+import Icon from "@/components/Icon";
+import useLocalState from "@/state/state";
+import toast from "react-hot-toast";
+import type { Poast } from "@/types/trill";
+export default function ({ poast }: { poast: Poast }) {
+ const { relays, api } = useLocalState((s) => ({
+ relays: s.relays,
+ api: s.api,
+ }));
+
+ async function sendToRelay(e: React.MouseEvent) {
+ e.stopPropagation();
+ //
+ const urls = Object.keys(relays);
+ await api!.relayPost(poast.host, poast.id, urls);
+ toast.success("Post relayed");
+ }
+ // TODO round up all helpers
+
+ return (
+ <div className="icon" role="link" onMouseUp={sendToRelay}>
+ <Icon name="nostr" size={20} title="relay to nostr" />
+ </div>
+ );
+}