|
|
@ -29,6 +29,11 @@ export interface ISearchItem { |
|
|
|
item: any; |
|
|
|
item: any; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const oneCountryPostfix = { |
|
|
|
|
|
|
|
dotOne: '.1', |
|
|
|
|
|
|
|
dotCountry: '.country' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const SearchInput = () => { |
|
|
|
export const SearchInput = () => { |
|
|
|
const [value, setValue] = useState(""); |
|
|
|
const [value, setValue] = useState(""); |
|
|
|
const [readySubmit, setReadySubmit] = useState(false); |
|
|
|
const [readySubmit, setReadySubmit] = useState(false); |
|
|
@ -96,25 +101,29 @@ export const SearchInput = () => { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(config.oneCountryContractAddress && v.endsWith('.1')) { |
|
|
|
if(config.oneCountryContractAddress) { |
|
|
|
const [prefix] = v.split('.1') |
|
|
|
const onePostfix = v.endsWith(oneCountryPostfix.dotOne) |
|
|
|
if(prefix) { |
|
|
|
const countryPostfix = v.endsWith(oneCountryPostfix.dotCountry) |
|
|
|
try { |
|
|
|
if(onePostfix || countryPostfix) { |
|
|
|
const address = await getAddressByName(prefix) |
|
|
|
const [prefix] = v.split(onePostfix ? oneCountryPostfix.dotOne : oneCountryPostfix.dotCountry); |
|
|
|
if(address) { |
|
|
|
if(prefix) { |
|
|
|
history.push(`/address/${address}`); |
|
|
|
try { |
|
|
|
} else { |
|
|
|
const address = await getAddressByName(prefix); |
|
|
|
toaster.show({ |
|
|
|
if(address) { |
|
|
|
message: () => ( |
|
|
|
history.push(`/address/${address}`); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
toaster.show({ |
|
|
|
|
|
|
|
message: () => ( |
|
|
|
<Box direction={"row"} align={"center"} pad={"small"}> |
|
|
|
<Box direction={"row"} align={"center"} pad={"small"}> |
|
|
|
<Text size={"small"}>Address for "{v}" not found</Text> |
|
|
|
<Text size={"small"}>Address for "{v}" not found</Text> |
|
|
|
</Box> |
|
|
|
</Box> |
|
|
|
), |
|
|
|
), |
|
|
|
time: 5000 |
|
|
|
time: 5000 |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log('Cannot get one country address', e) |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log('Cannot get one country address', e) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|