diff --git a/extension/e2e-tests/onboarding.test.ts b/extension/e2e-tests/onboarding.test.ts index 10fb4e125f..7712f6a5dd 100644 --- a/extension/e2e-tests/onboarding.test.ts +++ b/extension/e2e-tests/onboarding.test.ts @@ -369,7 +369,8 @@ test("Incorrect mnemonic phrase", async ({ page }) => { const shuffledWords = shuffle(words); for (let i = 0; i < shuffledWords.length; i++) { - await page.getByLabel(shuffledWords[i]).check({ force: true }); + // Use nth() to handle duplicate labels by selecting the first matching element + await page.getByLabel(shuffledWords[i]).first().check({ force: true }); } await page.getByTestId("display-mnemonic-phrase-confirm-btn").click(); diff --git a/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx b/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx index 66eedbe791..3b7705a200 100644 --- a/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx +++ b/extension/src/popup/components/InternalTransaction/EditMemo/index.tsx @@ -4,6 +4,7 @@ import { Field, FieldProps, Form, Formik } from "formik"; import { useTranslation } from "react-i18next"; import { View } from "popup/basics/layout/View"; +import { useValidateMemo } from "popup/helpers/useValidateMemo"; import "./styles.scss"; @@ -19,61 +20,82 @@ interface EditMemoProps { export const EditMemo = ({ memo, onClose, onSubmit }: EditMemoProps) => { const { t } = useTranslation(); + const [localMemo, setLocalMemo] = React.useState(memo); + const { error: memoError } = useValidateMemo(localMemo); + const initialValues: FormValue = { memo, }; - const handleSubmit = async (values: FormValue) => { + + const handleSubmit = (values: FormValue) => { + // Prevent submission if there's a validation error + if (memoError) { + return; + } onSubmit(values); }; + const handleFieldChange = (value: string) => { + setLocalMemo(value); + }; + + const renderField = ({ field }: FieldProps) => ( + { + field.onChange(e); + handleFieldChange(e.target.value); + }} + error={memoError} + /> + ); + + const renderForm = () => ( +
+ ); + return (Memo
-{t("Memo")}
+Operations
+export const Summary = (props: SummaryProps) => { + const { t } = useTranslation(); + return ( +{t("Operations")}
+{props.operationNames.length}
{props.operationNames.length}
-Fees
+{t("Fees")}
++ {stroopToXlm(props.fee).toString()} XLM +
- {stroopToXlm(props.fee).toString()} XLM -
-Sequence #
+{t("Sequence #")}
+{props.sequenceNumber}
{props.sequenceNumber}
-Memo
+{t("Memo")}
{`${props.memo.value} (${ - mapMemoLabel[props.memo.type] - })`}
++ {props.memo && props.memo.value + ? `${props.memo.value} (${getMemoLabel(props.memo.type)})` + : `${t("None")} (${getMemoLabel("none")})`} +
XDR
+{t("XDR")}
+