diff --git a/src/components/layout/TextField.tsx b/src/components/layout/TextField.tsx index afc80859..730621f6 100644 --- a/src/components/layout/TextField.tsx +++ b/src/components/layout/TextField.tsx @@ -14,6 +14,7 @@ export type TextFieldProps = { required?: boolean; multiline?: boolean; disabled?: boolean; + autoCapitalize?: string; ref: (element: HTMLInputElement | HTMLTextAreaElement) => void; onInput: JSX.EventHandler< HTMLInputElement | HTMLTextAreaElement, @@ -32,7 +33,8 @@ export function TextField(props: TextFieldProps) { "ref", "onInput", "onChange", - "onBlur" + "onBlur", + "autoCapitalize" ]); return ( } > - + { + // @ts-expect-error autocapitalize isn't in the props for some reason + + } {props.error} diff --git a/src/routes/Feedback.tsx b/src/routes/Feedback.tsx index 4b567c59..ab4f3506 100644 --- a/src/routes/Feedback.tsx +++ b/src/routes/Feedback.tsx @@ -8,6 +8,7 @@ import { BackPop, Button, ButtonLink, + DefaultMain, LargeHeader, NiceP, TextField, @@ -172,7 +173,7 @@ export function Feedback() { const setupError = state?.setupError || undefined; return ( - + @@ -209,6 +210,6 @@ export function Feedback() { - + ); } diff --git a/src/routes/settings/LightningAddress.tsx b/src/routes/settings/LightningAddress.tsx index 36a2152d..1ba0794e 100644 --- a/src/routes/settings/LightningAddress.tsx +++ b/src/routes/settings/LightningAddress.tsx @@ -1,6 +1,7 @@ import { Capacitor } from "@capacitor/core"; import { createForm, + custom, required, reset, SubmitHandler @@ -40,6 +41,12 @@ type HermesForm = { name: string; }; +const validateLowerCase = (value?: string) => { + if (!value) return false; + const valid = /^[a-z0-9-_.]+$/; + return valid.test(value); +}; + // todo(paul) put this somewhere else function HermesForm(props: { onSubmit: (name: string) => void }) { const [state, _] = useMegaStore(); @@ -62,7 +69,7 @@ function HermesForm(props: { onSubmit: (name: string) => void }) { setSuccess(""); setError(undefined); try { - const name = f.name.trim(); + const name = f.name.trim().toLowerCase(); const available = await state.mutiny_wallet?.check_available_lnurl_name(name); if (!available) { @@ -91,19 +98,26 @@ function HermesForm(props: { onSubmit: (name: string) => void }) { return (
- + {(field, props) => (
-
+
@{hermesDomain}