import PatronRoute from "../components/protected-route"; import { useMutateMetadata, useMetadata } from "../profile/hooks/useMetadata"; import { faCheckCircle } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import VibrateTest from "./vibrate-test"; import { useState, useEffect } from "react"; import { faSpinner, faXmarkCircle, faSave } from "@fortawesome/free-solid-svg-icons"; import Skeleton, { SkeletonTheme } from "react-loading-skeleton" import 'react-loading-skeleton/dist/skeleton.css'; export default function PatronPerks() { const { status, data, error, isFetching, isPending } = useMetadata() const mutateMetadata = useMutateMetadata() const username = `${data?.metadata?.first_name || ''} ${data?.metadata?.last_name || ''}`.trim(); const { metadata } = data || {}; const [ isUsernamePublic, setIsUsernamePublic ] = useState(metadata?.isUsernamePublic || false) useEffect(() => { mutateMetadata.mutate({ isUsernamePublic }) }, [ isUsernamePublic ]) return ( <>