mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
Show friend requests on top-right avatar.
This commit is contained in:
parent
e12ebc9b0d
commit
fd03c64d92
2 changed files with 9 additions and 12 deletions
|
@ -66,16 +66,7 @@ function HomeSidebar(props: Props) {
|
||||||
.filter((x) => x.channel_type !== "SavedMessages")
|
.filter((x) => x.channel_type !== "SavedMessages")
|
||||||
.map((x) => mapChannelWithUnread(x, props.unreads));
|
.map((x) => mapChannelWithUnread(x, props.unreads));
|
||||||
|
|
||||||
const users = useUsers(
|
const users = useUsers(undefined, ctx);
|
||||||
(
|
|
||||||
channelsArr as (
|
|
||||||
| Channels.DirectMessageChannel
|
|
||||||
| Channels.GroupChannel
|
|
||||||
)[]
|
|
||||||
).reduce((prev: any, cur) => [...prev, ...cur.recipients], []),
|
|
||||||
ctx,
|
|
||||||
);
|
|
||||||
|
|
||||||
channelsArr.sort((b, a) => a.timestamp.localeCompare(b.timestamp));
|
channelsArr.sort((b, a) => a.timestamp.localeCompare(b.timestamp));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Plus } from "@styled-icons/boxicons-regular";
|
import { Plus } from "@styled-icons/boxicons-regular";
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useLocation, useParams } from "react-router-dom";
|
||||||
import { Channel, Servers } from "revolt.js/dist/api/objects";
|
import { Channel, Servers, Users } from "revolt.js/dist/api/objects";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
|
||||||
import { attachContextMenu, openContextMenu } from "preact-context-menu";
|
import { attachContextMenu, openContextMenu } from "preact-context-menu";
|
||||||
|
@ -19,6 +19,7 @@ import {
|
||||||
useForceUpdate,
|
useForceUpdate,
|
||||||
useSelf,
|
useSelf,
|
||||||
useServers,
|
useServers,
|
||||||
|
useUsers,
|
||||||
} from "../../../context/revoltjs/hooks";
|
} from "../../../context/revoltjs/hooks";
|
||||||
|
|
||||||
import logoSVG from "../../../assets/logo.svg";
|
import logoSVG from "../../../assets/logo.svg";
|
||||||
|
@ -56,7 +57,7 @@ function Icon({
|
||||||
<circle cx="27" cy="5" r="5" fill={"white"} />
|
<circle cx="27" cy="5" r="5" fill={"white"} />
|
||||||
)}
|
)}
|
||||||
{unread === "mention" && (
|
{unread === "mention" && (
|
||||||
<circle cx="27" cy="5" r="5" fill={"red"} />
|
<circle cx="27" cy="5" r="5" fill={"var(--error)"} />
|
||||||
)}
|
)}
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
@ -184,6 +185,7 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) {
|
||||||
const channels = (useChannels(undefined, ctx) as Channel[]).map((x) =>
|
const channels = (useChannels(undefined, ctx) as Channel[]).map((x) =>
|
||||||
mapChannelWithUnread(x, unreads),
|
mapChannelWithUnread(x, unreads),
|
||||||
);
|
);
|
||||||
|
const users = useUsers(undefined, ctx);
|
||||||
|
|
||||||
const unreadChannels = channels.filter((x) => x.unread).map((x) => x._id);
|
const unreadChannels = channels.filter((x) => x.unread).map((x) => x._id);
|
||||||
|
|
||||||
|
@ -228,6 +230,10 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (users.find((x) => x?.relationship === Users.Relationship.Incoming)) {
|
||||||
|
alertCount++;
|
||||||
|
}
|
||||||
|
|
||||||
if (alertCount > 0) homeUnread = "mention";
|
if (alertCount > 0) homeUnread = "mention";
|
||||||
const homeActive =
|
const homeActive =
|
||||||
typeof server === "undefined" && !path.startsWith("/invite");
|
typeof server === "undefined" && !path.startsWith("/invite");
|
||||||
|
|
Loading…
Reference in a new issue