import { AvatarUploader } from "@/components/avatarUploader"; import { PlusIcon } from "@lume/icons"; import type { Metadata } from "@lume/types"; import { Spinner } from "@lume/ui"; import { Link } from "@tanstack/react-router"; import { createFileRoute } from "@tanstack/react-router"; import { useState } from "react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; export const Route = createFileRoute("/settings/user")({ beforeLoad: async ({ context }) => { const ark = context.ark; const profile = await ark.get_current_user_profile(); return { profile }; }, component: Screen, }); function Screen() { const { ark, profile } = Route.useRouteContext(); const { register, handleSubmit } = useForm(); const [loading, setLoading] = useState(false); const [picture, setPicture] = useState(""); const onSubmit = async (data: Metadata) => { try { setLoading(true); const profile = { ...data, picture }; await ark.create_profile(profile); setLoading(false); } catch (e) { setLoading(false); toast.error(String(e)); } }; return (
{profile.picture ? ( avatar ) : null}
{profile.display_name}
{profile.nip05}
Backup Account
); }