mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-08 01:45:28 +00:00
feat: switch to revolt.js@6.0.0 + new revolt-api
This commit is contained in:
@@ -2,7 +2,6 @@ import { X, Plus } from "@styled-icons/boxicons-regular";
|
||||
import { PhoneCall, Envelope, UserX } from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||
import { User } from "revolt.js/dist/maps/Users";
|
||||
|
||||
import styles from "./Friend.module.scss";
|
||||
@@ -33,7 +32,7 @@ export const Friend = observer(({ user }: Props) => {
|
||||
const actions: Children[] = [];
|
||||
let subtext: Children = null;
|
||||
|
||||
if (user.relationship === RelationshipStatus.Friend) {
|
||||
if (user.relationship === "Friend") {
|
||||
subtext = <UserStatus user={user} />;
|
||||
actions.push(
|
||||
<>
|
||||
@@ -70,7 +69,7 @@ export const Friend = observer(({ user }: Props) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (user.relationship === RelationshipStatus.Incoming) {
|
||||
if (user.relationship === "Incoming") {
|
||||
actions.push(
|
||||
<IconButton
|
||||
type="circle"
|
||||
@@ -83,14 +82,14 @@ export const Friend = observer(({ user }: Props) => {
|
||||
subtext = <Text id="app.special.friends.incoming" />;
|
||||
}
|
||||
|
||||
if (user.relationship === RelationshipStatus.Outgoing) {
|
||||
if (user.relationship === "Outgoing") {
|
||||
subtext = <Text id="app.special.friends.outgoing" />;
|
||||
}
|
||||
|
||||
if (
|
||||
user.relationship === RelationshipStatus.Friend ||
|
||||
user.relationship === RelationshipStatus.Outgoing ||
|
||||
user.relationship === RelationshipStatus.Incoming
|
||||
user.relationship === "Friend" ||
|
||||
user.relationship === "Outgoing" ||
|
||||
user.relationship === "Incoming"
|
||||
) {
|
||||
actions.push(
|
||||
<IconButton
|
||||
@@ -103,7 +102,7 @@ export const Friend = observer(({ user }: Props) => {
|
||||
onClick={(ev) =>
|
||||
stopPropagation(
|
||||
ev,
|
||||
user.relationship === RelationshipStatus.Friend
|
||||
user.relationship === "Friend"
|
||||
? openScreen({
|
||||
id: "special_prompt",
|
||||
type: "unfriend_user",
|
||||
@@ -117,7 +116,7 @@ export const Friend = observer(({ user }: Props) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (user.relationship === RelationshipStatus.Blocked) {
|
||||
if (user.relationship === "Blocked") {
|
||||
actions.push(
|
||||
<IconButton
|
||||
type="circle"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { ChevronRight } from "@styled-icons/boxicons-regular";
|
||||
import { UserDetail, MessageAdd, UserPlus } from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { RelationshipStatus, Presence } from "revolt-api/types/Users";
|
||||
import { User } from "revolt.js/dist/maps/Users";
|
||||
import styled, { css } from "styled-components/macro";
|
||||
|
||||
import styles from "./Friend.module.scss";
|
||||
import classNames from "classnames";
|
||||
@@ -31,37 +29,32 @@ export default observer(() => {
|
||||
const users = [...client.users.values()];
|
||||
users.sort((a, b) => a.username.localeCompare(b.username));
|
||||
|
||||
const friends = users.filter(
|
||||
(x) => x.relationship === RelationshipStatus.Friend,
|
||||
);
|
||||
const friends = users.filter((x) => x.relationship === "Friend");
|
||||
|
||||
const lists = [
|
||||
[
|
||||
"",
|
||||
users.filter((x) => x.relationship === RelationshipStatus.Incoming),
|
||||
],
|
||||
["", users.filter((x) => x.relationship === "Incoming")],
|
||||
[
|
||||
"app.special.friends.sent",
|
||||
users.filter((x) => x.relationship === RelationshipStatus.Outgoing),
|
||||
users.filter((x) => x.relationship === "Outgoing"),
|
||||
"outgoing",
|
||||
],
|
||||
[
|
||||
"app.status.online",
|
||||
friends.filter(
|
||||
(x) => x.online && x.status?.presence !== Presence.Invisible,
|
||||
(x) => x.online && x.status?.presence !== "Invisible",
|
||||
),
|
||||
"online",
|
||||
],
|
||||
[
|
||||
"app.status.offline",
|
||||
friends.filter(
|
||||
(x) => !x.online || x.status?.presence === Presence.Invisible,
|
||||
(x) => !x.online || x.status?.presence === "Invisible",
|
||||
),
|
||||
"offline",
|
||||
],
|
||||
[
|
||||
"app.special.friends.blocked",
|
||||
users.filter((x) => x.relationship === RelationshipStatus.Blocked),
|
||||
users.filter((x) => x.relationship === "Blocked"),
|
||||
"blocked",
|
||||
],
|
||||
] as [string, User[], string][];
|
||||
|
||||
Reference in New Issue
Block a user