+ )
+}
diff --git a/src/features/Profiles/pages/EditProfilePage/UpdateMyProfileCard/UpdateMyProfileCard.tsx b/src/features/Profiles/pages/EditProfilePage/UpdateMyProfileCard/UpdateMyProfileCard.tsx
index 1053c4e..027dfef 100644
--- a/src/features/Profiles/pages/EditProfilePage/UpdateMyProfileCard/UpdateMyProfileCard.tsx
+++ b/src/features/Profiles/pages/EditProfilePage/UpdateMyProfileCard/UpdateMyProfileCard.tsx
@@ -5,8 +5,8 @@ import { NotificationsService } from "src/services/notifications.service";
import * as yup from "yup";
import { yupResolver } from "@hookform/resolvers/yup";
import Avatar from "src/features/Profiles/Components/Avatar/Avatar";
-
-
+import { usePrompt } from "src/utils/hooks";
+import SaveChangesCard from "../SaveChangesCard/SaveChangesCard";
interface Props {
data: Pick = yup.object({
export default function UpdateMyProfileCard({ data, onClose }: Props) {
- const { register, formState: { errors }, handleSubmit } = useForm({
+ const { register, formState: { errors, isDirty, }, handleSubmit, reset } = useForm({
defaultValues: data,
resolver: yupResolver(schema),
mode: 'onBlur',
@@ -77,6 +77,8 @@ export default function UpdateMyProfileCard({ data, onClose }: Props) {
+ usePrompt('You may have some unsaved changes. You still want to leave?', isDirty)
+
const onSubmit: SubmitHandler = data => {
mutate({
@@ -94,6 +96,9 @@ export default function UpdateMyProfileCard({ data, onClose }: Props) {
twitter: data.twitter,
website: data.website,
}
+ },
+ onCompleted: () => {
+ reset(data);
}
}).catch(() => {
NotificationsService.error('A network error happened');
@@ -102,186 +107,179 @@ export default function UpdateMyProfileCard({ data, onClose }: Props) {
};
return (
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+ reset()}
+ />
)
diff --git a/src/features/Profiles/pages/ProfilePage/CommentsSettingsCard/CommentsSettingsCard.tsx b/src/features/Profiles/pages/ProfilePage/CommentsSettingsCard/CommentsSettingsCard.tsx
index 4d9b9ac..f48d164 100644
--- a/src/features/Profiles/pages/ProfilePage/CommentsSettingsCard/CommentsSettingsCard.tsx
+++ b/src/features/Profiles/pages/ProfilePage/CommentsSettingsCard/CommentsSettingsCard.tsx
@@ -21,48 +21,49 @@ export default function CommentsSettingsCard({ nostr_prv_key, nostr_pub_key, isO
return (
-
-
💬 Nostr comments Experimental
-
- Our commenting system is experimental and uses Nostr to store and relay your messages and replies to our own relay, as well as relays ran by other people in the community.
- We generate Nostr keys for you since there are no popular wallets which support it.
-
+
+
+
💬 Nostr comments Experimental
+
+ Our commenting system is experimental and uses Nostr to store and relay your messages and replies to our own relay, as well as relays ran by other people in the community.
+ We generate Nostr keys for you since there are no popular wallets which support it.
+
-
-
Nostr keys
- {nostr_prv_key &&
-
- Your Nostr Private Key
-
-
-
+
+
Nostr keys
+ {nostr_prv_key &&
+
+ Your Nostr Private Key
+
+
+
-
-
-
}
-
-
- Your Nostr Public Key
-
-
-
-
+
+
+
}
+
+
+ Your Nostr Public Key
+
+
+
+
+
+
-
-
- {/*
+ {/*
Connect your Nostr identity
@@ -70,31 +71,32 @@ export default function CommentsSettingsCard({ nostr_prv_key, nostr_pub_key, isO
🚧 Coming Soon 🚧