Auto-open details and hide summary button

Only show toggle comments button if there are many statuses
This commit is contained in:
Lim Chee Aun 2022-12-19 10:05:27 +08:00
parent 141f4a94dc
commit 681dfaaaff

View file

@ -175,6 +175,8 @@ function StatusPage({ id }) {
return statuses.length - limit;
}, [statuses.length, limit]);
const hasManyStatuses = statuses.length > 40;
return (
<div class="deck-backdrop">
<Link href={closeLink}></Link>
@ -229,8 +231,8 @@ function StatusPage({ id }) {
</Link>
)}
{descendant && replies?.length > 0 && (
<details class="replies">
<summary>
<details class="replies" open={!hasManyStatuses}>
<summary hidden={!hasManyStatuses}>
{replies.length} repl{replies.length === 1 ? 'y' : 'ies'}
</summary>
<ul>