import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import { FormattedMessage } from "react-intl"; import { hexToBech32, unwrap } from "@snort/shared"; import { useLogin } from "@/hooks/login"; import Copy from "@/element/copy"; import { NostrProviderDialog } from "@/element/nostr-provider-dialog"; import { useStreamProvider } from "@/hooks/stream-provider"; import { Login } from ".."; import { StatePill } from "@/element/state-pill"; import { NostrStreamProvider } from "@/providers"; import { StreamState } from "@/const"; import AsyncButton from "@/element/async-button"; const enum Tab { Account, Notifications, } export function SettingsPage() { const navigate = useNavigate(); const login = useLogin(); const [tab, setTab] = useState(Tab.Account); const providers = useStreamProvider(); useEffect(() => { if (!login) { navigate("/"); } }, [login]); function tabContent() { switch (tab) { case Tab.Account: { return ( <>

{login?.pubkey && (

)} {login?.privateKey && (

)}

{["#7F006A", "#E206BF", "#7406E2", "#3F06E2", "#393939", "#ff563f", "#ff8d2b", "#34d2fe"].map(a => (
Login.setColor(a)}>
))}

a.name === "zap.stream")) as NostrStreamProvider} showEndpoints={true} showEditor={false} showForwards={true} />
); } } } function tabName(t: Tab) { switch (t) { case Tab.Account: return ; } } return (

{[Tab.Account].map(t => ( setTab(t)} className="rounded-xl px-3 py-2 bg-gray-2 hover:bg-gray-1"> {tabName(t)} ))}
{tabContent()}
); }