+
+
+
+
+
+
+
+
+ >
+ );
+};
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
-
-
+
+
+ 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 */}
-
-