From 4a04bfc18b8c5449dafe1a1a4653bc60550f0486 Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Fri, 14 Apr 2023 10:37:20 +0000 Subject: [PATCH 1/7] Started work --- src/pages/Menu.tsx | 5 ++- src/pages/config/Moderation.tsx | 60 +++++++++++++++++++++++++++++++-- src/utils/api.ts | 4 +++ src/utils/db.ts | 3 ++ 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 src/utils/db.ts diff --git a/src/pages/Menu.tsx b/src/pages/Menu.tsx index 4ed7c8e..3b9a717 100644 --- a/src/pages/Menu.tsx +++ b/src/pages/Menu.tsx @@ -1,10 +1,9 @@ -import configData from "../security/config.json"; import {useNavigate} from "react-router"; import {useContext, useEffect, useState} from "react"; import {GuildContext} from "../utils/context/GuildContext"; import {GuildMenuItem} from "../components/GuildMenuItem"; import {Container, Page} from "../utils/styles"; -import {getBotInviteUrl, handleGuild} from "../utils/api"; +import {getBotApiUrl, getBotInviteUrl, handleGuild} from "../utils/api"; import {List} from "../utils/List"; import {Guild} from "../entites/Guild"; import {getCookie} from "../utils/Cookies"; @@ -26,7 +25,7 @@ export const Menu = () => { useEffect(() => { if (guildState === "waiting") { setGuildState("loading"); - fetch(configData.bot_api + "/guilds", { + fetch(getBotApiUrl() + "/guilds", { method: "GET", headers: { "Authorization": "Bearer " + getCookie("access_token"), diff --git a/src/pages/config/Moderation.tsx b/src/pages/config/Moderation.tsx index 52617f3..90a53de 100644 --- a/src/pages/config/Moderation.tsx +++ b/src/pages/config/Moderation.tsx @@ -1,12 +1,65 @@ +import { getCookie } from "../../utils/Cookies"; import {Button, Container, CustomSelect, Flex, Page, PageTitle} from "../../utils/styles"; +import {useContext, useEffect, useState} from "react"; +import {useNavigate} from "react-router"; +import { getBotApiUrl } from "../../utils/api"; +import { GuildContext } from "../../utils/context/GuildContext"; export const Moderation = () => { - return + const navigate = useNavigate() + const { guild } = useContext(GuildContext); + const guildId = (guild && guild.id) || ''; + const [currentStatus, setCurrentStatus] = useState(false); + const [currentLoadingStatus, setCurrentLoadingStatus] = useState("waiting"); + + useEffect(() => { + if (currentLoadingStatus === "waiting") { + setCurrentLoadingStatus("loading") + fetch(getBotApiUrl() + "guilds/moderation/anti-spoiler", { + method: "GET", + headers: { + "Authorization": "Bearer " + getCookie("access_token"), + "guildId": guildId + } + }).then(async response => { + if (response.status !== 200) { + alert("Failed to get the info. Redirecting to login page."); + navigate(`/`) + return; + } + + let json = await response.json(); + //get the status + setCurrentStatus(json.status); + setCurrentLoadingStatus("loaded"); + }).catch(error => { + console.log(error); + alert("Failed to get the guilds. Redirecting to login page."); + navigate(`/`) + }) + } + }, [currentLoadingStatus, currentStatus, guildId, navigate]) + + const save = async ( + e: React.MouseEvent + ) => { + e.preventDefault(); + try { + updateAntiSpoilerSettings(guildId, currentStatus); + } catch (err) { + console.log(err); + } + }; + + +return Moderation Config

Enable/Disable Anti-Spoiler

-
+ {currentLoadingStatus === "loading" &&

Loading...

} + {currentLoadingStatus === "loaded" &&

Loaded

=> { + return
@@ -24,10 +77,11 @@ export const Moderation = () => { - + }} } \ No newline at end of file diff --git a/src/utils/api.ts b/src/utils/api.ts index 82b6f64..1e8abe3 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -58,3 +58,7 @@ export async function getBotGuilds() : Promise> { export const getBotInviteUrl = () : string => { return configData.bot_invite_url } + +export const getBotApiUrl = () : string => { + return configData.bot_api +} diff --git a/src/utils/db.ts b/src/utils/db.ts new file mode 100644 index 0000000..61bb3c1 --- /dev/null +++ b/src/utils/db.ts @@ -0,0 +1,3 @@ +const updateAntiSpoilerSettings = async (guildId: string, status : boolean) => { + +}; \ No newline at end of file From 7ae8d6474c9531349f994da391e2177b68f54855 Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Fri, 14 Apr 2023 10:52:31 +0000 Subject: [PATCH 2/7] Done with Moderation page --- src/pages/config/Moderation.tsx | 28 ++++++++++++++++++---------- src/utils/db.ts | 17 ++++++++++++++++- src/utils/enums.ts | 5 +++++ 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 src/utils/enums.ts diff --git a/src/pages/config/Moderation.tsx b/src/pages/config/Moderation.tsx index 90a53de..c50fa9d 100644 --- a/src/pages/config/Moderation.tsx +++ b/src/pages/config/Moderation.tsx @@ -4,18 +4,20 @@ import {useContext, useEffect, useState} from "react"; import {useNavigate} from "react-router"; import { getBotApiUrl } from "../../utils/api"; import { GuildContext } from "../../utils/context/GuildContext"; +import { updateAntiSpoilerSettings } from "../../utils/db"; +import { DbGuildUrls } from "../../utils/enums"; export const Moderation = () => { const navigate = useNavigate() const { guild } = useContext(GuildContext); const guildId = (guild && guild.id) || ''; - const [currentStatus, setCurrentStatus] = useState(false); + const [currentAntiSpoilerStatus, setCurrentAntiSpoilerStatus] = useState(false); const [currentLoadingStatus, setCurrentLoadingStatus] = useState("waiting"); useEffect(() => { if (currentLoadingStatus === "waiting") { setCurrentLoadingStatus("loading") - fetch(getBotApiUrl() + "guilds/moderation/anti-spoiler", { + fetch(getBotApiUrl() + DbGuildUrls.ANTI_SPOILER, { method: "GET", headers: { "Authorization": "Bearer " + getCookie("access_token"), @@ -30,7 +32,7 @@ export const Moderation = () => { let json = await response.json(); //get the status - setCurrentStatus(json.status); + setCurrentAntiSpoilerStatus(json.status); setCurrentLoadingStatus("loaded"); }).catch(error => { console.log(error); @@ -38,14 +40,14 @@ export const Moderation = () => { navigate(`/`) }) } - }, [currentLoadingStatus, currentStatus, guildId, navigate]) + }, [currentLoadingStatus, currentAntiSpoilerStatus, guildId, navigate]) const save = async ( e: React.MouseEvent ) => { e.preventDefault(); try { - updateAntiSpoilerSettings(guildId, currentStatus); + updateAntiSpoilerSettings(guildId, currentAntiSpoilerStatus); } catch (err) { console.log(err); } @@ -58,16 +60,22 @@ return

Enable/Disable Anti-Spoiler

{currentLoadingStatus === "loading" &&

Loading...

} - {currentLoadingStatus === "loaded" &&

Loaded

=> { + {currentLoadingStatus === "loaded" && <> return
- { + if (e.target.value === "Enabled") { + setCurrentAntiSpoilerStatus(true); + } else { + setCurrentAntiSpoilerStatus(false); + } + }}> - - + +
@@ -81,7 +89,7 @@ return Save - }} + }
} \ No newline at end of file diff --git a/src/utils/db.ts b/src/utils/db.ts index 61bb3c1..e18a0ae 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -1,3 +1,18 @@ -const updateAntiSpoilerSettings = async (guildId: string, status : boolean) => { +import { getCookie } from "./Cookies"; +import { getBotApiUrl } from "./api"; +import { DbGuildUrls } from "./enums"; +export const updateAntiSpoilerSettings = async (guildId: string, status : boolean) => { + fetch(getBotApiUrl() + DbGuildUrls.ANTI_SPOILER, { + method: 'POST', + headers: { + 'AUTHORIZATION': 'Bearer ' + getCookie('access_token'), + 'guildId': guildId, + 'antiSpoiler': status.toString() + } + }) + .catch(error => { + alert(error); + } + ); }; \ No newline at end of file diff --git a/src/utils/enums.ts b/src/utils/enums.ts new file mode 100644 index 0000000..5e74c4a --- /dev/null +++ b/src/utils/enums.ts @@ -0,0 +1,5 @@ +//enum + +export enum DbGuildUrls { + ANTI_SPOILER = 'guilds/moderation/anti-spoiler' +} \ No newline at end of file From d9d723e6103253c5d43318c50584fda3b448733d Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Sat, 15 Apr 2023 10:34:38 +0000 Subject: [PATCH 3/7] A lot of code clean up and made fetchdb --- src/components/AppBar.tsx | 58 ++++--- src/components/GuildMenuItem.tsx | 40 ++--- src/components/SideBar.tsx | 52 +++--- src/entites/Guild.ts | 28 ++-- src/entites/Snowflake.ts | 26 +-- src/entites/User.ts | 88 +++++----- src/entites/impl/GuildImpl.ts | 24 +-- src/entites/impl/UserImpl.ts | 44 ++--- src/pages/Dashboard.tsx | 56 ++++--- src/pages/LoginPage.tsx | 73 ++++---- src/pages/Menu.tsx | 163 +++++++++--------- src/pages/config/Meta.tsx | 65 ++++---- src/pages/config/Moderation.tsx | 171 ++++++++++--------- src/pages/config/SetMessages.tsx | 256 ++++++++++++++++------------- src/pages/onboarding/Callback.tsx | 118 ++++++------- src/utils/Cookies.ts | 31 ++-- src/utils/GuildList.ts | 44 ++--- src/utils/List.ts | 54 +++--- src/utils/LoginPageUtils.ts | 41 ++--- src/utils/api.ts | 104 ++++++------ src/utils/context/GuildContext.tsx | 15 +- src/utils/db.ts | 67 ++++++-- src/utils/enums.ts | 10 +- src/utils/logging.tsx | 4 +- src/utils/types.ts | 4 - 25 files changed, 883 insertions(+), 753 deletions(-) delete mode 100644 src/utils/types.ts diff --git a/src/components/AppBar.tsx b/src/components/AppBar.tsx index 3bbafaa..18e6a0b 100644 --- a/src/components/AppBar.tsx +++ b/src/components/AppBar.tsx @@ -1,34 +1,32 @@ -import {AppBarStyle, AppBarTitle} from "../utils/styles"; -import {GuildContext} from "../utils/context/GuildContext"; -import React, {useContext} from "react"; -import {Navigate} from "react-router"; +import { AppBarStyle, AppBarTitle } from "../utils/styles"; +import { GuildContext } from "../utils/context/GuildContext"; +import React, { useContext } from "react"; +import { Navigate } from "react-router"; export const AppBar = () => { - const {guild} = useContext(GuildContext); + const { guild } = useContext(GuildContext); - if (guild === undefined) { - return - } else { - try { - return ( - - - - Configuring {guild.name} - - {guild.name - - ) - } catch (error) { - console.error("Failed to load guild icon", error); - alert("Failed to load guild icon. Please try again later.") - return null; - } + if (guild === undefined) { + return ; + } else { + try { + return ( + + + Configuring {guild.name} + {guild.name + + ); + } catch (error) { + console.error("Failed to load guild icon", error); + alert("Failed to load guild icon. Please try again later."); + return null; } -}; \ No newline at end of file + } +}; diff --git a/src/components/GuildMenuItem.tsx b/src/components/GuildMenuItem.tsx index e86a258..821db9d 100644 --- a/src/components/GuildMenuItem.tsx +++ b/src/components/GuildMenuItem.tsx @@ -1,26 +1,28 @@ -import {GuildIcon, GuildMenuStyle} from "../utils/styles"; +import { GuildIcon, GuildMenuStyle } from "../utils/styles"; type props = { - guild: { - id: string, - name: string, - icon: string, - } -} + guild: { + id: string; + name: string; + icon: string; + }; +}; -export const GuildMenuItem = ({guild}: props) => { - guild.icon = getIcon(guild.id, guild.icon) +export const GuildMenuItem = ({ guild }: props) => { + guild.icon = getIcon(guild.id, guild.icon); - return - -

{guild.name}

+ return ( + + +

{guild.name}

-} + ); +}; export function getIcon(id: string, icon: string) { - if (icon === null) { - return "https://cdn.discordapp.com/embed/avatars/0.png"; - } else { - return "https://cdn.discordapp.com/icons/" + id + "/" + icon + ".png"; - } -} \ No newline at end of file + if (icon === null) { + return "https://cdn.discordapp.com/embed/avatars/0.png"; + } else { + return "https://cdn.discordapp.com/icons/" + id + "/" + icon + ".png"; + } +} diff --git a/src/components/SideBar.tsx b/src/components/SideBar.tsx index 1204b5b..b532919 100644 --- a/src/components/SideBar.tsx +++ b/src/components/SideBar.tsx @@ -1,23 +1,37 @@ -import {fallDown as Menu} from 'react-burger-menu' -import "../utils/styles/sidebar.css" -import {useContext} from "react"; -import {GuildContext} from "../utils/context/GuildContext"; -import {useNavigate} from "react-router"; +import { fallDown as Menu } from "react-burger-menu"; +import "../utils/styles/sidebar.css"; +import { useContext } from "react"; +import { GuildContext } from "../utils/context/GuildContext"; +import { useNavigate } from "react-router"; export const Sidebar = () => { - const {guild} = useContext(GuildContext); - const navigate = useNavigate() + const { guild } = useContext(GuildContext); + const navigate = useNavigate(); - const handleClick = (path: string) => { - navigate(path) - } + const handleClick = (path: string) => { + navigate(path); + }; - return ( - - handleClick(`/dashboard`)}>Dashboard - handleClick(`/dashboard/moderation`)}>Moderation - handleClick(`/dashboard/meta`)}>Meta - handleClick(`/dashboard/messages`)}>Join/Leave - - ); -} \ No newline at end of file + return ( + + handleClick(`/dashboard`)}> + Dashboard + + handleClick(`/dashboard/moderation`)} + > + Moderation + + handleClick(`/dashboard/meta`)}> + Meta + + handleClick(`/dashboard/messages`)} + > + Join/Leave + + + ); +}; diff --git a/src/entites/Guild.ts b/src/entites/Guild.ts index bdd830a..93604a5 100644 --- a/src/entites/Guild.ts +++ b/src/entites/Guild.ts @@ -1,17 +1,17 @@ -import {Snowflake} from "./Snowflake"; +import { Snowflake } from "./Snowflake"; export interface Guild extends Snowflake { - /** - * The name of this guild. - * - * @return the name of this guild - */ - name: string; + /** + * The name of this guild. + * + * @return the name of this guild + */ + name: string; - /** - * The icon of this guild. - * - * @return the icon of this guild - */ - icon: string; -} \ No newline at end of file + /** + * The icon of this guild. + * + * @return the icon of this guild + */ + icon: string; +} diff --git a/src/entites/Snowflake.ts b/src/entites/Snowflake.ts index 83afe2b..f1cc1a6 100644 --- a/src/entites/Snowflake.ts +++ b/src/entites/Snowflake.ts @@ -1,15 +1,15 @@ export interface Snowflake { - /** - * The id of this snowflake as a String. - * - * @return the id of this snowflake as a [String] - */ - id: string; + /** + * The id of this snowflake as a String. + * + * @return the id of this snowflake as a [String] + */ + id: string; - /** - * The id of this snowflake as a Long. - * - * @return the id of this snowflake as a [Long] - */ - idAsLong: number; -} \ No newline at end of file + /** + * The id of this snowflake as a Long. + * + * @return the id of this snowflake as a [Long] + */ + idAsLong: number; +} diff --git a/src/entites/User.ts b/src/entites/User.ts index e38d46e..5e2d72a 100644 --- a/src/entites/User.ts +++ b/src/entites/User.ts @@ -1,52 +1,52 @@ -import {Snowflake} from "./Snowflake"; +import { Snowflake } from "./Snowflake"; export interface User extends Snowflake { - /** - * The username of this user. - * - * @return the username of this user - */ - username: string; + /** + * The username of this user. + * + * @return the username of this user + */ + username: string; - /** - * The discriminator of this user. - * - * @return the discriminator of this user - */ - discriminator: string; + /** + * The discriminator of this user. + * + * @return the discriminator of this user + */ + discriminator: string; - /** - * The avatar hash of this user. - * - * @return the avatar hash of this user - */ - avatar: string; + /** + * The avatar hash of this user. + * + * @return the avatar hash of this user + */ + avatar: string; - /** - * The bot flag of this user. - * - * @return the bot flag of this user - */ - isBot: boolean | undefined; + /** + * The bot flag of this user. + * + * @return the bot flag of this user + */ + isBot: boolean | undefined; - /** - * The system flag of this user. - * - * @return the system flag of this user - */ - isSystem: boolean | undefined; + /** + * The system flag of this user. + * + * @return the system flag of this user + */ + isSystem: boolean | undefined; - /** - * The mfa flag of this user. - * - * @return the mfa flag of this user - */ - isMfaEnabled: boolean | undefined; + /** + * The mfa flag of this user. + * + * @return the mfa flag of this user + */ + isMfaEnabled: boolean | undefined; - /** - * The json object of this user. - * - * @return the json object of this user - */ - json: string; -} \ No newline at end of file + /** + * The json object of this user. + * + * @return the json object of this user + */ + json: string; +} diff --git a/src/entites/impl/GuildImpl.ts b/src/entites/impl/GuildImpl.ts index df3edd5..9ac4b12 100644 --- a/src/entites/impl/GuildImpl.ts +++ b/src/entites/impl/GuildImpl.ts @@ -1,15 +1,15 @@ -import {Guild} from "../Guild"; +import { Guild } from "../Guild"; export class GuildImpl implements Guild { - id: string; - idAsLong: number; - name: string; - icon: string; + id: string; + idAsLong: number; + name: string; + icon: string; - constructor(id: string, json: any) { - this.id = id; - this.idAsLong = Number(id); - this.name = json.name; - this.icon = json.icon; - } -} \ No newline at end of file + constructor(id: string, json: any) { + this.id = id; + this.idAsLong = Number(id); + this.name = json.name; + this.icon = json.icon; + } +} diff --git a/src/entites/impl/UserImpl.ts b/src/entites/impl/UserImpl.ts index 676fcc2..59a24e5 100644 --- a/src/entites/impl/UserImpl.ts +++ b/src/entites/impl/UserImpl.ts @@ -1,25 +1,25 @@ -import {User} from "../User"; +import { User } from "../User"; export class UserImpl implements User { - id: string; - idAsLong: number; - username: string; - discriminator: string; - avatar: string; - isBot: boolean | undefined; - isSystem: boolean | undefined; - isMfaEnabled: boolean | undefined; - json: string; + id: string; + idAsLong: number; + username: string; + discriminator: string; + avatar: string; + isBot: boolean | undefined; + isSystem: boolean | undefined; + isMfaEnabled: boolean | undefined; + json: string; - constructor(id: string, json: any) { - this.id = id; - this.idAsLong = Number(id); - this.username = json.username; - this.discriminator = json.discriminator; - this.avatar = json.avatar; - this.isBot = json.bot; - this.isSystem = json.system; - this.isMfaEnabled = json.mfa_enabled; - this.json = json; - } -} \ No newline at end of file + constructor(id: string, json: any) { + this.id = id; + this.idAsLong = Number(id); + this.username = json.username; + this.discriminator = json.discriminator; + this.avatar = json.avatar; + this.isBot = json.bot; + this.isSystem = json.system; + this.isMfaEnabled = json.mfa_enabled; + this.json = json; + } +} diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index f8f284d..8cb14b9 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -1,28 +1,38 @@ -import {useContext} from "react"; -import {GuildContext} from "../utils/context/GuildContext"; -import {Container, Page, TestTextButtonGroup, TextButton,} from "../utils/styles"; -import {useNavigate} from "react-router"; +import { useContext } from "react"; +import { GuildContext } from "../utils/context/GuildContext"; +import { + Container, + Page, + TestTextButtonGroup, + TextButton, +} from "../utils/styles"; +import { useNavigate } from "react-router"; export const Dashboard = () => { - const {guild} = useContext(GuildContext); - const navigate = useNavigate() + const { guild } = useContext(GuildContext); + const navigate = useNavigate(); - const handleClick = (path: string) => { - navigate(path) - } + const handleClick = (path: string) => { + navigate(path); + }; - return - -
- - handleClick(`/dashboard/moderation`)}>Moderation - handleClick(`/dashboard/meta`)}>Meta - handleClick(`/dashboard/messages`)}>Join/Leave - -
-
+ return ( + + +
+ + handleClick(`/dashboard/moderation`)}> + Moderation + + handleClick(`/dashboard/meta`)}> + Meta + + handleClick(`/dashboard/messages`)}> + Join/Leave + + +
+
-} \ No newline at end of file + ); +}; diff --git a/src/pages/LoginPage.tsx b/src/pages/LoginPage.tsx index 5ae4e53..c6b4f19 100644 --- a/src/pages/LoginPage.tsx +++ b/src/pages/LoginPage.tsx @@ -1,44 +1,37 @@ -import {FaDiscord, FaQuestionCircle} from "react-icons/fa"; -import {HomeStyle, MainButton, MainFooter} from "../utils/styles"; +import { FaDiscord, FaQuestionCircle } from "react-icons/fa"; +import { HomeStyle, MainButton, MainFooter } from "../utils/styles"; import { - redirectToContact, - redirectToDiscord, - redirectToLicense, - redirectToPrivacyPolicy, - redirectToSupportServer, - redirectToTeam, - redirectToTermsOfService + redirectToContact, + redirectToDiscord, + redirectToLicense, + redirectToPrivacyPolicy, + redirectToSupportServer, + redirectToTeam, + redirectToTermsOfService, } from "../utils/LoginPageUtils"; export const LoginPage = () => { - - - return ( - - {/* needed to keep the divs in the center */} -
-
- - -

- Login With Discord -

-
- - -

- Support Server -

-
-
- - Privacy Policy - Terms of Service - The Black Onion team - Contact us - © 2023 Black Onion - -
- ); -} + return ( + + {/* needed to keep the divs in the center */} +
+
+ + +

Login With Discord

+
+ + +

Support Server

+
+
+ + Privacy Policy + Terms of Service + The Black Onion team + Contact us + © 2023 Black Onion + +
+ ); +}; diff --git a/src/pages/Menu.tsx b/src/pages/Menu.tsx index 3b9a717..420a95d 100644 --- a/src/pages/Menu.tsx +++ b/src/pages/Menu.tsx @@ -1,86 +1,97 @@ -import {useNavigate} from "react-router"; -import {useContext, useEffect, useState} from "react"; -import {GuildContext} from "../utils/context/GuildContext"; -import {GuildMenuItem} from "../components/GuildMenuItem"; -import {Container, Page} from "../utils/styles"; -import {getBotApiUrl, getBotInviteUrl, handleGuild} from "../utils/api"; -import {List} from "../utils/List"; -import {Guild} from "../entites/Guild"; -import {getCookie} from "../utils/Cookies"; +import { useNavigate } from "react-router"; +import { useContext, useEffect, useState } from "react"; +import { GuildContext } from "../utils/context/GuildContext"; +import { GuildMenuItem } from "../components/GuildMenuItem"; +import { Container, Page } from "../utils/styles"; +import { getBotApiUrl, getBotInviteUrl, handleGuild } from "../utils/api"; +import { List } from "../utils/List"; +import { Guild } from "../entites/Guild"; +import { getCookie } from "../utils/Cookies"; export const Menu = () => { - const navigate = useNavigate() - //context keeps track of the guildId - const {updateGuild} = useContext(GuildContext) + const navigate = useNavigate(); + //context keeps track of the guildId + const { updateGuild } = useContext(GuildContext); - const handleClick = (guild: Guild) => { - updateGuild(guild) - navigate(`/dashboard`) - } + const handleClick = (guild: Guild) => { + updateGuild(guild); + navigate(`/dashboard`); + }; - //state to make sure the guilds are loaded after fetching - const [guilds, setGuilds] = useState>(new List()) - const [guildState, setGuildState] = useState("waiting") + //state to make sure the guilds are loaded after fetching + const [guilds, setGuilds] = useState>(new List()); + const [guildState, setGuildState] = useState("waiting"); - useEffect(() => { - if (guildState === "waiting") { - setGuildState("loading"); - fetch(getBotApiUrl() + "/guilds", { - method: "GET", - headers: { - "Authorization": "Bearer " + getCookie("access_token"), - } - }).then(async response => { - if (response.status !== 200) { - alert("Failed to get the guilds. Redirecting to login page."); - navigate(`/`) - return; - } + useEffect(() => { + if (guildState === "waiting") { + setGuildState("loading"); + fetch(getBotApiUrl() + "/guilds", { + method: "GET", + headers: { + Authorization: "Bearer " + getCookie("access_token"), + }, + }) + .then(async (response) => { + if (response.status !== 200) { + alert("Failed to get the guilds. Redirecting to login page."); + navigate(`/`); + return; + } - let json = await response.json(); + let json = await response.json(); - let independentList = new List(); - for (let i = 0; i < json.length; i++) { - let guild = handleGuild(json[i]); - if (guild !== null) { - independentList.add(guild); - } - } + let independentList = new List(); + for (let i = 0; i < json.length; i++) { + let guild = handleGuild(json[i]); + if (guild !== null) { + independentList.add(guild); + } + } - await setGuilds(independentList); + await setGuilds(independentList); - setGuildState(independentList?.size() === 0 ? "no guilds" : "loaded"); - }).catch(error => { - console.log(error); - alert("Failed to get the guilds. Redirecting to login page."); - navigate(`/`) - }) - } - }, [guildState, guilds, navigate]) + setGuildState(independentList?.size() === 0 ? "no guilds" : "loaded"); + }) + .catch((error) => { + console.log(error); + alert("Failed to get the guilds. Redirecting to login page."); + navigate(`/`); + }); + } + }, [guildState, guilds, navigate]); - return ( - - -

Menu

-

Choose a guild to manage

- {guildState === "loading" &&

Loading guilds...

} - {guildState === "no guilds" &&

No guilds found.

} - {guilds?.size() !== 0 && guilds?.map((guild: Guild) => { - return
- { -
{ - if (guild !== null) { - handleClick(guild) - } else { - window.open(getBotInviteUrl(), "_blank", "noopener,noreferrer") - } - }}> - -
- } -
- })} -
-
- ) -} + return ( + + +

Menu

+

Choose a guild to manage

+ {guildState === "loading" &&

Loading guilds...

} + {guildState === "no guilds" &&

No guilds found.

} + {guilds?.size() !== 0 && + guilds?.map((guild: Guild) => { + return ( +
+ { +
{ + if (guild !== null) { + handleClick(guild); + } else { + window.open( + getBotInviteUrl(), + "_blank", + "noopener,noreferrer" + ); + } + }} + > + +
+ } +
+ ); + })} +
+
+ ); +}; diff --git a/src/pages/config/Meta.tsx b/src/pages/config/Meta.tsx index 9302de0..4ef5290 100644 --- a/src/pages/config/Meta.tsx +++ b/src/pages/config/Meta.tsx @@ -1,33 +1,42 @@ -import {Button, Container, CustomSelect, Flex, Page, PageTitle} from "../../utils/styles"; +import { + Button, + Container, + CustomSelect, + Flex, + Page, + PageTitle, +} from "../../utils/styles"; export const Meta = () => { - return - Bot Configs + return ( + + Bot Configs - -

Set a language

-
-
- -
- - - -
+ +

Set a language

+
+
+ +
+ + + +
- {/**/} - - - - -
+ {/**/} + + + + +
-} \ No newline at end of file + ); +}; diff --git a/src/pages/config/Moderation.tsx b/src/pages/config/Moderation.tsx index c50fa9d..5b10958 100644 --- a/src/pages/config/Moderation.tsx +++ b/src/pages/config/Moderation.tsx @@ -1,95 +1,104 @@ import { getCookie } from "../../utils/Cookies"; -import {Button, Container, CustomSelect, Flex, Page, PageTitle} from "../../utils/styles"; -import {useContext, useEffect, useState} from "react"; -import {useNavigate} from "react-router"; -import { getBotApiUrl } from "../../utils/api"; +import { + Button, + Container, + CustomSelect, + Flex, + Page, + PageTitle, +} from "../../utils/styles"; +import { useContext, useEffect, useState } from "react"; import { GuildContext } from "../../utils/context/GuildContext"; -import { updateAntiSpoilerSettings } from "../../utils/db"; -import { DbGuildUrls } from "../../utils/enums"; +import { fetchSettings, updateSettings } from "../../utils/db"; +import { RetrievableSettings } from "../../utils/enums"; +import { List } from "../../utils/List"; export const Moderation = () => { - const navigate = useNavigate() - const { guild } = useContext(GuildContext); - const guildId = (guild && guild.id) || ''; - const [currentAntiSpoilerStatus, setCurrentAntiSpoilerStatus] = useState(false); - const [currentLoadingStatus, setCurrentLoadingStatus] = useState("waiting"); + const { guild } = useContext(GuildContext); + const guildId = (guild && guild.id) || ""; + const [currentAntiSpoilerStatus, setCurrentAntiSpoilerStatus] = + useState(false); + const [currentLoadingStatus, setCurrentLoadingStatus] = useState("waiting"); - useEffect(() => { - if (currentLoadingStatus === "waiting") { - setCurrentLoadingStatus("loading") - fetch(getBotApiUrl() + DbGuildUrls.ANTI_SPOILER, { - method: "GET", - headers: { - "Authorization": "Bearer " + getCookie("access_token"), - "guildId": guildId - } - }).then(async response => { - if (response.status !== 200) { - alert("Failed to get the info. Redirecting to login page."); - navigate(`/`) - return; - } - - let json = await response.json(); - //get the status - setCurrentAntiSpoilerStatus(json.status); - setCurrentLoadingStatus("loaded"); - }).catch(error => { - console.log(error); - alert("Failed to get the guilds. Redirecting to login page."); - navigate(`/`) - }) - } - }, [currentLoadingStatus, currentAntiSpoilerStatus, guildId, navigate]) - - const save = async ( - e: React.MouseEvent - ) => { - e.preventDefault(); - try { - updateAntiSpoilerSettings(guildId, currentAntiSpoilerStatus); - } catch (err) { - console.log(err); + useEffect(() => { + if (currentLoadingStatus === "waiting") { + setCurrentLoadingStatus("loading"); + fetchSettings(RetrievableSettings.ANTI_SPOILER, guildId).then((res) => { + //break down the data + const data = res.data; + //look for a status + if (data.status) { + //if there is a status, set it + setCurrentAntiSpoilerStatus(data.status); + setCurrentLoadingStatus("loaded"); + } else { + //if there is no status, set it to false + setCurrentAntiSpoilerStatus(false); + setCurrentLoadingStatus("loaded"); } - }; + }); + } + }, [currentLoadingStatus, guildId]); + const save = async (e: React.MouseEvent) => { + e.preventDefault(); + try { + updateSettings( + RetrievableSettings.ANTI_SPOILER, + guildId, + List.of(currentAntiSpoilerStatus) + ); + } catch (err) { + console.log(err); + } + }; -return - Moderation Config + return ( + + Moderation Config - -

Enable/Disable Anti-Spoiler

- {currentLoadingStatus === "loading" &&

Loading...

} - {currentLoadingStatus === "loaded" && <> - return
-
- -
- - - + +

Enable/Disable Anti-Spoiler

+ {currentLoadingStatus === "loading" &&

Loading...

} + {currentLoadingStatus === "loaded" && ( + <> + return{" "} +
+
+ +
+ + +
- {/**/} - - + + - } -
+ + )} + -} \ No newline at end of file + ); +}; diff --git a/src/pages/config/SetMessages.tsx b/src/pages/config/SetMessages.tsx index e2076a1..dc4a18a 100644 --- a/src/pages/config/SetMessages.tsx +++ b/src/pages/config/SetMessages.tsx @@ -1,125 +1,149 @@ import { - AddWhiteLine, - Button, - Container, - CustomSelect, - Flex, - Page, - PageTitle, - Switch, - TextArea + AddWhiteLine, + Button, + Container, + CustomSelect, + Flex, + Page, + PageTitle, + Switch, + TextArea, } from "../../utils/styles"; -import React, {useState} from "react"; +import React, { useState } from "react"; export const SetMessages = () => { - const [welcomeMessageEnablity, setWelcomeMessageEnablity] = useState(false); - const [leaveMessageEnablity, setLeaveMessageEnablity] = useState(false); + const [welcomeMessageEnablity, setWelcomeMessageEnablity] = useState(false); + const [leaveMessageEnablity, setLeaveMessageEnablity] = useState(false); - return - Join and Leave message Config - -
-
- -
- - setWelcomeMessageEnablity(!welcomeMessageEnablity)} - id="welcome_message_switch" - /> - -
- {/* If enabled, show the following: */} - {welcomeMessageEnablity &&
-
- -
- - - -
} - {welcomeMessageEnablity &&
-
- -
- -
} - {welcomeMessageEnablity &&
-
- -
- - - -
} + return ( + + Join and Leave message Config + +
+
+ +
+ + + setWelcomeMessageEnablity(!welcomeMessageEnablity) + } + id="welcome_message_switch" + /> + +
+ {/* If enabled, show the following: */} + {welcomeMessageEnablity && ( +
+
+ +
+ + + +
+ )} + {welcomeMessageEnablity && ( +
+
+ +
+ +
+ )} + {welcomeMessageEnablity && ( +
+
+ +
+ + + +
+ )} - + -
-
- -
- - setLeaveMessageEnablity(!leaveMessageEnablity)} - id="leave_message_switch" - /> - -
- {/* If enabled, show the following: */} - {leaveMessageEnablity &&
-
- -
- - - -
} - {leaveMessageEnablity &&
-
- -
- -
} - {leaveMessageEnablity &&
-
- -
- - - -
} +
+
+ +
+ + + setLeaveMessageEnablity(!leaveMessageEnablity) + } + id="leave_message_switch" + /> + +
+ {/* If enabled, show the following: */} + {leaveMessageEnablity && ( +
+
+ +
+ + + +
+ )} + {leaveMessageEnablity && ( +
+
+ +
+ +
+ )} + {leaveMessageEnablity && ( +
+
+ +
+ + + +
+ )} - - - - -
+ + + + +
-} \ No newline at end of file + ); +}; diff --git a/src/pages/onboarding/Callback.tsx b/src/pages/onboarding/Callback.tsx index 4f22378..a19f5d5 100644 --- a/src/pages/onboarding/Callback.tsx +++ b/src/pages/onboarding/Callback.tsx @@ -1,70 +1,74 @@ -import {useEffect} from 'react'; -import {HomeStyle, MainFooter} from "../../utils/styles"; +import { useEffect } from "react"; +import { HomeStyle, MainFooter } from "../../utils/styles"; import configData from "../../security/config.json"; import { - redirectToContact, - redirectToLicense, - redirectToPrivacyPolicy, - redirectToTeam, - redirectToTermsOfService + redirectToContact, + redirectToLicense, + redirectToPrivacyPolicy, + redirectToTeam, + redirectToTermsOfService, } from "../../utils/LoginPageUtils"; -import {setCookie} from "../../utils/Cookies"; +import { setCookie } from "../../utils/Cookies"; let amountOfTimeTried: number = 0; export const CallbackPage = () => { - if (amountOfTimeTried === 1) { - alert("Tried to get the session once, but failed. Redirecting to login page."); - window.location.href = "/"; - } else { - amountOfTimeTried++; - } + if (amountOfTimeTried === 1) { + alert( + "Tried to get the session once, but failed. Redirecting to login page." + ); + window.location.href = "/"; + } else { + amountOfTimeTried++; + } - useEffect(() => { - const code = new URLSearchParams(window.location.search).get('code'); + useEffect(() => { + const code = new URLSearchParams(window.location.search).get("code"); - // change of approach: we get the token and save it in the session storage, then we redirect to the menu page - fetch(configData.bot_api + "/login?code=" + code, { - method: "POST" - }).then(async response => { - let accessToken = await response.text(); - if (response.status !== 200) { - alert("Failed to get the session. Redirecting to login page."); - window.location.href = "/"; - return; - } + // change of approach: we get the token and save it in the session storage, then we redirect to the menu page + fetch(configData.bot_api + "/login?code=" + code, { + method: "POST", + }) + .then(async (response) => { + let accessToken = await response.text(); + if (response.status !== 200) { + alert("Failed to get the session. Redirecting to login page."); + window.location.href = "/"; + return; + } - //base64 decode the 2nd out of 3 parts of the token the backend provides you and get the exp json field of it to check at which unix epoch timestamp it expires. - const decodedToken = atob(accessToken.split(".")[1]); - const decodedTokenJson = JSON.parse(decodedToken); - const expiryTime = decodedTokenJson.exp; - const formattedExpiryTime = new Date(expiryTime * 1000); + //base64 decode the 2nd out of 3 parts of the token the backend provides you and get the exp json field of it to check at which unix epoch timestamp it expires. + const decodedToken = atob(accessToken.split(".")[1]); + const decodedTokenJson = JSON.parse(decodedToken); + const expiryTime = decodedTokenJson.exp; + const formattedExpiryTime = new Date(expiryTime * 1000); - setCookie("access_token", accessToken, {path: "/", expires: formattedExpiryTime}); + setCookie("access_token", accessToken, { + path: "/", + expires: formattedExpiryTime, + }); - window.location.href = "/menu"; - }).catch(error => { - console.log(error); - alert("Failed to get the session. Redirecting to login page."); - window.location.href = "/"; - }) - }, []); + window.location.href = "/menu"; + }) + .catch((error) => { + console.log(error); + alert("Failed to get the session. Redirecting to login page."); + window.location.href = "/"; + }); + }, []); - return ( - - {/* needed to keep the divs in the center */} -
-
- Please wait while we get you ready.... -
- - Privacy Policy - Terms of Service - The Black Onion team - Contact us - © 2023 Black Onion - -
- ); -} + return ( + + {/* needed to keep the divs in the center */} +
+
Please wait while we get you ready....
+ + Privacy Policy + Terms of Service + The Black Onion team + Contact us + © 2023 Black Onion + +
+ ); +}; diff --git a/src/utils/Cookies.ts b/src/utils/Cookies.ts index 0d0844a..99363e4 100644 --- a/src/utils/Cookies.ts +++ b/src/utils/Cookies.ts @@ -1,20 +1,23 @@ -import Cookies, {CookieSetOptions} from 'universal-cookie'; +import Cookies, { CookieSetOptions } from "universal-cookie"; -let cookies = new Cookies() +let cookies = new Cookies(); - -export function setCookie(name: string, value: string, options?: CookieSetOptions | undefined) { - try { - cookies.set(name, value, { ...{path: "/"}, ...options }) - } catch (e) { - alert("Error: " + e) - } +export function setCookie( + name: string, + value: string, + options?: CookieSetOptions | undefined +) { + try { + cookies.set(name, value, { ...{ path: "/" }, ...options }); + } catch (e) { + alert("Error: " + e); + } } export function getCookie(name: string): string | null { - if (cookies.get(name) === undefined || cookies.get(name) === null) { - return null - } else { - return cookies.get(name) - } + if (cookies.get(name) === undefined || cookies.get(name) === null) { + return null; + } else { + return cookies.get(name); + } } diff --git a/src/utils/GuildList.ts b/src/utils/GuildList.ts index 75b7896..4435fcf 100644 --- a/src/utils/GuildList.ts +++ b/src/utils/GuildList.ts @@ -1,30 +1,30 @@ -import {List} from "./List"; -import {Guild} from "../entites/Guild"; +import { List } from "./List"; +import { Guild } from "../entites/Guild"; export class GuildList { - private readonly guilds: List; + private readonly guilds: List; - constructor() { - this.guilds = new List(); - } + constructor() { + this.guilds = new List(); + } - size(): number { - return this.guilds.size(); - } + size(): number { + return this.guilds.size(); + } - add(value: Guild): void { - this.guilds.add(value); - } + add(value: Guild): void { + this.guilds.add(value); + } - addAll(values: List): void { - this.guilds.addAll(values); - } + addAll(values: List): void { + this.guilds.addAll(values); + } - get(index: number): Guild { - return this.guilds.get(index); - } + get(index: number): Guild { + return this.guilds.get(index); + } - map(callback: (value: Guild, index: number, array: Guild[]) => U): U[] { - return this.guilds.map(callback); - } -} \ No newline at end of file + map(callback: (value: Guild, index: number, array: Guild[]) => U): U[] { + return this.guilds.map(callback); + } +} diff --git a/src/utils/List.ts b/src/utils/List.ts index 3d447b0..71e471a 100644 --- a/src/utils/List.ts +++ b/src/utils/List.ts @@ -1,31 +1,41 @@ export class List { - private readonly items: Array; + private readonly items: Array; - constructor() { - this.items = []; - } + constructor() { + this.items = []; + } - size(): number { - return this.items.length; - } + size(): number { + return this.items.length; + } - add(value: T): void { - this.items.push(value); - } + add(value: T): void { + this.items.push(value); + } - addAll(values: List): void { - values.forEach(value => this.add(value)); - } + addAll(values: List): void { + values.forEach((value) => this.add(value)); + } - get(index: number): T { - return this.items[index]; - } + get(index: number): T { + return this.items[index]; + } - map(callback: (value: T, index: number, array: T[]) => U): U[] { - return this.items.map(callback); - } + map(callback: (value: T, index: number, array: T[]) => U): U[] { + return this.items.map(callback); + } + + forEach(param: (value: any) => void) { + this.items.forEach(param); + } - forEach(param: (value: any) => void) { - this.items.forEach(param); + static of(object :any): List { + const list = new List(); + for (const key in object) { + if (object.hasOwnProperty(key)) { + list.add(object[key]); + } } -} \ No newline at end of file + return list; + } +} diff --git a/src/utils/LoginPageUtils.ts b/src/utils/LoginPageUtils.ts index b2cadc9..4ef87a1 100644 --- a/src/utils/LoginPageUtils.ts +++ b/src/utils/LoginPageUtils.ts @@ -1,34 +1,35 @@ -import {getAuthLogin} from "./api"; -import {getCookie} from "./Cookies"; +import { getAuthLogin } from "./api"; +import { getCookie } from "./Cookies"; export const redirectToDiscord = () => { - if (getCookie("access_token") === null) { - window.location.href = getAuthLogin(); - } else { - window.location.href = "/menu"; - } -} + if (getCookie("access_token") === null) { + window.location.href = getAuthLogin(); + } else { + window.location.href = "/menu"; + } +}; export const redirectToSupportServer = () => { - window.location.href = "https://discord.gg/88bryEbntG"; -} + window.location.href = "https://discord.gg/88bryEbntG"; +}; export const redirectToPrivacyPolicy = () => { - window.location.href = "/privacy-policy"; -} + window.location.href = "/privacy-policy"; +}; export const redirectToTermsOfService = () => { - window.location.href = "/terms-of-service"; -} + window.location.href = "/terms-of-service"; +}; export const redirectToTeam = () => { - window.location.href = "/team"; -} + window.location.href = "/team"; +}; export const redirectToContact = () => { - window.location.href = "/contact"; -} + window.location.href = "/contact"; +}; export const redirectToLicense = () => { - window.location.href = "https://github.com/Black0nion/BlackOnionDashBoard/blob/main/LICENSE"; -} + window.location.href = + "https://github.com/Black0nion/BlackOnionDashBoard/blob/main/LICENSE"; +}; diff --git a/src/utils/api.ts b/src/utils/api.ts index 1e8abe3..c0ab244 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -1,64 +1,68 @@ import configData from "../security/config.json"; -import {Guild} from "../entites/Guild"; -import {GuildImpl} from "../entites/impl/GuildImpl"; +import { Guild } from "../entites/Guild"; +import { GuildImpl } from "../entites/impl/GuildImpl"; import { List } from "./List"; import { getCookie } from "./Cookies"; -let clientId = configData.client_id -let redirectUrl = configData.redirect_url -export let discordBaseUrl = "https://discord.com/api/v10/" +let clientId = configData.client_id; +let redirectUrl = configData.redirect_url; +export let discordBaseUrl = "https://discord.com/api/v10/"; export const getAuthLogin = () => { - if (clientId === undefined || redirectUrl === undefined) { - throw new Error("clientId or redirectUrl or clientSecret is undefined") - } - return `https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=identify%20guilds&state=random` -} + if (clientId === undefined || redirectUrl === undefined) { + throw new Error("clientId or redirectUrl or clientSecret is undefined"); + } + return `https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=identify%20guilds&state=random`; +}; export function handleGuild(json: any): Guild | null { - try { - return new GuildImpl(json.id, json) - } catch (error) { - alert("error while handling guilds: " + error) - throw new Error("error while handling guilds: " + error) - } + try { + return new GuildImpl(json.id, json); + } catch (error) { + alert("error while handling guilds: " + error); + throw new Error("error while handling guilds: " + error); + } } -export async function getBotGuilds() : Promise> { - try { - await fetch(configData.bot_api + "/guilds", { - method: "GET", - headers: { - "Authorization": "Bearer " + getCookie("access_token"), - } - }).then(response => { - if (response.ok) { - return response.json() - } else { - throw new Error("error while retrieving bot guilds: " + response.status) - } - }).then(json => { - let guilds = new List() - for (let i = 0; i < json.length; i++) { - let guild = handleGuild(json[i]) - if (guild !== null) { - guilds.add(guild) - } - } - return guilds - }) - } catch (error) { - alert("error while handling retrieving bot guilds: " + error) - throw new Error("error while handling retrieving bot guilds: " + error) - } +export async function getBotGuilds(): Promise> { + try { + await fetch(configData.bot_api + "/guilds", { + method: "GET", + headers: { + Authorization: "Bearer " + getCookie("access_token"), + }, + }) + .then((response) => { + if (response.ok) { + return response.json(); + } else { + throw new Error( + "error while retrieving bot guilds: " + response.status + ); + } + }) + .then((json) => { + let guilds = new List(); + for (let i = 0; i < json.length; i++) { + let guild = handleGuild(json[i]); + if (guild !== null) { + guilds.add(guild); + } + } + return guilds; + }); + } catch (error) { + alert("error while handling retrieving bot guilds: " + error); + throw new Error("error while handling retrieving bot guilds: " + error); + } - return new List() + return new List(); } -export const getBotInviteUrl = () : string => { - return configData.bot_invite_url -} +export const getBotInviteUrl = (): string => { + return configData.bot_invite_url; +}; -export const getBotApiUrl = () : string => { - return configData.bot_api -} +export const getBotApiUrl = (): string => { + return configData.bot_api; +}; diff --git a/src/utils/context/GuildContext.tsx b/src/utils/context/GuildContext.tsx index 3d7d873..34e8be8 100644 --- a/src/utils/context/GuildContext.tsx +++ b/src/utils/context/GuildContext.tsx @@ -1,12 +1,11 @@ -import {createContext} from "react"; -import {Guild} from "../../entites/Guild"; +import { createContext } from "react"; +import { Guild } from "../../entites/Guild"; type GuildContextType = { - guild?: Guild - updateGuild: (guild: Guild) => void -} + guild?: Guild; + updateGuild: (guild: Guild) => void; +}; export const GuildContext = createContext({ - updateGuild: () => { - }, -}) \ No newline at end of file + updateGuild: () => {}, +}); diff --git a/src/utils/db.ts b/src/utils/db.ts index e18a0ae..550c41d 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -1,18 +1,57 @@ import { getCookie } from "./Cookies"; +import { List } from "./List"; import { getBotApiUrl } from "./api"; -import { DbGuildUrls } from "./enums"; +import {RetrievableSettings } from "./enums"; -export const updateAntiSpoilerSettings = async (guildId: string, status : boolean) => { - fetch(getBotApiUrl() + DbGuildUrls.ANTI_SPOILER, { - method: 'POST', - headers: { - 'AUTHORIZATION': 'Bearer ' + getCookie('access_token'), - 'guildId': guildId, - 'antiSpoiler': status.toString() - } +export const fetchSettings = async ( + name: RetrievableSettings, + guildId: string, + ) + : Promise => { + fetch(getBotApiUrl() + name, { + method: "GET", + headers: { + AUTHORIZATION: "Bearer " + getCookie("access_token"), + guildId: guildId, + }, + }) + .then((response) => { + if (response.ok) { + return response.json(); + } else { + alert("Something went wrong while fetching the setting " + name); + throw new Error("Something went wrong while fetching the setting " + name); + } }) - .catch(error => { - alert(error); - } - ); -}; \ No newline at end of file + .then((data) => { + return data; + }) + .catch((error) => { + alert(error); + }); +}; + +export const updateSettings = async ( + name: RetrievableSettings, + guildId: string, + data: List +) => { + fetch(getBotApiUrl() + name, { + method: "POST", + headers: { + AUTHORIZATION: "Bearer " + getCookie("access_token"), + guildId: guildId, + data: convertDataToJSON(data), + }, + }).catch((error) => { + alert(error); + }); +}; + +const convertDataToJSON = (data : List) : string => { + let json = ""; + data.forEach((element) => { + json += JSON.stringify(element); + }); + return json; +} \ No newline at end of file diff --git a/src/utils/enums.ts b/src/utils/enums.ts index 5e74c4a..5ce873f 100644 --- a/src/utils/enums.ts +++ b/src/utils/enums.ts @@ -1,5 +1,9 @@ //enum -export enum DbGuildUrls { - ANTI_SPOILER = 'guilds/moderation/anti-spoiler' -} \ No newline at end of file +enum DbGuildUrls { + MODERATION = "guilds/moderation", +} + +export enum RetrievableSettings { + ANTI_SPOILER = DbGuildUrls.MODERATION + "/anti-spoiler", +} diff --git a/src/utils/logging.tsx b/src/utils/logging.tsx index 4aa7296..93ef1a3 100644 --- a/src/utils/logging.tsx +++ b/src/utils/logging.tsx @@ -1,3 +1,3 @@ export const logInfo = (info: any) => { - alert(info); -} \ No newline at end of file + alert(info); +}; diff --git a/src/utils/types.ts b/src/utils/types.ts deleted file mode 100644 index dccdc04..0000000 --- a/src/utils/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type User = { - id: string; - discordId: string; -} \ No newline at end of file From a19083454cc9f880e23861e668248804d97a6782 Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Sat, 15 Apr 2023 10:56:23 +0000 Subject: [PATCH 4/7] made a components called status --- src/components/Status.tsx | 50 +++++++++++++++++++++++++++++ src/pages/config/Moderation.tsx | 56 +++++++-------------------------- 2 files changed, 61 insertions(+), 45 deletions(-) create mode 100644 src/components/Status.tsx diff --git a/src/components/Status.tsx b/src/components/Status.tsx new file mode 100644 index 0000000..c92c7d5 --- /dev/null +++ b/src/components/Status.tsx @@ -0,0 +1,50 @@ +import { CustomSelect, Flex, Button } from "../utils/styles"; + +export const Status = ( + id: string, + currentValueStatus: boolean, + setValue: React.Dispatch>, + saveFunction: (id: string, status: boolean) => void +) => { + + const save = () => { + saveFunction(id, currentValueStatus); + }; + + return ( + <> +
+
+ +
+ + + +
+ + + + + + ); +}; diff --git a/src/pages/config/Moderation.tsx b/src/pages/config/Moderation.tsx index 5b10958..545991f 100644 --- a/src/pages/config/Moderation.tsx +++ b/src/pages/config/Moderation.tsx @@ -1,9 +1,5 @@ -import { getCookie } from "../../utils/Cookies"; import { - Button, Container, - CustomSelect, - Flex, Page, PageTitle, } from "../../utils/styles"; @@ -12,6 +8,7 @@ import { GuildContext } from "../../utils/context/GuildContext"; import { fetchSettings, updateSettings } from "../../utils/db"; import { RetrievableSettings } from "../../utils/enums"; import { List } from "../../utils/List"; +import { Status } from "../../components/Status"; export const Moderation = () => { const { guild } = useContext(GuildContext); @@ -40,10 +37,10 @@ export const Moderation = () => { } }, [currentLoadingStatus, guildId]); - const save = async (e: React.MouseEvent) => { - e.preventDefault(); + const save = async (id: string, status: boolean) => { try { - updateSettings( + setCurrentAntiSpoilerStatus(status); + await updateSettings( RetrievableSettings.ANTI_SPOILER, guildId, List.of(currentAntiSpoilerStatus) @@ -60,44 +57,13 @@ export const Moderation = () => {

Enable/Disable Anti-Spoiler

{currentLoadingStatus === "loading" &&

Loading...

} - {currentLoadingStatus === "loaded" && ( - <> - return{" "} -
-
- -
- - - -
- {/**/} - - - - - - )} + {currentLoadingStatus === "loaded" && + Status( + "anti-spoiler-status", + currentAntiSpoilerStatus, + setCurrentAntiSpoilerStatus, + save + )}
); From 0108a07fabfc65c27a7fb9b18889bcfd4c18af29 Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Mon, 17 Apr 2023 10:26:56 +0000 Subject: [PATCH 5/7] Update packages --- package-lock.json | 920 +++++++++++++++++++++++++++++----------------- package.json | 30 +- 2 files changed, 604 insertions(+), 346 deletions(-) diff --git a/package-lock.json b/package-lock.json index c748d7d..c68dc18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,28 +9,28 @@ "version": "0.1.0", "dependencies": { "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", + "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "@types/axios": "^0.14.0", - "@types/jest": "^29.4.0", - "@types/node": "^18.11.18", - "@types/react": "^18.0.27", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.11", + "@types/react": "^18.0.35", "@types/react-burger-menu": "^2.8.3", - "@types/react-dom": "^18.0.10", + "@types/react-dom": "^18.0.11", "@types/styled-components": "^5.1.26", - "axios": "^1.3.2", - "eslint": "^8.33.0", + "axios": "^1.3.5", + "eslint": "^8.38.0", "react": "^18.2.0", "react-burger-menu": "^3.0.9", "react-dom": "^18.2.0", - "react-icons": "^4.7.1", - "react-router": "^6.8.0", - "react-router-dom": "^6.8.0", - "react-scripts": "^5.0.1", - "styled-components": "^5.3.6", - "typescript": "^4.9.4", + "react-icons": "^4.8.1-snapshot.2", + "react-router": "^6.10.0", + "react-router-dom": "^6.10.0", + "react-scripts": "^5.1.0-next.14", + "styled-components": "^6.0.0-beta.14", + "typescript": "^4.9.5", "universal-cookie": "^4.0.4", - "web-vitals": "^3.1.1" + "web-vitals": "^3.3.1" } }, "node_modules/@adobe/css-tools": { @@ -50,6 +50,70 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/cli": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.21.0.tgz", + "integrity": "sha512-xi7CxyS8XjSyiwUGCfwf+brtJxjW1/ZTcBUkP10xawIEXLX5HzLn+3aXkgxozcP2UhRhtKTmQurw9Uaes7jZrA==", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.17", + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.2.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0" + }, + "bin": { + "babel": "bin/babel.js", + "babel-external-helpers": "bin/babel-external-helpers.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "optionalDependencies": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", + "chokidar": "^3.4.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/cli/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@babel/cli/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/cli/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/cli/node_modules/slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "engines": { + "node": ">=6" + } + }, "node_modules/@babel/code-frame": { "version": "7.21.4", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", @@ -614,6 +678,20 @@ "@babel/core": "^7.13.0" } }, + "node_modules/@babel/plugin-external-helpers": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-external-helpers/-/plugin-external-helpers-7.18.6.tgz", + "integrity": "sha512-wNqc87qjLvsD1PIMQBzLn1bMuTlGzqLzM/1VGQ22Wm51cbCWS9k71ydp5iZS4hjwQNuTWSn/xbZkkusNENwtZg==", + "dependencies": { + "@babel/helper-plugin-utils": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-proposal-async-generator-functions": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz", @@ -2231,28 +2309,10 @@ "postcss-selector-parser": "^6.0.10" } }, - "node_modules/@emotion/is-prop-valid": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.0.tgz", - "integrity": "sha512-3aDpDprjM0AwaxGE09bOPkNxHpBd+kA6jty3RnaEXdweX1DF1U3VQpPYb0g1IStAuK7SVQ1cy+bNBBKp4W3Fjg==", - "dependencies": { - "@emotion/memoize": "^0.8.0" - } - }, - "node_modules/@emotion/memoize": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.0.tgz", - "integrity": "sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA==" - }, - "node_modules/@emotion/stylis": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", - "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==" - }, "node_modules/@emotion/unitless": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", - "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.0.tgz", + "integrity": "sha512-VINS5vEYAscRl2ZUDiT3uMPlrFQupiKgHz5AA4bCH1miKBg4qtwkim1qPmJj/4WG6TreYMY111rEFsjupcOKHw==" }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", @@ -3191,6 +3251,12 @@ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==" }, + "node_modules/@nicolo-ribaudo/chokidar-2": { + "version": "2.1.8-no-fsevents.3", + "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", + "integrity": "sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==", + "optional": true + }, "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { "version": "5.1.1-v1", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", @@ -3358,11 +3424,11 @@ } }, "node_modules/@rollup/plugin-node-resolve/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -3654,7 +3720,6 @@ "version": "9.2.0", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.2.0.tgz", "integrity": "sha512-xTEnpUKiV/bMyEsE5bT4oYA0x0Z/colMtxzUY8bKyPXBNLn/e0V4ZjBZkEhms0xE4pv9QsPfSRu9AWS4y5wGvA==", - "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -3703,40 +3768,22 @@ } }, "node_modules/@testing-library/react": { - "version": "13.4.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-13.4.0.tgz", - "integrity": "sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.0.0.tgz", + "integrity": "sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==", "dependencies": { "@babel/runtime": "^7.12.5", - "@testing-library/dom": "^8.5.0", + "@testing-library/dom": "^9.0.0", "@types/react-dom": "^18.0.0" }, "engines": { - "node": ">=12" + "node": ">=14" }, "peerDependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" } }, - "node_modules/@testing-library/react/node_modules/@testing-library/dom": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.0.tgz", - "integrity": "sha512-d9ULIT+a4EXLX3UU8FBjauG9NnsZHkHztXoIcTsOKoOw030fyjheN9svkTULjJxtYag9DZz5Jz5qkWZDPxTFwA==", - "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/runtime": "^7.12.5", - "@types/aria-query": "^5.0.1", - "aria-query": "^5.0.0", - "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.4.4", - "pretty-format": "^27.0.2" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@testing-library/user-event": { "version": "14.4.3", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.4.3.tgz", @@ -4034,9 +4081,9 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==" }, "node_modules/@types/react": { - "version": "18.0.33", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.33.tgz", - "integrity": "sha512-sHxzVxeanvQyQ1lr8NSHaj0kDzcNiGpILEVt69g9S31/7PfMvNCKLKcsHw4lYKjs3cGNJjXSP4mYzX43QlnjNA==", + "version": "18.0.35", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.35.tgz", + "integrity": "sha512-6Laome31HpetaIUGFWl1VQ3mdSImwxtFZ39rh059a1MNnKGqBpC88J6NJ8n/Is3Qx7CefDGLgf/KhN/sYCf7ag==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -4157,14 +4204,14 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.57.1.tgz", - "integrity": "sha512-1MeobQkQ9tztuleT3v72XmY0XuKXVXusAhryoLuU5YZ+mXoYKZP9SQ7Flulh1NX4DTjpGTc2b/eMu4u7M7dhnQ==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.58.0.tgz", + "integrity": "sha512-vxHvLhH0qgBd3/tW6/VccptSfc8FxPQIkmNTVLWcCOVqSBvqpnKkBTYrhcGlXfSnd78azwe+PsjYFj0X34/njA==", "dependencies": { "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/type-utils": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/scope-manager": "5.58.0", + "@typescript-eslint/type-utils": "5.58.0", + "@typescript-eslint/utils": "5.58.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -4189,12 +4236,42 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.57.1.tgz", - "integrity": "sha512-5F5s8mpM1Y0RQ5iWzKQPQm5cmhARgcMfUwyHX1ZZFL8Tm0PyzyQ+9jgYSMaW74XXvpDg9/KdmMICLlwNwKtO7w==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.58.0.tgz", + "integrity": "sha512-LA/sRPaynZlrlYxdefrZbMx8dqs/1Kc0yNG+XOk5CwwZx7tTv263ix3AJNioF0YBVt7hADpAUR20owl6pv4MIQ==", "dependencies": { - "@typescript-eslint/utils": "5.57.1" + "@typescript-eslint/utils": "5.58.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4208,13 +4285,13 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.57.1.tgz", - "integrity": "sha512-hlA0BLeVSA/wBPKdPGxoVr9Pp6GutGoY380FEhbVi0Ph4WNe8kLvqIRx76RSQt1lynZKfrXKs0/XeEk4zZycuA==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.58.0.tgz", + "integrity": "sha512-ixaM3gRtlfrKzP8N6lRhBbjTow1t6ztfBvQNGuRM8qH1bjFFXIJ35XY+FC0RRBKn3C6cT+7VW1y8tNm7DwPHDQ==", "dependencies": { - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.58.0", + "@typescript-eslint/types": "5.58.0", + "@typescript-eslint/typescript-estree": "5.58.0", "debug": "^4.3.4" }, "engines": { @@ -4234,12 +4311,12 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.57.1.tgz", - "integrity": "sha512-N/RrBwEUKMIYxSKl0oDK5sFVHd6VI7p9K5MyUlVYAY6dyNb/wHUqndkTd3XhpGlXgnQsBkRZuu4f9kAHghvgPw==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.58.0.tgz", + "integrity": "sha512-b+w8ypN5CFvrXWQb9Ow9T4/6LC2MikNf1viLkYTiTbkQl46CnR69w7lajz1icW0TBsYmlpg+mRzFJ4LEJ8X9NA==", "dependencies": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1" + "@typescript-eslint/types": "5.58.0", + "@typescript-eslint/visitor-keys": "5.58.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4250,12 +4327,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz", - "integrity": "sha512-/RIPQyx60Pt6ga86hKXesXkJ2WOS4UemFrmmq/7eOyiYjYv/MUSHPlkhU6k9T9W1ytnTJueqASW+wOmW4KrViw==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.58.0.tgz", + "integrity": "sha512-FF5vP/SKAFJ+LmR9PENql7fQVVgGDOS+dq3j+cKl9iW/9VuZC/8CFmzIP0DLKXfWKpRHawJiG70rVH+xZZbp8w==", "dependencies": { - "@typescript-eslint/typescript-estree": "5.57.1", - "@typescript-eslint/utils": "5.57.1", + "@typescript-eslint/typescript-estree": "5.58.0", + "@typescript-eslint/utils": "5.58.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -4276,9 +4353,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.57.1.tgz", - "integrity": "sha512-bSs4LOgyV3bJ08F5RDqO2KXqg3WAdwHCu06zOqcQ6vqbTJizyBhuh1o1ImC69X4bV2g1OJxbH71PJqiO7Y1RuA==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.58.0.tgz", + "integrity": "sha512-JYV4eITHPzVQMnHZcYJXl2ZloC7thuUHrcUmxtzvItyKPvQ50kb9QXBkgNAt90OYMqwaodQh2kHutWZl1fc+1g==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -4288,12 +4365,12 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.1.tgz", - "integrity": "sha512-A2MZqD8gNT0qHKbk2wRspg7cHbCDCk2tcqt6ScCFLr5Ru8cn+TCfM786DjPhqwseiS+PrYwcXht5ztpEQ6TFTw==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.58.0.tgz", + "integrity": "sha512-cRACvGTodA+UxnYM2uwA2KCwRL7VAzo45syNysqlMyNyjw0Z35Icc9ihPJZjIYuA5bXJYiJ2YGUB59BqlOZT1Q==", "dependencies": { - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/visitor-keys": "5.57.1", + "@typescript-eslint/types": "5.58.0", + "@typescript-eslint/visitor-keys": "5.58.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -4313,17 +4390,47 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/@typescript-eslint/utils": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.57.1.tgz", - "integrity": "sha512-kN6vzzf9NkEtawECqze6v99LtmDiUJCVpvieTFA1uL7/jDghiJGubGZ5csicYHU1Xoqb3oH/R5cN5df6W41Nfg==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.58.0.tgz", + "integrity": "sha512-gAmLOTFXMXOC+zP1fsqm3VceKSBQJNzV385Ok3+yzlavNHZoedajjS4UyS21gabJYcobuigQPs/z71A9MdJFqQ==", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.57.1", - "@typescript-eslint/types": "5.57.1", - "@typescript-eslint/typescript-estree": "5.57.1", + "@typescript-eslint/scope-manager": "5.58.0", + "@typescript-eslint/types": "5.58.0", + "@typescript-eslint/typescript-estree": "5.58.0", "eslint-scope": "^5.1.1", "semver": "^7.3.7" }, @@ -4358,12 +4465,42 @@ "node": ">=4.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.1.tgz", - "integrity": "sha512-RjQrAniDU0CEk5r7iphkm731zKlFiUjvcBS2yHAg8WWqFMCaCrD0rKEVOMUyMMcbGPZ0bPp56srkGWrgfZqLRA==", + "version": "5.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.58.0.tgz", + "integrity": "sha512-/fBraTlPj0jwdyTwLyrRTxv/3lnU2H96pNTVM6z3esTWLtA5MZ9ghSMJ7Rb+TtUAdtEw9EyJzJ0EydIMKxQ9gA==", "dependencies": { - "@typescript-eslint/types": "5.57.1", + "@typescript-eslint/types": "5.58.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -5124,11 +5261,11 @@ } }, "node_modules/babel-plugin-macros/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -5140,9 +5277,9 @@ } }, "node_modules/babel-plugin-named-asset-import": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.8.tgz", - "integrity": "sha512-WXiAc++qo7XcJ1ZnTYGtLxmBCVbddAml3CEXgWaBzNzLNoxtQ8AiGEFDMOhot9XjTCQbvP5E77Fj9Gk924f00Q==", + "version": "0.4.0-next.14", + "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.4.0-next.14.tgz", + "integrity": "sha512-MazwHExK09ffj7qGS++lmcPNXG7dB2BDF8vLmO1dgkK3p10fV4NNE9hljmwoiDM52vgeMd9hJW9GBOCEnEpL/Q==", "peerDependencies": { "@babel/core": "^7.1.0" } @@ -5191,26 +5328,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/babel-plugin-styled-components": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-2.1.1.tgz", - "integrity": "sha512-c8lJlszObVQPguHkI+akXv8+Jgb9Ccujx0EetL7oIvwU100LxO6XAGe45qry37wUL40a5U9f23SYrivro2XKhA==", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.0", - "@babel/helper-module-imports": "^7.16.0", - "babel-plugin-syntax-jsx": "^6.18.0", - "lodash": "^4.17.21", - "picomatch": "^2.3.0" - }, - "peerDependencies": { - "styled-components": ">= 2" - } - }, - "node_modules/babel-plugin-syntax-jsx": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", - "integrity": "sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==" - }, "node_modules/babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -5254,9 +5371,9 @@ } }, "node_modules/babel-preset-react-app": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-10.0.1.tgz", - "integrity": "sha512-b0D9IZ1WhhCWkrTXyFuIIgqGzSkRIH5D5AmB0bXbzYAB1OBAwHcUeyWW2LorutLWF5btNo/N7r/cIdmvvKJlYg==", + "version": "10.1.0-next.14", + "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-10.1.0-next.14.tgz", + "integrity": "sha512-/xYDXmFaTFqny9vVvsaNigvt0zzFRjjgi/3oTCeg3UzPKcWW1O6WG9JyeAV3d47Sewyr7i5B57nL5or32Vnn6A==", "dependencies": { "@babel/core": "^7.16.0", "@babel/plugin-proposal-class-properties": "^7.16.0", @@ -5827,9 +5944,9 @@ "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==" }, "node_modules/colorette": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", - "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==" + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==" }, "node_modules/combined-stream": { "version": "1.0.8", @@ -5920,9 +6037,9 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/confusing-browser-globals": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", - "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==" + "version": "1.1.0-next.14", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.1.0-next.14.tgz", + "integrity": "sha512-shpUugMlZFU47qCZ4BuoAoAlUKOjiO7Nhn1aVFx1RADeAbKdgJ1iFc18b9KPY5GRr4EnU22boZrMSlo/NfQzwQ==" }, "node_modules/connect-history-api-fallback": { "version": "2.0.0", @@ -5970,9 +6087,9 @@ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, "node_modules/core-js": { - "version": "3.30.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.30.0.tgz", - "integrity": "sha512-hQotSSARoNh1mYPi9O2YaWeiq/cEB95kOrFb4NCrO4RIFt1qqNpKsaE+vy/L3oiqvND5cThqXzUU3r9F7Efztg==", + "version": "3.30.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.30.1.tgz", + "integrity": "sha512-ZNS5nbiSwDTq4hFosEDqm65izl2CWmLz0hARJMyNQBgkUZMIF51cQiMvIQKA6hvuaeWxQDP3hEedM1JZIgTldQ==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -5992,9 +6109,9 @@ } }, "node_modules/core-js-pure": { - "version": "3.30.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.30.0.tgz", - "integrity": "sha512-+2KbMFGeBU0ln/csoPqTe0i/yfHbrd2EUhNMObsGtXMKS/RTtlkYyi+/3twLcevbgNR0yM/r0Psa3TEoQRpFMQ==", + "version": "3.30.1", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.30.1.tgz", + "integrity": "sha512-nXBEVpmUnNRhz83cHd9JRQC52cTMcuXAmR56+9dSMpRdpeA4I1PX6yjmhd71Eyc/wXNsdBdUDIj1QTIeZpU5Tg==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -6120,6 +6237,36 @@ "webpack": "^5.0.0" } }, + "node_modules/css-loader/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-loader/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/css-loader/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/css-minimizer-webpack-plugin": { "version": "3.4.1", "resolved": "https://registry.npmjs.org/css-minimizer-webpack-plugin/-/css-minimizer-webpack-plugin-3.4.1.tgz", @@ -6189,14 +6336,14 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/css-minimizer-webpack-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", "dependencies": { "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", + "ajv": "^8.9.0", "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 12.13.0" @@ -6295,9 +6442,9 @@ "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==" }, "node_modules/cssdb": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-7.5.3.tgz", - "integrity": "sha512-NQNRhrEnS6cW+RU/foLphb6xI/MDA70bI3Cy6VxJU8ilxgyTYz1X9zUzFGVTG5nGPylcKAGIt/UNc4deT56lQQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/cssdb/-/cssdb-7.5.4.tgz", + "integrity": "sha512-fGD+J6Jlq+aurfE1VDXlLS4Pt0VtNlu2+YgfGOdMxRyl/HQ9bDiHTwSck1Yz8A97Dt/82izSK6Bp/4nVqacOsg==", "funding": { "type": "opencollective", "url": "https://opencollective.com/csstools" @@ -6964,9 +7111,9 @@ } }, "node_modules/es-module-lexer": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", - "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==" }, "node_modules/es-set-tostringtag": { "version": "2.0.1", @@ -7122,17 +7269,17 @@ } }, "node_modules/eslint-config-react-app": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", - "integrity": "sha512-K6rNzvkIeHaTd8m/QEh1Zko0KI7BACWkkneSs6s9cKZC/J27X3eZR6Upt1jkmZ/4FK+XUOPPxMEN7+lbUXfSlA==", + "version": "7.1.0-next.14", + "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.1.0-next.14.tgz", + "integrity": "sha512-E7nP1tWYDe2y3bS6MVIt/Iw3R3fYqhRqcQXGeMf066ohUaYoIZMbPpi69MjCxwjaqQOJUoYTKNO5oPwwc5Wpkg==", "dependencies": { "@babel/core": "^7.16.0", "@babel/eslint-parser": "^7.16.3", "@rushstack/eslint-patch": "^1.1.0", "@typescript-eslint/eslint-plugin": "^5.5.0", "@typescript-eslint/parser": "^5.5.0", - "babel-preset-react-app": "^10.0.1", - "confusing-browser-globals": "^1.0.11", + "babel-preset-react-app": "10.1.0-next.14+9802941f", + "confusing-browser-globals": "1.1.0-next.14+9802941f", "eslint-plugin-flowtype": "^8.0.3", "eslint-plugin-import": "^2.25.3", "eslint-plugin-jest": "^25.3.0", @@ -7167,11 +7314,11 @@ } }, "node_modules/eslint-import-resolver-node/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -7183,9 +7330,9 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", - "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", "dependencies": { "debug": "^3.2.7" }, @@ -7271,11 +7418,11 @@ } }, "node_modules/eslint-plugin-import/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -7429,11 +7576,11 @@ } }, "node_modules/eslint-plugin-testing-library": { - "version": "5.10.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.10.2.tgz", - "integrity": "sha512-f1DmDWcz5SDM+IpCkEX0lbFqrrTs8HRsEElzDEqN/EBI0hpRj8Cns5+IVANXswE8/LeybIJqPAOQIFu2j5Y5sw==", + "version": "5.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.10.3.tgz", + "integrity": "sha512-0yhsKFsjHLud5PM+f2dWr9K3rqYzMy4cSHs3lcmFYMa1CdSzRvHGgXvsFarBjZ41gU8jhTdMIkg8jHLxGJqLqw==", "dependencies": { - "@typescript-eslint/utils": "^5.43.0" + "@typescript-eslint/utils": "^5.58.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0", @@ -7534,14 +7681,14 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/eslint-webpack-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", "dependencies": { "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", + "ajv": "^8.9.0", "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 12.13.0" @@ -8090,6 +8237,17 @@ "node": ">=10" } }, + "node_modules/fork-ts-checker-webpack-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fork-ts-checker-webpack-plugin/node_modules/schema-utils": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", @@ -8107,6 +8265,20 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/fork-ts-checker-webpack-plugin/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/fork-ts-checker-webpack-plugin/node_modules/tapable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", @@ -8115,6 +8287,11 @@ "node": ">=6" } }, + "node_modules/fork-ts-checker-webpack-plugin/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -8174,6 +8351,11 @@ "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.3.tgz", "integrity": "sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q==" }, + "node_modules/fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==" + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -8640,9 +8822,9 @@ } }, "node_modules/html-webpack-plugin": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.5.0.tgz", - "integrity": "sha512-sy88PC2cRTVxvETRgUHFrL4No3UxvcH8G1NepGhqaTT+GXN2kTamqasot0inS5hXeg1cMbFDt27zzo9p35lZVw==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-5.5.1.tgz", + "integrity": "sha512-cTUzZ1+NqjGEKjmVgZKLMdiFg3m9MdRXkZW2OEe69WYVi5ONLMmlnSZdXzGGMOq0C8jGDrL6EWyEDDUioHO/pA==", "dependencies": { "@types/html-minifier-terser": "^6.0.0", "html-minifier-terser": "^6.0.2", @@ -8999,9 +9181,9 @@ } }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", "dependencies": { "has": "^1.0.3" }, @@ -10467,11 +10649,11 @@ } }, "node_modules/jest-resolve/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -10821,6 +11003,36 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/jest-util": { "version": "29.5.0", "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.5.0.tgz", @@ -11872,14 +12084,14 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", "dependencies": { "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", + "ajv": "^8.9.0", "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 12.13.0" @@ -12068,9 +12280,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.3.tgz", - "integrity": "sha512-jscxIO4/VKScHlbmFBdV1Z6LXnLO+ZR4VMtypudUdfwtKxUN3TQcNFIHLwKtrUbDyHN4/GycY9+oRGZ2XMXYPw==" + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.4.tgz", + "integrity": "sha512-NHj4rzRo0tQdijE9ZqAx6kYDcoRwYwSYzCA8MY3JzfxlrvEU0jhnhJT9BhqhJs7I/dKcrDm6TyulaRqZPIhN5g==" }, "node_modules/object-assign": { "version": "4.1.1", @@ -12601,9 +12813,9 @@ } }, "node_modules/postcss": { - "version": "8.4.21", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", - "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", + "version": "8.4.22", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.22.tgz", + "integrity": "sha512-XseknLAfRHzVWjCEtdviapiBtfLdgyzExD50Rg2ePaucEesyh8Wv4VPdW0nbyDa1ydbrAxV19jvMT4+LFmcNUA==", "funding": [ { "type": "opencollective", @@ -12612,10 +12824,14 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "nanoid": "^3.3.4", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -13101,6 +13317,36 @@ "webpack": "^5.0.0" } }, + "node_modules/postcss-loader/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss-loader/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/postcss-loader/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/postcss-logical": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/postcss-logical/-/postcss-logical-5.0.4.tgz", @@ -14029,9 +14275,9 @@ } }, "node_modules/react-app-polyfill": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.0.0.tgz", - "integrity": "sha512-sZ41cxiU5llIB003yxxQBYrARBqe0repqPTTYBTmMqTz9szeBbE37BehCE891NZsmdZqqP+xWKdT3eo3vOzN8w==", + "version": "3.1.0-next.14", + "resolved": "https://registry.npmjs.org/react-app-polyfill/-/react-app-polyfill-3.1.0-next.14.tgz", + "integrity": "sha512-ki6Vg6IbszoxR0L70KiAUc+Fg7snl3X9nDMM3aP9cwmnj3kJE33pEIxjQwACBOjGpx/kVRQ7JzQD4VLSrGqNYw==", "dependencies": { "core-js": "^3.19.2", "object-assign": "^4.1.1", @@ -14064,9 +14310,9 @@ } }, "node_modules/react-dev-utils": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", - "integrity": "sha512-84Ivxmr17KjUupyqzFode6xKhjwuEJDROWKJy/BthkL7Wn6NJ8h4WE6k/exAv6ImS+0oZLRRW5j/aINMHyeGeQ==", + "version": "12.1.0-next.14", + "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.1.0-next.14.tgz", + "integrity": "sha512-KJmfdZhLvsvNc2tWYyGFGwp71+0E+3hYwgEeYqG1JJ9i6z3TV4byweag/p84Htsra0Asfp5akHMVwyRQr1+VAg==", "dependencies": { "@babel/code-frame": "^7.16.0", "address": "^1.1.2", @@ -14087,7 +14333,7 @@ "open": "^8.4.0", "pkg-up": "^3.1.0", "prompts": "^2.4.2", - "react-error-overlay": "^6.0.11", + "react-error-overlay": "6.1.0-next.14+9802941f", "recursive-readdir": "^2.2.2", "shell-quote": "^1.7.3", "strip-ansi": "^6.0.1", @@ -14118,14 +14364,14 @@ } }, "node_modules/react-error-overlay": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz", - "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==" + "version": "6.1.0-next.14", + "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.1.0-next.14.tgz", + "integrity": "sha512-s6V1MF7/hheDh0WbbauMYu62H6z5n9PRPgUO/6RFm/V0srHcCO0gtBlz3AwkhldcQRcMaYAAkLO5o+6rTO/xkA==" }, "node_modules/react-icons": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.8.0.tgz", - "integrity": "sha512-N6+kOLcihDiAnj5Czu637waJqSnwlMNROzVZMhfX68V/9bu9qHaMIJC4UdozWoOk57gahFCNHwVvWzm0MTzRjg==", + "version": "4.8.1-snapshot.2", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.8.1-snapshot.2.tgz", + "integrity": "sha512-EC41ETSFRtpAuwstiDw/8rkjWbw13TQAQDIQDckCOnAgf1bPcXOx+OLUzCNpNd4sPwl/P8dSFqTwSUYybYWmJQ==", "peerDependencies": { "react": "*" } @@ -14174,17 +14420,17 @@ } }, "node_modules/react-scripts": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.1.tgz", - "integrity": "sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==", + "version": "5.1.0-next.14", + "resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-5.1.0-next.14.tgz", + "integrity": "sha512-c4Z8eO8nNm6LWDzovOm5gHcL1+eqo5Ll2FqKnfpydAGfEbPhxMWDau8NAg0d/QZ5jWjj9GgRoet5q9nqn9N/vQ==", "dependencies": { "@babel/core": "^7.16.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@svgr/webpack": "^5.5.0", "babel-jest": "^27.4.2", "babel-loader": "^8.2.3", - "babel-plugin-named-asset-import": "^0.3.8", - "babel-preset-react-app": "^10.0.1", + "babel-plugin-named-asset-import": "0.4.0-next.14+9802941f", + "babel-preset-react-app": "10.1.0-next.14+9802941f", "bfj": "^7.0.2", "browserslist": "^4.18.1", "camelcase": "^6.2.1", @@ -14194,7 +14440,7 @@ "dotenv": "^10.0.0", "dotenv-expand": "^5.1.0", "eslint": "^8.3.0", - "eslint-config-react-app": "^7.0.1", + "eslint-config-react-app": "7.1.0-next.14+9802941f", "eslint-webpack-plugin": "^3.1.1", "file-loader": "^6.2.0", "fs-extra": "^10.0.0", @@ -14210,8 +14456,8 @@ "postcss-normalize": "^10.0.1", "postcss-preset-env": "^7.0.1", "prompts": "^2.4.2", - "react-app-polyfill": "^3.0.0", - "react-dev-utils": "^12.0.1", + "react-app-polyfill": "3.1.0-next.14+9802941f", + "react-dev-utils": "12.1.0-next.14+9802941f", "react-refresh": "^0.11.0", "resolve": "^1.20.0", "resolve-url-loader": "^4.0.0", @@ -14245,12 +14491,23 @@ } } }, + "node_modules/react-scripts/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/react-scripts/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -14261,6 +14518,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/react-scripts/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/react-scripts/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -14745,9 +15021,9 @@ } }, "node_modules/schema-utils": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", - "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz", + "integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==", "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -14778,35 +15054,13 @@ } }, "node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" + "semver": "bin/semver" } }, - "node_modules/semver/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -15376,51 +15630,54 @@ } }, "node_modules/styled-components": { - "version": "5.3.9", - "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.3.9.tgz", - "integrity": "sha512-Aj3kb13B75DQBo2oRwRa/APdB5rSmwUfN5exyarpX+x/tlM/rwZA2vVk2vQgVSP6WKaZJHWwiFrzgHt+CLtB4A==", - "dependencies": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/traverse": "^7.4.5", - "@emotion/is-prop-valid": "^1.1.0", - "@emotion/stylis": "^0.8.4", - "@emotion/unitless": "^0.7.4", - "babel-plugin-styled-components": ">= 1.12.0", - "css-to-react-native": "^3.0.0", - "hoist-non-react-statics": "^3.0.0", + "version": "6.0.0-beta.14", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.0.0-beta.14.tgz", + "integrity": "sha512-0qYE+pIQGt971zSDM6dap4bNmVvdXDhs/CKa58gDdh+DjTrWfTv7ULynMxigvvzzoVNuYFInEhz0HjOWJRzDhw==", + "dependencies": { + "@babel/cli": "^7.21.0", + "@babel/core": "^7.21.0", + "@babel/helper-module-imports": "^7.18.6", + "@babel/plugin-external-helpers": "^7.18.6", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-proposal-object-rest-spread": "^7.20.7", + "@babel/preset-env": "^7.20.2", + "@babel/preset-react": "^7.18.6", + "@babel/preset-typescript": "^7.21.0", + "@babel/traverse": "^7.21.2", + "@emotion/unitless": "^0.8.0", + "css-to-react-native": "^3.2.0", "shallowequal": "^1.1.0", - "supports-color": "^5.5.0" + "stylis": "^4.1.3", + "tslib": "^2.5.0" }, "engines": { - "node": ">=10" + "node": ">= 14" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/styled-components" }, "peerDependencies": { + "babel-plugin-styled-components": ">= 2", "react": ">= 16.8.0", "react-dom": ">= 16.8.0", - "react-is": ">= 16.8.0" - } - }, - "node_modules/styled-components/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/styled-components/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dependencies": { - "has-flag": "^3.0.0" + "shallowequal": ">= 1", + "stylis": "^4.0.0", + "tslib": "^2.0.0" }, - "engines": { - "node": ">=4" + "peerDependenciesMeta": { + "babel-plugin-styled-components": { + "optional": true + }, + "shallowequal": { + "optional": true + }, + "stylis": { + "optional": true + }, + "tslib": { + "optional": true + } } }, "node_modules/stylehacks": { @@ -15438,11 +15695,17 @@ "postcss": "^8.2.15" } }, + "node_modules/stylis": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz", + "integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==" + }, "node_modules/sucrase": { - "version": "3.31.0", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.31.0.tgz", - "integrity": "sha512-6QsHnkqyVEzYcaiHsOKkzOtOgdJcb8i54x6AV2hDwyZcY9ZyykGZVw6L/YN98xC0evwTP6utsWWrKRaa8QlfEQ==", + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.32.0.tgz", + "integrity": "sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==", "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "glob": "7.1.6", "lines-and-columns": "^1.1.6", @@ -15747,11 +16010,11 @@ } }, "node_modules/tailwindcss/node_modules/resolve": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", - "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", "dependencies": { - "is-core-module": "^2.11.0", + "is-core-module": "^2.12.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -15822,9 +16085,9 @@ } }, "node_modules/terser": { - "version": "5.16.8", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.8.tgz", - "integrity": "sha512-QI5g1E/ef7d+PsDifb+a6nnVgC4F22Bg6T0xrBrz6iloVB4PUkkunp6V8nzoOOZJIzjWVdAGqCdlKlhLq/TbIA==", + "version": "5.16.9", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz", + "integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==", "dependencies": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -16405,12 +16668,12 @@ } }, "node_modules/webpack": { - "version": "5.78.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.78.0.tgz", - "integrity": "sha512-gT5DP72KInmE/3azEaQrISjTvLYlSM0j1Ezhht/KLVkrqtv10JoP/RXhwmX/frrutOPuSq3o5Vq0ehR/4Vmd1g==", + "version": "5.79.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", + "integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==", "dependencies": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^0.0.51", + "@types/estree": "^1.0.0", "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1", @@ -16419,7 +16682,7 @@ "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.10.0", - "es-module-lexer": "^0.9.0", + "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", @@ -16430,7 +16693,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.1.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.3", + "terser-webpack-plugin": "^5.3.7", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, @@ -16504,14 +16767,14 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/webpack-dev-middleware/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", "dependencies": { "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", + "ajv": "^8.9.0", "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 12.13.0" @@ -16522,9 +16785,9 @@ } }, "node_modules/webpack-dev-server": { - "version": "4.13.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.13.2.tgz", - "integrity": "sha512-5i6TrGBRxG4vnfDpB6qSQGfnB6skGBXNL5/542w2uRGLimX6qeE5BQMLrzIC3JYV/xlGOv+s+hTleI9AZKUQNw==", + "version": "4.13.3", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.13.3.tgz", + "integrity": "sha512-KqqzrzMRSRy5ePz10VhjyL27K2dxqwXQLP5rAKwRJBPUahe7Z2bBWzHw37jeb8GCPKxZRO79ZdQUAPesMh/Nug==", "dependencies": { "@types/bonjour": "^3.5.9", "@types/connect-history-api-fallback": "^1.3.5", @@ -16611,14 +16874,14 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/webpack-dev-server/node_modules/schema-utils": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", - "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", + "integrity": "sha512-lELhBAAly9NowEsX0yZBlw9ahZG+sK/1RJ21EpzdYHKEs13Vku3LJ+MIPhh4sMs0oCCeufZQEQbMekiA4vuVIQ==", "dependencies": { "@types/json-schema": "^7.0.9", - "ajv": "^8.8.0", + "ajv": "^8.9.0", "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.0.0" + "ajv-keywords": "^5.1.0" }, "engines": { "node": ">= 12.13.0" @@ -16691,11 +16954,6 @@ "node": ">=10.13.0" } }, - "node_modules/webpack/node_modules/@types/estree": { - "version": "0.0.51", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", - "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" - }, "node_modules/webpack/node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", diff --git a/package.json b/package.json index 67f0862..9951d38 100644 --- a/package.json +++ b/package.json @@ -4,28 +4,28 @@ "private": true, "dependencies": { "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^13.4.0", + "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "@types/axios": "^0.14.0", - "@types/jest": "^29.4.0", - "@types/node": "^18.11.18", - "@types/react": "^18.0.27", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.11", + "@types/react": "^18.0.35", "@types/react-burger-menu": "^2.8.3", - "@types/react-dom": "^18.0.10", + "@types/react-dom": "^18.0.11", "@types/styled-components": "^5.1.26", - "axios": "^1.3.2", - "eslint": "^8.33.0", + "axios": "^1.3.5", + "eslint": "^8.38.0", "react": "^18.2.0", "react-burger-menu": "^3.0.9", "react-dom": "^18.2.0", - "react-icons": "^4.7.1", - "react-router": "^6.8.0", - "react-router-dom": "^6.8.0", - "react-scripts": "^5.0.1", - "styled-components": "^5.3.6", - "typescript": "^4.9.4", + "react-icons": "^4.8.1-snapshot.2", + "react-router": "^6.10.0", + "react-router-dom": "^6.10.0", + "react-scripts": "^5.1.0-next.14", + "styled-components": "^6.0.0-beta.14", + "typescript": "^4.9.5", "universal-cookie": "^4.0.4", - "web-vitals": "^3.1.1" + "web-vitals": "^3.3.1" }, "scripts": { "start": "react-scripts start", @@ -51,4 +51,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file From b9689e3f3688a5350a8ceb9d96c58f28dfbc8abd Mon Sep 17 00:00:00 2001 From: Yusuf Arfan Ismail Date: Mon, 17 Apr 2023 10:50:20 +0000 Subject: [PATCH 6/7] Using maps now so no need for duplicate code --- src/components/Status.tsx | 16 +++++----- src/pages/config/Moderation.tsx | 40 +++++++++---------------- src/utils/HashMap.ts | 52 +++++++++++++++++++++++++++++++++ src/utils/db.ts | 28 ++++++++++-------- src/utils/enums.ts | 7 +---- 5 files changed, 89 insertions(+), 54 deletions(-) create mode 100644 src/utils/HashMap.ts diff --git a/src/components/Status.tsx b/src/components/Status.tsx index c92c7d5..2a13bec 100644 --- a/src/components/Status.tsx +++ b/src/components/Status.tsx @@ -1,14 +1,12 @@ import { CustomSelect, Flex, Button } from "../utils/styles"; export const Status = ( - id: string, - currentValueStatus: boolean, - setValue: React.Dispatch>, + statusId: string, + valueStatus: boolean, saveFunction: (id: string, status: boolean) => void ) => { - const save = () => { - saveFunction(id, currentValueStatus); + saveFunction(statusId, valueStatus); }; return ( @@ -19,13 +17,13 @@ export const Status = ( { + if (e.target.value === "Enabled") { + this.setValue(true) + } else { + this.setValue(false) + } + }} + > + + + + + +
+ + + + + + ) + } +} + +interface DropdownProps extends SettingProps { + options: T[]; +} + +export class DropdownSetting extends Setting> { + + constructor( + id: string, + validators: [(value: T) => boolean], + options: T[] + ) { + super(id, validators, {options: options}); + } + + getDisplay(): any { + return ( + <> +
+
+ +
+ + + +
+ + + + + + ) + } +} diff --git a/src/pages/config/Moderation.tsx b/src/pages/config/Moderation.tsx index 005088f..afe126e 100644 --- a/src/pages/config/Moderation.tsx +++ b/src/pages/config/Moderation.tsx @@ -1,55 +1,32 @@ -import { Container, Page, PageTitle } from "../../utils/styles"; -import { useContext, useEffect, useState } from "react"; -import { GuildContext } from "../../utils/context/GuildContext"; -import { fetchSettings, updateSettings } from "../../utils/db"; -import { RetrievableSettings } from "../../utils/enums"; -import { Status } from "../../components/Status"; -import { HashMap } from "../../utils/HashMap"; +import {Container, Page, PageTitle} from "../../utils/styles"; +import {useContext, useEffect, useState} from "react"; +import {GuildContext} from "../../utils/context/GuildContext"; +import {fetchSettings} from "../../utils/db"; +import {DropdownSetting} from "../../components/Setting"; export const Moderation = () => { const { guild } = useContext(GuildContext); const guildId = (guild && guild.id) || ""; - const [currentModerationStatuses, setCurrentModerationStatuses] = useState( - new HashMap() - ); const [currentLoadingStatus, setCurrentLoadingStatus] = useState("waiting"); useEffect(() => { if (currentLoadingStatus === "waiting") { setCurrentLoadingStatus("loading"); - fetchSettings(RetrievableSettings.MODERATION, guildId).then((res) => { - setCurrentModerationStatuses(res); + fetchSettings(guildId).then((res) => { setCurrentLoadingStatus("loaded"); }); } }, [currentLoadingStatus, guildId]); - const save = async (id: string, status: boolean) => { - try { - setCurrentModerationStatuses(HashMap.of(id, status)); - await updateSettings( - RetrievableSettings.MODERATION, - guildId, - currentModerationStatuses - ); - } catch (err) { - console.log(err); - } - }; - return ( Moderation Config -

Enable/Disable Anti-Spoiler

{currentLoadingStatus === "loading" &&

Loading...

} {currentLoadingStatus === "loaded" && - Status( - "anti-spoiler", - currentModerationStatuses.get("anti-spoiler") || false, - save - )} + + }
); diff --git a/src/utils/api.ts b/src/utils/api.ts index c0ab244..0a56eb5 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -66,3 +66,9 @@ export const getBotInviteUrl = (): string => { export const getBotApiUrl = (): string => { return configData.bot_api; }; + +// https://github.com/microsoft/TypeScript/issues/30611#issuecomment-570773496 +export function createEnumChecker(enumVariable: { [key in T]: TEnumValue }) { + const enumValues = Object.values(enumVariable) + return (value: string): value is TEnumValue => enumValues.includes(value) +} diff --git a/src/utils/db.ts b/src/utils/db.ts index 5d2aea7..2f656ea 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -1,26 +1,23 @@ import { getCookie } from "./Cookies"; import { HashMap } from "./HashMap"; import { getBotApiUrl } from "./api"; -import { RetrievableSettings } from "./enums"; export const fetchSettings = async ( - name: RetrievableSettings, guildId: string ): Promise => { - fetch(getBotApiUrl() + name, { + fetch(getBotApiUrl() + "/settings/guild/" + guildId, { method: "GET", headers: { AUTHORIZATION: "Bearer " + getCookie("access_token"), - guildId: guildId, }, }) .then((response) => { if (response.ok) { return response.json(); } else { - alert("Something went wrong while fetching the setting " + name); + alert("Something went wrong while fetching the settings "); throw new Error( - "Something went wrong while fetching the setting " + name + "Something went wrong while fetching the settings " ); } }) @@ -33,11 +30,10 @@ export const fetchSettings = async ( }; export const updateSettings = async ( - name: RetrievableSettings, guildId: string, data: HashMap ) => { - fetch(getBotApiUrl() + name, { + fetch(getBotApiUrl() + "/settings/guild/" + guildId, { method: "POST", headers: { AUTHORIZATION: "Bearer " + getCookie("access_token"), diff --git a/src/utils/enums.ts b/src/utils/enums.ts deleted file mode 100644 index ddcec7e..0000000 --- a/src/utils/enums.ts +++ /dev/null @@ -1,4 +0,0 @@ -//enum -export enum RetrievableSettings { - MODERATION = "guilds/moderation", -}