mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-29 02:10:59 -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 { useContext, useEffect, useLayoutEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
import ChannelIcon from "../../../components/common/ChannelIcon";
|
import ChannelIcon from "../../../components/common/ChannelIcon";
|
||||||
|
import ServerIcon from "../../../components/common/ServerIcon";
|
||||||
import Tooltip from "../../../components/common/Tooltip";
|
import Tooltip from "../../../components/common/Tooltip";
|
||||||
import UserIcon from "../../../components/common/user/UserIcon";
|
import UserIcon from "../../../components/common/user/UserIcon";
|
||||||
import { Username } from "../../../components/common/user/UserShort";
|
import { Username } from "../../../components/common/user/UserShort";
|
||||||
|
@ -73,6 +74,10 @@ export const UserProfile = observer(
|
||||||
channel.recipient_ids!.includes(user_id),
|
channel.recipient_ids!.includes(user_id),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const mutualServers = mutual?.servers.map((id) =>
|
||||||
|
client.servers.get(id),
|
||||||
|
);
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!user_id) return;
|
if (!user_id) return;
|
||||||
if (typeof profile !== "undefined") setProfile(undefined);
|
if (typeof profile !== "undefined") setProfile(undefined);
|
||||||
|
@ -218,6 +223,11 @@ export const UserProfile = observer(
|
||||||
onClick={() => setTab("groups")}>
|
onClick={() => setTab("groups")}>
|
||||||
<Text id="app.special.popovers.user_profile.mutual_groups" />
|
<Text id="app.special.popovers.user_profile.mutual_groups" />
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
data-active={tab === "servers"}
|
||||||
|
onClick={() => setTab("servers")}>
|
||||||
|
<Text id="app.special.popovers.user_profile.mutual_servers" />
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -418,6 +428,32 @@ export const UserProfile = observer(
|
||||||
)}
|
)}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue