Switch to React Virtuoso from react-window

This commit is contained in:
Paul
2021-08-08 20:28:47 +01:00
parent a3e2ed3b94
commit a19ff58e12
5 changed files with 105 additions and 148 deletions

View File

@@ -14,7 +14,7 @@ import {
} from "../../../context/revoltjs/RevoltClient";
import { GenericSidebarBase } from "../SidebarBase";
import MemberList from "./MemberList";
import MemberList, { MemberListGroup } from "./MemberList";
export default function MemberSidebar({ channel: obj }: { channel?: Channel }) {
const { channel: channel_id } = useParams<{ channel: string }>();
@@ -73,20 +73,20 @@ function useEntries(channel: Channel, keys: string[], isServer?: boolean) {
categories[key].sort((a, b) => a[1].localeCompare(b[1])),
);
const entries = [];
const entries: MemberListGroup[] = [];
if (categories.online.length > 0) {
entries.push(
`online:${categories.online.length}`,
...categories.online.map((x) => x[0]),
);
entries.push({
type: "online",
users: categories.online.map((x) => x[0]),
});
}
if (categories.offline.length > 0) {
entries.push(
`offline:${categories.offline.length}`,
...categories.offline.map((x) => x[0]),
);
entries.push({
type: "offline",
users: categories.offline.map((x) => x[0]),
});
}
return entries;