diff --git a/app/settings/components/danger-zone.tsx b/app/settings/components/account/danger-zone.tsx
similarity index 75%
rename from app/settings/components/danger-zone.tsx
rename to app/settings/components/account/danger-zone.tsx
index 694b9de..f29c848 100644
--- a/app/settings/components/danger-zone.tsx
+++ b/app/settings/components/account/danger-zone.tsx
@@ -2,10 +2,10 @@ import { useRef, useState } from "react";
import { useMutation } from "blitz";
import clsx from "clsx";
-import Button from "./button";
-import SettingsSection from "./settings-section";
-import Modal, { ModalTitle } from "./modal";
-import deleteUser from "../mutations/delete-user";
+import Button from "../button";
+import SettingsSection from "../settings-section";
+import Modal, { ModalTitle } from "../modal";
+import deleteUser from "../../mutations/delete-user";
export default function DangerZone() {
const deleteUserMutation = useMutation(deleteUser)[0];
@@ -26,20 +26,18 @@ export default function DangerZone() {
};
return (
-
-
-
-
- Once you delete your account, all of its data will be permanently deleted and any ongoing
- subscription will be cancelled.
-
+
+
+
+ Once you delete your account, all of its data will be permanently deleted and any ongoing
+ subscription will be cancelled.
+
-
-
-
-
+
+
+
diff --git a/app/settings/components/account/profile-informations.tsx b/app/settings/components/account/profile-informations.tsx
new file mode 100644
index 0000000..93d4581
--- /dev/null
+++ b/app/settings/components/account/profile-informations.tsx
@@ -0,0 +1,115 @@
+import type { FunctionComponent } from "react";
+import { useEffect } from "react";
+import { useMutation } from "blitz";
+import { useForm } from "react-hook-form";
+
+import updateUser from "../../mutations/update-user";
+import Alert from "../../../core/components/alert";
+import Button from "../button";
+import SettingsSection from "../settings-section";
+import useCurrentUser from "../../../core/hooks/use-current-user";
+
+import appLogger from "../../../../integrations/logger";
+
+type Form = {
+ fullName: string;
+ email: string;
+};
+
+const logger = appLogger.child({ module: "profile-settings" });
+
+const ProfileInformations: FunctionComponent = () => {
+ const { user } = useCurrentUser();
+ const [updateUserMutation, { error, isError, isSuccess }] = useMutation(updateUser);
+ const {
+ register,
+ handleSubmit,
+ setValue,
+ formState: { isSubmitting },
+ } = useForm
+ }
+ >
+ {isError ? (
+
+ ) : null}
+
+ {isSuccess ? (
+
+ ) : null}
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default ProfileInformations;
+
+function parseErrorMessage(error: Error | null): string {
+ if (!error) {
+ return "";
+ }
+
+ if (error.name === "ZodError") {
+ return JSON.parse(error.message)[0].message;
+ }
+
+ return error.message;
+}
diff --git a/app/settings/components/account/update-password.tsx b/app/settings/components/account/update-password.tsx
new file mode 100644
index 0000000..0f2bb44
--- /dev/null
+++ b/app/settings/components/account/update-password.tsx
@@ -0,0 +1,112 @@
+import type { FunctionComponent } from "react";
+import { useMutation } from "blitz";
+import { useForm } from "react-hook-form";
+
+import Alert from "../../../core/components/alert";
+import Button from "../button";
+import SettingsSection from "../settings-section";
+
+import appLogger from "../../../../integrations/logger";
+import changePassword from "../../mutations/change-password";
+
+const logger = appLogger.child({ module: "update-password" });
+
+type Form = {
+ currentPassword: string;
+ newPassword: string;
+};
+
+const UpdatePassword: FunctionComponent = () => {
+ const [changePasswordMutation, { error, isError, isSuccess }] = useMutation(changePassword);
+ const {
+ register,
+ handleSubmit,
+ formState: { isSubmitting },
+ } = useForm
+ );
+};
+
+export default UpdatePassword;
+
+function parseErrorMessage(error: Error | null): string {
+ if (!error) {
+ return "";
+ }
+
+ if (error.name === "ZodError") {
+ return JSON.parse(error.message)[0].message;
+ }
+
+ return error.message;
+}
diff --git a/app/settings/components/divider.tsx b/app/settings/components/divider.tsx
deleted file mode 100644
index 8c78520..0000000
--- a/app/settings/components/divider.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-export default function Divider() {
- return (
-
- );
-}
diff --git a/app/settings/components/profile-informations.tsx b/app/settings/components/profile-informations.tsx
deleted file mode 100644
index d4fbcaf..0000000
--- a/app/settings/components/profile-informations.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import type { FunctionComponent } from "react";
-import { useEffect, useState } from "react";
-import { useMutation } from "blitz";
-import { useForm } from "react-hook-form";
-
-import updateUser from "../mutations/update-user";
-import Alert from "../../core/components/alert";
-import Button from "./button";
-import SettingsSection from "./settings-section";
-import useCurrentUser from "../../core/hooks/use-current-user";
-
-import appLogger from "../../../integrations/logger";
-
-type Form = {
- fullName: string;
- email: string;
-};
-
-const logger = appLogger.child({ module: "profile-settings" });
-
-const ProfileInformations: FunctionComponent = () => {
- const { user } = useCurrentUser();
- const updateUserMutation = useMutation(updateUser)[0];
- const {
- register,
- handleSubmit,
- setValue,
- formState: { isSubmitting, isSubmitSuccessful },
- } = useForm