mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-22 07:00:58 -05:00
feat(modal): add report success modal (also allows blocking user)
This commit is contained in:
parent
58f35a2813
commit
ff0330ec1b
5 changed files with 83 additions and 1 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 98592389def635f69f54afeef0a576405239a902
|
Subproject commit a8c77596457bcc6f24d0a764c308df74e12633af
|
|
@ -42,6 +42,7 @@ import ModifyAccount from "./components/ModifyAccount";
|
||||||
import OutOfDate from "./components/OutOfDate";
|
import OutOfDate from "./components/OutOfDate";
|
||||||
import PendingFriendRequests from "./components/PendingFriendRequests";
|
import PendingFriendRequests from "./components/PendingFriendRequests";
|
||||||
import ReportContent from "./components/Report";
|
import ReportContent from "./components/Report";
|
||||||
|
import ReportSuccess from "./components/ReportSuccess";
|
||||||
import ServerIdentity from "./components/ServerIdentity";
|
import ServerIdentity from "./components/ServerIdentity";
|
||||||
import ServerInfo from "./components/ServerInfo";
|
import ServerInfo from "./components/ServerInfo";
|
||||||
import ShowToken from "./components/ShowToken";
|
import ShowToken from "./components/ShowToken";
|
||||||
|
@ -278,4 +279,5 @@ export const modalController = new ModalControllerExtended({
|
||||||
user_picker: UserPicker,
|
user_picker: UserPicker,
|
||||||
user_profile: UserProfile,
|
user_profile: UserProfile,
|
||||||
report: ReportContent,
|
report: ReportContent,
|
||||||
|
report_success: ReportSuccess,
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { ModalForm, Row } from "@revoltchat/ui";
|
||||||
import Message from "../../../components/common/messaging/Message";
|
import Message from "../../../components/common/messaging/Message";
|
||||||
import UserShort from "../../../components/common/user/UserShort";
|
import UserShort from "../../../components/common/user/UserShort";
|
||||||
import { useClient } from "../../client/ClientController";
|
import { useClient } from "../../client/ClientController";
|
||||||
|
import { modalController } from "../ModalController";
|
||||||
import { ModalProps } from "../types";
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
const CONTENT_REASONS: API.ContentReportReason[] = [
|
const CONTENT_REASONS: API.ContentReportReason[] = [
|
||||||
|
@ -126,6 +127,16 @@ export default function ReportContent({
|
||||||
},
|
},
|
||||||
additional_context,
|
additional_context,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modalController.push({
|
||||||
|
type: "report_success",
|
||||||
|
user:
|
||||||
|
target instanceof MessageInterface
|
||||||
|
? target.author
|
||||||
|
: target instanceof User
|
||||||
|
? target
|
||||||
|
: undefined,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
submit={{
|
submit={{
|
||||||
children: <Text id="app.special.modals.actions.report" />,
|
children: <Text id="app.special.modals.actions.report" />,
|
||||||
|
|
65
src/controllers/modals/components/ReportSuccess.tsx
Normal file
65
src/controllers/modals/components/ReportSuccess.tsx
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
|
import { Modal } from "@revoltchat/ui";
|
||||||
|
|
||||||
|
import { noopTrue } from "../../../lib/js";
|
||||||
|
|
||||||
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Report success modal
|
||||||
|
*/
|
||||||
|
export default function ReportSuccess({
|
||||||
|
user,
|
||||||
|
...props
|
||||||
|
}: ModalProps<"report_success">) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
{...props}
|
||||||
|
title={<Text id="app.special.modals.report.reported" />}
|
||||||
|
description={
|
||||||
|
<>
|
||||||
|
<Text id="app.special.modals.report.thank_you" />
|
||||||
|
{user && (
|
||||||
|
<>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<Text id="app.special.modals.report.block_user" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
actions={
|
||||||
|
user
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
palette: "plain",
|
||||||
|
onClick: async () => {
|
||||||
|
user.blockUser();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.block" />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
palette: "plain-secondary",
|
||||||
|
onClick: noopTrue,
|
||||||
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.dont_block" />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
palette: "plain",
|
||||||
|
onClick: noopTrue,
|
||||||
|
children: (
|
||||||
|
<Text id="app.special.modals.actions.done" />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
|
@ -183,6 +183,10 @@ export type Modal = {
|
||||||
type: "report";
|
type: "report";
|
||||||
target: Server | User | Message;
|
target: Server | User | Message;
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: "report_success";
|
||||||
|
user?: User;
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export type ModalProps<T extends Modal["type"]> = Modal & { type: T } & {
|
export type ModalProps<T extends Modal["type"]> = Modal & { type: T } & {
|
||||||
|
|
Loading…
Reference in a new issue