import { formatBytes } from '@/lib/format' import { useEffect, useState } from 'react' import { useKeyHash, useKeyUpdatedAt } from '@/wallets/client/context' import { useRemoteKeyHash, useRemoteKeyHashUpdatedAt, useWalletsUpdatedAt } from '@/wallets/client/hooks' import { timeSince } from '@/lib/time' export function WalletDebugSettings () { const localKeyHash = useKeyHash() const localKeyUpdatedAt = useKeyUpdatedAt() const remoteKeyHash = useRemoteKeyHash() const remoteKeyHashUpdatedAt = useRemoteKeyHashUpdatedAt() const walletsUpdatedAt = useWalletsUpdatedAt() const [persistent, setPersistent] = useState(null) const [quota, setQuota] = useState(null) const [usage, setUsage] = useState(null) useEffect(() => { async function init () { try { const persistent = await navigator.storage.persisted() setPersistent(persistent) } catch (err) { console.error('failed to check persistent storage:', err) } try { const estimate = await navigator.storage.estimate() setQuota(estimate.quota) setUsage(estimate.usage) } catch (err) { console.error('failed to get estimate:', err) } } init() }, []) return (