import copy from "copy-text-to-clipboard"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import prettyBytes from "pretty-bytes"; import Link from "next/link"; import Layout from "../components/Layout"; import { SkynetClient } from "skynet-js"; import config from "../config"; import useAccountsApi from "../services/useAccountsApi"; import React from "react"; dayjs.extend(relativeTime); const skynetClient = new SkynetClient(`https://${process.env.NEXT_PUBLIC_PORTAL_DOMAIN}`); function SkylinkList({ items = [], timestamp }) { return ( ); } export default function Home() { const { data: prices } = useAccountsApi("stripe/prices"); const { data: user } = useAccountsApi("user"); const { data: stats } = useAccountsApi("user/stats"); const { data: downloads } = useAccountsApi("user/downloads?pageSize=3&offset=0"); const { data: uploads } = useAccountsApi("user/uploads?pageSize=3&offset=0"); const [plans, setPlans] = React.useState([config.tiers.starter]); React.useEffect(() => { if (prices) setPlans((plans) => [...plans, ...prices].sort((a, b) => a.tier - b.tier)); }, [setPlans, prices]); const activePlan = plans.find(({ tier }) => user && user.tier === tier); return (
{/* Heroicon name: outline/users */}
Current plan
{activePlan?.name}
Storage used
{prettyBytes(stats?.totalUploadsSize ?? 0)}
{/*
Bandwidth used
{prettyBytes(stats?.bwDownloads ?? 0)}
*/}
{/* ============ */}

Recent downloads

{/* This example requires Tailwind CSS v2.0+ */}

Recent uploads

{/* This example requires Tailwind CSS v2.0+ */}
); }