import { useRouter } from 'next/router' import { Select, DatePicker } from './form' import { WHENS } from '@/lib/constants' import { whenToFrom } from '@/lib/time' export function UsageHeader ({ pathname = null }) { const router = useRouter() const path = pathname || 'stackers' const select = async values => { const { when, ...query } = values if (when !== 'custom') { delete query.from; delete query.to } if (query.from && !query.to) return await router.push({ pathname: `/${path}/${when}`, query }) } const when = router.query.when || 'day' return (