import { useArk } from "@lume/ark"; import { LoaderIcon } from "@lume/icons"; import { Dispatch, SetStateAction, useState } from "react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; export function AvatarUploadButton({ setPicture, }: { setPicture: Dispatch>; }) { const ark = useArk(); const [t] = useTranslation(); const [loading, setLoading] = useState(false); const uploadAvatar = async () => { try { // start loading setLoading(true); const image = await ark.upload({ fileExts: [] }); if (image) { setPicture(image); setLoading(false); } } catch (e) { setLoading(false); toast.error(String(e)); } }; return ( ); }