Collapse follow requests if > 5

This commit is contained in:
Lim Chee Aun 2023-07-06 20:32:21 +08:00
parent d7a46ba0d6
commit 5f67a29e1a
2 changed files with 48 additions and 14 deletions

View file

@ -159,6 +159,17 @@
.follow-requests { .follow-requests {
padding-block-end: 16px; padding-block-end: 16px;
} }
.follow-requests summary {
padding: 8px 16px;
cursor: pointer;
}
.follow-requests summary::marker,
.follow-requests summary::-webkit-details-marker {
color: var(--text-insignificant-color);
}
.follow-requests details[open] summary {
color: var(--text-insignificant-color);
}
.follow-requests ul { .follow-requests ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
@ -168,6 +179,9 @@
overflow: auto; overflow: auto;
border-bottom: var(--hairline-width) solid var(--outline-color); border-bottom: var(--hairline-width) solid var(--outline-color);
} }
.follow-requests summary + ul {
border-top: var(--hairline-width) solid var(--outline-color);
}
.follow-requests ul li { .follow-requests ul li {
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -286,20 +286,40 @@ function Notifications() {
{followRequests.length > 0 && ( {followRequests.length > 0 && (
<div class="follow-requests"> <div class="follow-requests">
<h2 class="timeline-header">Follow requests</h2> <h2 class="timeline-header">Follow requests</h2>
<ul> {followRequests.length > 5 ? (
{followRequests.map((account) => ( <details>
<li> <summary>{followRequests.length} follow requests</summary>
<AccountBlock account={account} /> <ul>
<FollowRequestButtons {followRequests.map((account) => (
accountID={account.id} <li>
onChange={() => { <AccountBlock account={account} />
loadFollowRequests(); <FollowRequestButtons
loadNotifications(true); accountID={account.id}
}} onChange={() => {
/> loadFollowRequests();
</li> loadNotifications(true);
))} }}
</ul> />
</li>
))}
</ul>
</details>
) : (
<ul>
{followRequests.map((account) => (
<li>
<AccountBlock account={account} />
<FollowRequestButtons
accountID={account.id}
onChange={() => {
loadFollowRequests();
loadNotifications(true);
}}
/>
</li>
))}
</ul>
)}
</div> </div>
)} )}
<div id="mentions-option"> <div id="mentions-option">