Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Commit

Permalink
Merge pull request #20 from game-node-app/dev
Browse files Browse the repository at this point in the history
- Add discord login option
  • Loading branch information
Lamarcke authored Mar 9, 2024
2 parents cd8b105 + 4084481 commit 4a24797
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/components/auth/SuperTokensProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const frontendConfig = () => {
contactMethod: "EMAIL",
signInUpFeature: {
providers: [
ThirdPartyPasswordlessReact.Google.init(),
ThirdPartyPasswordlessReact.Github.init(),
ThirdPartyPasswordlessReact.Apple.init(),
// TODO: Enable once it's approved
// ThirdPartyPasswordlessReact.Google.init(),
ThirdPartyPasswordlessReact.Discord.init(),
],
},
}),
Expand Down
23 changes: 8 additions & 15 deletions src/components/preferences/handlers/PreferencesUsernameChanger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Button, Stack, Text, TextInput, Title } from "@mantine/core";
import { useMutation } from "@tanstack/react-query";
import { ProfileService } from "@/wrapper/server";
import { BaseModalChildrenProps } from "@/util/types/modal-props";
import { notifications } from "@mantine/notifications";

interface Props extends BaseModalChildrenProps {}

Expand All @@ -24,16 +25,14 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => {
},
onSuccess: () => {
profile.invalidate();
notifications.show({
color: "green",
message: "Your username has been updated!",
});
if (onClose) onClose();
},
});

const checkBlockedFromUpdating = useCallback(() => {
// TODO: Implement this check

return false;
}, []);

const handleSubmit = (evt: FormEvent<HTMLFormElement>) => {
evt.preventDefault();
const formData = new FormData(evt.currentTarget);
Expand All @@ -44,12 +43,6 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => {

return (
<form className={"w-full h-full"} onSubmit={handleSubmit}>
{checkBlockedFromUpdating() && (
<Text c={"red"} mb={"2rem"}>
You have updated your username in the last 30 days and can't
update it yet.
</Text>
)}
{profileMutation.isError && (
<Text c={"red"}>{profileMutation.error.message}</Text>
)}
Expand All @@ -63,13 +56,13 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => {
"It must be unique and have at least five characters."
}
minLength={5}
disabled={checkBlockedFromUpdating()}
defaultValue={profile.data?.username}
/>

<Button
loading={true}
loading={profileMutation.isPending}
type={"submit"}
disabled={checkBlockedFromUpdating()}
disabled={profileMutation.isPending}
>
Submit
</Button>
Expand Down

0 comments on commit 4a24797

Please sign in to comment.