mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-12 18:29:57 -05:00
Try optimise members list.
This commit is contained in:
parent
40d0421fa2
commit
8609a1f016
3 changed files with 35 additions and 15 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit b27044c332ca419d22edbe9e7bf465a665398999
|
Subproject commit 6a71c17b37127a5f4de7ff455814dd6c4c4df542
|
|
@ -4,8 +4,12 @@ import { User } from "revolt.js/dist/maps/Users";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
import { memo } from "preact/compat";
|
||||||
|
|
||||||
import { useIntermediate } from "../../../context/intermediate/Intermediate";
|
import {
|
||||||
|
Screen,
|
||||||
|
useIntermediate,
|
||||||
|
} from "../../../context/intermediate/Intermediate";
|
||||||
|
|
||||||
import { UserButton } from "../items/ButtonItem";
|
import { UserButton } from "../items/ButtonItem";
|
||||||
|
|
||||||
|
@ -34,6 +38,31 @@ const ListCategory = styled.div<{ first?: boolean }>`
|
||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const ItemContent = memo(
|
||||||
|
({
|
||||||
|
item,
|
||||||
|
context,
|
||||||
|
openScreen,
|
||||||
|
}: {
|
||||||
|
item: User;
|
||||||
|
context: Channel;
|
||||||
|
openScreen: (screen: Screen) => void;
|
||||||
|
}) => (
|
||||||
|
<UserButton
|
||||||
|
key={item._id}
|
||||||
|
user={item}
|
||||||
|
margin
|
||||||
|
context={context}
|
||||||
|
onClick={() =>
|
||||||
|
openScreen({
|
||||||
|
id: "profile",
|
||||||
|
user_id: item._id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
export default function MemberList({
|
export default function MemberList({
|
||||||
entries,
|
entries,
|
||||||
context,
|
context,
|
||||||
|
@ -74,17 +103,10 @@ export default function MemberList({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<UserButton
|
<ItemContent
|
||||||
key={item._id}
|
item={item}
|
||||||
user={item}
|
|
||||||
margin
|
|
||||||
context={context}
|
context={context}
|
||||||
onClick={() =>
|
openScreen={openScreen}
|
||||||
openScreen({
|
|
||||||
id: "profile",
|
|
||||||
user_id: item._id,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -79,9 +79,7 @@ export const Members = observer(({ server }: Props) => {
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
{selected === member._id.user && (
|
{selected === member._id.user && (
|
||||||
<div
|
<div className={styles.memberView}>
|
||||||
key={`drop_${member._id.user}`}
|
|
||||||
className={styles.memberView}>
|
|
||||||
<Overline type="subtle">Roles</Overline>
|
<Overline type="subtle">Roles</Overline>
|
||||||
{Object.keys(server.roles ?? {}).map(
|
{Object.keys(server.roles ?? {}).map(
|
||||||
(key) => {
|
(key) => {
|
||||||
|
|
Loading…
Reference in a new issue