diff --git a/src/components/Settings.jsx b/src/components/Settings.jsx
new file mode 100644
index 0000000..4d28c22
--- /dev/null
+++ b/src/components/Settings.jsx
@@ -0,0 +1,89 @@
+// deno-lint-ignore-file no-explicit-any
+import { useState } from "react";
+import { useAtom } from "react-atomize-store";
+import { useNavigate } from "react-router-dom";
+import { sendSignEvent } from "../utils";
+import { useNostr } from "../context/NostrProvider";
+
+const Settings = () => {
+ const [keypair] = useAtom("keypair");
+ const navigate = useNavigate();
+ const { publish } = useNostr();
+
+ if (!keypair.pk) return navigate("/");
+
+ const onRevokeKey = () => {
+ sendSignEvent({
+ kind: 5,
+ content: "delete",
+ tags: [
+ ["p", keypair.pk],
+ ["intent", "delete"],
+ ],
+ keypair,
+ publish,
+ }).then(() => navigate("/"));
+ };
+
+ // d04dacdd491a8221359c5a100010dc44b59e14a0d9c3cc1067b4431e438e2fb7
+
+ return (
+
+
Settings
+
+ {keypair.sk !== "nip07" && }
+
+
+
+ );
+};
+
+const Keys = ({ keypair }) => {
+ const [showSk, setShowSk] = useState({ enable: false, show: false });
+
+ return (
+
+
+
Public key
+
{keypair.pk}
+
+
+
Private key
+
{!showSk.show ? "*".repeat(keypair.sk.length) : keypair.sk}
+
+
+ {!showSk.enable && (
+
+ )}
+
+ {showSk.enable && (
+
+ )}
+
+ );
+};
+
+export default Settings;
diff --git a/src/components/Snip.jsx b/src/components/Snip.jsx
index 22a0a4b..af908e0 100644
--- a/src/components/Snip.jsx
+++ b/src/components/Snip.jsx
@@ -4,21 +4,21 @@ import SyntaxHighlighter from "react-syntax-highlighter";
import { dracula } from "react-syntax-highlighter/dist/esm/styles/hljs";
import { useNostr } from "../context/NostrProvider";
import { useAtom } from "react-atomize-store";
+import { useNavigate } from "react-router-dom";
const Snip = ({ events }) => {
const [keypair] = useAtom("keypair");
+ const navigate = useNavigate();
const { publish } = useNostr();
const onDeleteSnip = (id) => {
- // console.log("delete", id);
-
sendSignEvent({
kind: 5,
content: "deleted",
tags: [["e", id]],
keypair,
publish,
- }).then(() => console.log("deleted"));
+ }).then(() => navigate("/"));
};
return (
diff --git a/src/pages/Profile.jsx b/src/pages/Profile.jsx
index 097c502..bb35083 100644
--- a/src/pages/Profile.jsx
+++ b/src/pages/Profile.jsx
@@ -1,13 +1,21 @@
-import { useParams } from "react-router-dom";
+import { useParams, Link } from "react-router-dom";
import { useNostrEvents } from "../context/NostrProvider";
import Snip from "../components/Snip";
import { shortPubKey } from "../utils";
import { Loading } from "../components/Loading";
import { TOPIC } from "../config";
+import Settings from "../components/Settings";
+import { useAtom } from "react-atomize-store";
const Profile = () => {
const { id } = useParams();
+ return {id !== "profile" ? : }
;
+};
+
+const Set = ({ id }) => {
+ const [keypair] = useAtom("keypair");
+
const { events, isLoading } = useNostrEvents({
filter: {
"#t": [TOPIC],
@@ -18,11 +26,11 @@ const Profile = () => {
});
return (
-
+ <>
Profile {shortPubKey(id, 10)}
-
+ {id === keypair.pk && Settings}
{isLoading ? : }
-
+ >
);
};
diff --git a/src/styles/Comments.scss b/src/styles/Comments.scss
index 829825e..31a8cdc 100644
--- a/src/styles/Comments.scss
+++ b/src/styles/Comments.scss
@@ -3,7 +3,7 @@
}
.container {
- background-color: #fff;
+ margin: 20px 0;
}
button {
@@ -223,3 +223,7 @@ button {
.pointer {
cursor: pointer;
}
+
+.col-2 {
+ margin: 15px 0;
+}