mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 07:22:10 -05:00
Merge pull request #60 from janderedev/pr-5
This commit is contained in:
commit
4d9c324326
1 changed files with 36 additions and 0 deletions
|
@ -11,6 +11,7 @@ import { Localizer, Text } from "preact-i18n";
|
|||
import { useContext, useEffect, useLayoutEffect, useState } from "preact/hooks";
|
||||
|
||||
import ChannelIcon from "../../../components/common/ChannelIcon";
|
||||
import ServerIcon from "../../../components/common/ServerIcon";
|
||||
import Tooltip from "../../../components/common/Tooltip";
|
||||
import UserIcon from "../../../components/common/user/UserIcon";
|
||||
import { Username } from "../../../components/common/user/UserShort";
|
||||
|
@ -73,6 +74,10 @@ export const UserProfile = observer(
|
|||
channel.recipient_ids!.includes(user_id),
|
||||
);
|
||||
|
||||
const mutualServers = mutual?.servers.map((id) =>
|
||||
client.servers.get(id),
|
||||
);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!user_id) return;
|
||||
if (typeof profile !== "undefined") setProfile(undefined);
|
||||
|
@ -218,6 +223,11 @@ export const UserProfile = observer(
|
|||
onClick={() => setTab("groups")}>
|
||||
<Text id="app.special.popovers.user_profile.mutual_groups" />
|
||||
</div>
|
||||
<div
|
||||
data-active={tab === "servers"}
|
||||
onClick={() => setTab("servers")}>
|
||||
<Text id="app.special.popovers.user_profile.mutual_servers" />
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
@ -418,6 +428,32 @@ export const UserProfile = observer(
|
|||
)}
|
||||
</div>
|
||||
)}
|
||||
{tab === "servers" && (
|
||||
<div className={styles.entries}>
|
||||
{!mutualServers || mutualServers.length === 0 ? (
|
||||
<div className={styles.empty}>
|
||||
<Text id="app.special.popovers.user_profile.no_servers" />
|
||||
</div>
|
||||
) : (
|
||||
mutualServers.map(
|
||||
(x) =>
|
||||
x && (
|
||||
<Link to={`/server/${x._id}`}>
|
||||
<div
|
||||
className={styles.entry}
|
||||
key={x._id}>
|
||||
<ServerIcon
|
||||
target={x}
|
||||
size={32}
|
||||
/>
|
||||
<span>{x.name}</span>
|
||||
</div>
|
||||
</Link>
|
||||
),
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue