diff --git a/app/ts/components/App.tsx b/app/ts/components/App.tsx index e056f5f..97a591c 100644 --- a/app/ts/components/App.tsx +++ b/app/ts/components/App.tsx @@ -39,13 +39,14 @@ const LoadingSpinner = ({ loading }: LoadingSpinnerProps) => { } -interface ErrorComponentProps { - show: boolean - message: string | OptionalSignal -} -const ErrorComponent = ({ show, message }: ErrorComponentProps) => { - if (show === false) return <> - return

{ message }

+type ErrorComponentProps = { displayError: boolean, message: string } | { message: OptionalSignal } +const ErrorComponent = (props: ErrorComponentProps) => { + if (!('displayError' in props)) { + if (props.message.value === undefined) return <> + return

{ props.message.value }

+ } + if (props.displayError === false) return <> + return

{ props.message }

} interface EnsRegistryErrorProps { @@ -83,7 +84,6 @@ export function App() { return } const ensured = ensureError(error) - console.error(error) errorString.deepValue = ensured.message } @@ -146,7 +146,7 @@ export function App() { const ensSubDomain = inputValue.value.toLowerCase() if (!isValidEnsSubDomain(ensSubDomain)) { clear() - return setError(`${ ensSubDomain } is not a valid ENS subdomain. The format should be similar to "2.horswap.eth" or "1.lunaria.darkflorist.eth."`) + return setError(`${ ensSubDomain } is not a valid ENS subdomain. The format should be similar to "2.horswap.eth" or "1.lunaria.darkflorist.eth".`) } setError(undefined) updateInfos(true) @@ -219,8 +219,8 @@ export function App() { /> - - + + diff --git a/app/ts/components/requirements.tsx b/app/ts/components/requirements.tsx index 3b75ab0..5092459 100644 --- a/app/ts/components/requirements.tsx +++ b/app/ts/components/requirements.tsx @@ -144,21 +144,14 @@ export const DeployContract = ({ areContractsDeployed, deploy }: DeployProps) => return <> } -interface DisplayErrorStringIfNotUndefinedProps { - maybeString: Signal -} -const DisplayErrorStringIfNotUndefined = ({ maybeString }: DisplayErrorStringIfNotUndefinedProps) => { - if (maybeString.value === undefined) return <> - return

{ maybeString.value }

-} - -interface DisplayErrorStringIfVariableTrueProps { - displayError: boolean - message: string -} -const DisplayErrorStringIfVariableTrue = ({ message, displayError }: DisplayErrorStringIfVariableTrueProps) => { - if (displayError === false) return <> - return

{ message }

+type DisplayErrorProps = { displayError: boolean, message: string } | { message: OptionalSignal | ReadonlySignal } +const DisplayError = (props: DisplayErrorProps) => { + if (!('displayError' in props)) { + if (props.message.value === undefined) return <> + return

{ props.message.value }

+ } + if (props.displayError === false) return <> + return

{ props.message }

} interface ContentHashErrorProps { @@ -169,11 +162,10 @@ const ContentHashError = ({ contentHashInput, validContenthash }: ContentHashErr if (validContenthash.value === true) return <> if (contentHashInput.value.length === 0) return <> const separator = contentHashInput.value.includes('://') - if (separator === false) return - return + if (separator === false) return + return } - interface ImmutableDomainProps { checkBoxes: OptionalSignal extendYear: Signal @@ -333,12 +325,12 @@ const NonImmutableDomain = ({ checkBoxes, maybeAccountAddress, updateInfos, crea
- + - - - - + + + +
diff --git a/app/ts/utils/ensUtils.ts b/app/ts/utils/ensUtils.ts index 04bbd55..17c50f1 100644 --- a/app/ts/utils/ensUtils.ts +++ b/app/ts/utils/ensUtils.ts @@ -175,8 +175,6 @@ export const getRequiredFusesWithoutApproval = (domainIndex: number, domainInfos } export const getRequiredFusesWithApproval = (domainIndex: number, domainInfos: readonly DomainInfo[]) => { - console.log('getRequiredFusesWithApproval') - console.log(domainInfos) if (domainInfos.length === 1) return SINGLE_DOMAIN_FUSES if (domainIndex === 0 && domainInfos.length > 1) return TOP_PARENT_FUSES if (domainIndex === domainInfos.length - 1) return FINAL_CHILD_FUSES