aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/reviewDB/index.tsx
diff options
context:
space:
mode:
authorManti <67705577+mantikafasi@users.noreply.github.com>2023-05-14 02:29:13 +0300
committerGitHub <noreply@github.com>2023-05-14 01:29:13 +0200
commit7a27de892767aa8d9104ef16fe5ba2a2a75568cf (patch)
tree1602ecfb2e134e9c6c8ec05325e5d17d093eac17 /src/plugins/reviewDB/index.tsx
parent1bc06784226ed93b33698000cab70d17cb22639b (diff)
downloadVencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.gz
Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.bz2
Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.zip
[ReviewDB] Improve UI & Use new RewviewDB api endpoints (#1104)
Diffstat (limited to 'src/plugins/reviewDB/index.tsx')
-rw-r--r--src/plugins/reviewDB/index.tsx60
1 files changed, 55 insertions, 5 deletions
diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx
index 0495c77..52ddb3b 100644
--- a/src/plugins/reviewDB/index.tsx
+++ b/src/plugins/reviewDB/index.tsx
@@ -22,10 +22,11 @@ import { Settings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
-import { Button } from "@webpack/common";
+import { Alerts, Button } from "@webpack/common";
import { User } from "discord-types/general";
import ReviewsView from "./components/ReviewsView";
+import { UserType } from "./entities/User";
import { getCurrentUserInfo } from "./Utils/ReviewDBAPI";
import { authorize, showToast } from "./Utils/Utils";
@@ -47,10 +48,10 @@ export default definePlugin({
options: {
authorize: {
type: OptionType.COMPONENT,
- description: "Authorise with ReviewDB",
+ description: "Authorize with ReviewDB",
component: () => (
<Button onClick={authorize}>
- Authorise with ReviewDB
+ Authorize with ReviewDB
</Button>
)
},
@@ -68,7 +69,29 @@ export default definePlugin({
type: OptionType.BOOLEAN,
description: "Hide timestamps on reviews",
default: false,
- }
+ },
+ website: {
+ type: OptionType.COMPONENT,
+ description: "ReviewDB website",
+ component: () => (
+ <Button onClick={() => {
+ window.open("https://reviewdb.mantikafasi.dev");
+ }}>
+ ReviewDB website
+ </Button>
+ )
+ },
+ supportServer: {
+ type: OptionType.COMPONENT,
+ description: "ReviewDB Support Server",
+ component: () => (
+ <Button onClick={() => {
+ window.open("https://discord.gg/eWPBSbvznt");
+ }}>
+ ReviewDB Support Server
+ </Button>
+ )
+ },
},
async start() {
@@ -82,7 +105,34 @@ export default definePlugin({
if (user.lastReviewID !== 0)
showToast("You have new reviews on your profile!");
}
- settings.userType = user.type;
+
+ if (user.banInfo) {
+ const endDate = new Date(user.banInfo.banEndDate);
+ if (endDate > new Date() && (settings.user?.banInfo?.banEndDate ?? 0) < endDate) {
+
+ Alerts.show({
+ title: "You have been banned from ReviewDB",
+ body: <>
+ <p>
+ You are banned from ReviewDB {(user.type === UserType.Banned) ? "permanently" : "until " + endDate.toLocaleString()}
+ </p>
+ <p>
+ Offending Review: {user.banInfo.reviewContent}
+ </p>
+ <p>
+ Continued offenses will result in a permanent ban.
+ </p>
+ </>,
+ cancelText: "Appeal",
+ confirmText: "Ok",
+ onCancel: () => {
+ window.open("https://forms.gle/Thj3rDYaMdKoMMuq6");
+ }
+ });
+ }
+ }
+
+ settings.user = user;
}, 4000);
},