Skip to content
Snippets Groups Projects
Commit fd03c64d authored by insert's avatar insert
Browse files

Show friend requests on top-right avatar.

parent e12ebc9b
Branches
No related merge requests found
......@@ -66,16 +66,7 @@ function HomeSidebar(props: Props) {
.filter((x) => x.channel_type !== "SavedMessages")
.map((x) => mapChannelWithUnread(x, props.unreads));
const users = useUsers(
(
channelsArr as (
| Channels.DirectMessageChannel
| Channels.GroupChannel
)[]
).reduce((prev: any, cur) => [...prev, ...cur.recipients], []),
ctx,
);
const users = useUsers(undefined, ctx);
channelsArr.sort((b, a) => a.timestamp.localeCompare(b.timestamp));
return (
......
import { Plus } from "@styled-icons/boxicons-regular";
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 { attachContextMenu, openContextMenu } from "preact-context-menu";
......@@ -19,6 +19,7 @@ import {
useForceUpdate,
useSelf,
useServers,
useUsers,
} from "../../../context/revoltjs/hooks";
import logoSVG from "../../../assets/logo.svg";
......@@ -56,7 +57,7 @@ function Icon({
<circle cx="27" cy="5" r="5" fill={"white"} />
)}
{unread === "mention" && (
<circle cx="27" cy="5" r="5" fill={"red"} />
<circle cx="27" cy="5" r="5" fill={"var(--error)"} />
)}
</svg>
);
......@@ -184,6 +185,7 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) {
const channels = (useChannels(undefined, ctx) as Channel[]).map((x) =>
mapChannelWithUnread(x, unreads),
);
const users = useUsers(undefined, ctx);
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";
const homeActive =
typeof server === "undefined" && !path.startsWith("/invite");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment