From 4b016c908dda2019f3bf89e5a3d2eae535e5fbd2 Mon Sep 17 00:00:00 2001
From: polwex <polwex@sortug.com>
Date: Thu, 18 Sep 2025 00:24:39 +0700
Subject: oioi

---
 front/src/components/modals/UserModal.tsx | 65 +++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 front/src/components/modals/UserModal.tsx

(limited to 'front/src/components/modals/UserModal.tsx')

diff --git a/front/src/components/modals/UserModal.tsx b/front/src/components/modals/UserModal.tsx
new file mode 100644
index 0000000..6e3089d
--- /dev/null
+++ b/front/src/components/modals/UserModal.tsx
@@ -0,0 +1,65 @@
+import Modal from "./Modal";
+import Avatar from "../Avatar";
+import Icon from "@/components/Icon";
+import useLocalState from "@/state/state";
+import { useLocation } from "wouter";
+import toast from "react-hot-toast";
+import type { UserType } from "@/types/nostrill";
+
+export default function ({
+  user,
+  userString,
+}: {
+  user: UserType;
+  userString: string;
+}) {
+  const { setModal, api, pubkey } = useLocalState((s) => ({
+    setModal: s.setModal,
+    api: s.api,
+    pubkey: s.pubkey,
+  }));
+  const [_, navigate] = useLocation();
+  function close() {
+    setModal(null);
+  }
+  const itsMe =
+    "urbit" in user
+      ? user.urbit === api?.airlock.our
+      : "nostr" in user
+        ? user.nostr === pubkey
+        : false;
+  async function copy(e: React.MouseEvent) {
+    e.stopPropagation();
+    await navigator.clipboard.writeText(userString);
+    toast.success("Copied to clipboard");
+  }
+  return (
+    <Modal close={close}>
+      <div id="ship-modal">
+        <div className="flex">
+          <Avatar user={user} userString={userString} size={60} />
+          <Icon
+            name="copy"
+            size={20}
+            className="copy-icon cp"
+            onClick={copy}
+            title="Copy ship name"
+          />
+        </div>
+        <div className="buttons f1">
+          <button onClick={() => navigate(`/feed/${userString}`)}>Feed</button>
+          <button onClick={() => navigate(`/pals/${userString}`)}>
+            Profile
+          </button>
+          {itsMe && (
+            <>
+              <button onClick={() => navigate(`/chat/dm/${userString}`)}>
+                DM
+              </button>
+            </>
+          )}
+        </div>
+      </div>
+    </Modal>
+  );
+}
-- 
cgit v1.2.3

