paste npub|nprofile|nevent|note id into search box
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
236b9b780e
commit
21cd043809
@ -121,8 +121,14 @@ export default function SearchBox() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
if (!e.target.value.match(/nsec1[a-zA-Z0-9]{20,65}/gi)) {
|
const val = e.target.value;
|
||||||
setSearch(e.target.value);
|
if (val.match(/nsec1[a-zA-Z0-9]{20,65}/gi)) {
|
||||||
|
e.preventDefault();
|
||||||
|
} else if (val.trim().match(/^(npub|note|nevent|nprofile)1[a-zA-Z0-9]{20,200}$/gi)) {
|
||||||
|
navigate(`/${val.trim()}`);
|
||||||
|
e.preventDefault();
|
||||||
|
} else {
|
||||||
|
setSearch(val);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user