mirror of
https://github.com/aljazceru/sendstr-web.git
synced 2025-12-18 23:14:23 +01:00
chore: delete commented code
This commit is contained in:
@@ -1,42 +1,13 @@
|
|||||||
import "../styles/global.css"
|
import "../styles/global.css"
|
||||||
import { AppProps } from "next/app"
|
import { AppProps } from "next/app"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
// import { getRelays } from "../lib/localStorage"
|
|
||||||
// import { NostrEventType, NostrType } from "../types"
|
|
||||||
|
|
||||||
export default function App({ Component, pageProps }: AppProps) {
|
export default function App({ Component, pageProps }: AppProps) {
|
||||||
// const [events, setEvents] = useState<{ [k: string]: NostrEventType }>({})
|
|
||||||
// const [nostr, setNostr] = useState<NostrType>({
|
|
||||||
// priv: "",
|
|
||||||
// pub: "",
|
|
||||||
// pool: null,
|
|
||||||
// sub: null,
|
|
||||||
// })
|
|
||||||
const [keys, setKeys] = useState<{
|
const [keys, setKeys] = useState<{
|
||||||
pub: string
|
pub: string
|
||||||
priv: string
|
priv: string
|
||||||
} | null>(null)
|
} | null>(null)
|
||||||
|
|
||||||
// const updateEvents = async (pub: string, priv: string, event: NostrEventType) => {
|
|
||||||
// const { decrypt } = await import("nostr-tools/nip04")
|
|
||||||
// try {
|
|
||||||
// const p = event.tags.find(([tag]) => tag === "p") || ["p", ""]
|
|
||||||
// const pubkey = event.pubkey === pub ? p[1] : event.pubkey
|
|
||||||
// const message = decrypt(priv, pubkey, event.content)
|
|
||||||
// setEvents({
|
|
||||||
// ...events,
|
|
||||||
// ...{
|
|
||||||
// [event.id]: {
|
|
||||||
// ...event,
|
|
||||||
// message,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// } catch (e) {
|
|
||||||
// console.warn(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
void (async () => {
|
void (async () => {
|
||||||
const { generatePrivateKey, getPublicKey } = await import("nostr-tools")
|
const { generatePrivateKey, getPublicKey } = await import("nostr-tools")
|
||||||
@@ -46,12 +17,5 @@ export default function App({ Component, pageProps }: AppProps) {
|
|||||||
})()
|
})()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// const getLatestEvent = (events: Record<string, NostrEventType>) =>
|
|
||||||
// Object.entries(events).reduce((acc, x) => {
|
|
||||||
// if (acc === null) return x[1]
|
|
||||||
// if (new Date(acc.created_at) < new Date(x[1].created_at)) return x[1]
|
|
||||||
// return acc
|
|
||||||
// }, null as NostrEventType | null)
|
|
||||||
|
|
||||||
return <Component {...{ ...pageProps, keys }} />
|
return <Component {...{ ...pageProps, keys }} />
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user