import Comment, { CommentSkeleton } from './comment' import styles from './header.module.css' import Nav from 'react-bootstrap/Nav' import Navbar from 'react-bootstrap/Navbar' import { abbrNum } from '../lib/format' import { defaultCommentSort } from '../lib/item' import { useRouter } from 'next/router' export function CommentsHeader ({ handleSort, pinned, bio, parentCreatedAt, commentSats }) { const router = useRouter() const sort = router.query.sort || defaultCommentSort(pinned, bio, parentCreatedAt) const getHandleClick = sort => { return () => { handleSort(sort) } } return ( ) } export default function Comments ({ parentId, pinned, bio, parentCreatedAt, commentSats, comments, ...props }) { const router = useRouter() return ( <> {comments?.length > 0 ? { const query = router.query delete query.nodata router.push({ pathname: router.pathname, query: { ...router.query, sort } }, router.asPath, { scroll: false }) }} /> : null} {comments.map(item => ( ))} ) } export function CommentsSkeleton () { return }