Skip to content

Commit

Permalink
Improve verbiage on save changes popup bar
Browse files Browse the repository at this point in the history
  • Loading branch information
synzen committed Feb 15, 2025
1 parent cd2b073 commit 3ff1610
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useFormContext } from "react-hook-form";
import { Button, Flex, HStack, Text } from "@chakra-ui/react";
import { motion } from "framer-motion";
import { useTranslation } from "react-i18next";
import { isEqual } from "lodash";
import { AnimatedComponent } from "../AnimatedComponent";

Expand All @@ -15,7 +14,6 @@ interface Props {
}

export const SavedUnsavedChangesPopupBar = ({ useDirtyFormCheck }: Props) => {
const { t } = useTranslation();
const {
formState: { isSubmitting, isValid, defaultValues, isDirty: formContextIsDirty },
reset,
Expand Down Expand Up @@ -45,22 +43,22 @@ export const SavedUnsavedChangesPopupBar = ({ useDirtyFormCheck }: Props) => {
exit={{ opacity: 0, bottom: "-100px" }}
>
<HStack justifyContent="space-between" width="100%">
<Text>You have unsaved changes!</Text>
<Text>You have unsaved changes on this page!</Text>
<HStack>
<Button
onClick={() => reset(defaultValues)}
variant="ghost"
isDisabled={!isDirty || isSubmitting}
>
<span>{t("features.feed.components.sidebar.resetButton")}</span>
<span>Discard all changes</span>
</Button>
<Button
type="submit"
colorScheme="blue"
isDisabled={isSubmitting || !isDirty || !isValid}
isLoading={isSubmitting}
>
<span>{t("features.feed.components.sidebar.saveButton")}</span>
<span>Save all changes</span>
</Button>
</HStack>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,22 +433,22 @@ export const DiscordMessageForm = ({ onClickSave, articleIdToPreview, guildId }:
exit={{ opacity: 0, bottom: "-100px" }}
>
<HStack justifyContent="space-between" width="100%">
<Text>You have unsaved changes!</Text>
<Text>You have unsaved changes on this page!</Text>
<HStack>
<Button
onClick={() => reset()}
variant="ghost"
isDisabled={!isDirty || isSubmitting}
>
<span>{t("features.feed.components.sidebar.resetButton")}</span>
<span>Discard all changes</span>
</Button>
<Button
type="submit"
colorScheme="blue"
isDisabled={isSubmitting || !isDirty || errorsExist}
isLoading={isSubmitting}
>
<span>{t("features.feed.components.sidebar.saveButton")}</span>
<span>Save all changes</span>
</Button>
</HStack>
</HStack>
Expand Down

0 comments on commit 3ff1610

Please sign in to comment.