fix search accounts bug

This commit is contained in:
saml33 2023-01-17 14:08:12 +11:00
parent a728a7dff9
commit 6981b72137
6 changed files with 12 additions and 9 deletions

View File

@ -29,8 +29,14 @@ const SearchPage = () => {
const [searchResults, setSearchResults] = useState([]) const [searchResults, setSearchResults] = useState([])
const [searchType, setSearchType] = useState('mango-account') const [searchType, setSearchType] = useState('mango-account')
const [showNoResults, setShowNoResults] = useState(false) const [showNoResults, setShowNoResults] = useState(false)
const [isAccountSearch, setIsAccountSearch] = useState(true)
const handleSearch = async () => { const handleSearch = async () => {
if (searchType === 'mango-account' || searchType === 'mango-account-name') {
setIsAccountSearch(true)
} else {
setIsAccountSearch(false)
}
try { try {
setLoading(true) setLoading(true)
const response = await fetch( const response = await fetch(
@ -51,9 +57,6 @@ const SearchPage = () => {
} }
} }
const isAccountSearch =
searchType === 'mango-account' || searchType === 'mango-account-name'
return ( return (
<div className="grid grid-cols-12 p-8 pb-20 md:pb-16 lg:p-10"> <div className="grid grid-cols-12 p-8 pb-20 md:pb-16 lg:p-10">
<div className="col-span-12 lg:col-span-8 lg:col-start-3"> <div className="col-span-12 lg:col-span-8 lg:col-start-3">
@ -140,7 +143,7 @@ const MangoAccountItem = ({
type, type,
}: { }: {
item: MangoAccountItem item: MangoAccountItem
type: 'mango-account' | 'mango-account-name' type: string
}) => { }) => {
const { mango_account_name, mango_account_pk, profile_name } = item const { mango_account_name, mango_account_pk, profile_name } = item
return ( return (

View File

@ -2,7 +2,7 @@
"mango-account": "Account Address", "mango-account": "Account Address",
"mango-account-name": "Account Name", "mango-account-name": "Account Name",
"no-results": "No Results", "no-results": "No Results",
"no-results-desc": "Try another search. Searches are case-sensitive execpt for profile names which are lowercase", "no-results-desc": "Try another search. Searches are case-sensitive",
"profile-name": "Profile Name", "profile-name": "Profile Name",
"results": "Results", "results": "Results",
"search": "Search", "search": "Search",

View File

@ -2,7 +2,7 @@
"mango-account": "Account Address", "mango-account": "Account Address",
"mango-account-name": "Account Name", "mango-account-name": "Account Name",
"no-results": "No Results", "no-results": "No Results",
"no-results-desc": "Try another search. Searches are case-sensitive execpt for profile names which are lowercase", "no-results-desc": "Try another search. Searches are case-sensitive",
"profile-name": "Profile Name", "profile-name": "Profile Name",
"results": "Results", "results": "Results",
"search": "Search", "search": "Search",

View File

@ -2,7 +2,7 @@
"mango-account": "Account Address", "mango-account": "Account Address",
"mango-account-name": "Account Name", "mango-account-name": "Account Name",
"no-results": "No Results", "no-results": "No Results",
"no-results-desc": "Try another search. Searches are case-sensitive execpt for profile names which are lowercase", "no-results-desc": "Try another search. Searches are case-sensitive",
"profile-name": "Profile Name", "profile-name": "Profile Name",
"results": "Results", "results": "Results",
"search": "Search", "search": "Search",

View File

@ -2,7 +2,7 @@
"mango-account": "Account Address", "mango-account": "Account Address",
"mango-account-name": "Account Name", "mango-account-name": "Account Name",
"no-results": "No Results", "no-results": "No Results",
"no-results-desc": "Try another search. Searches are case-sensitive execpt for profile names which are lowercase", "no-results-desc": "Try another search. Searches are case-sensitive",
"profile-name": "Profile Name", "profile-name": "Profile Name",
"results": "Results", "results": "Results",
"search": "Search", "search": "Search",

View File

@ -2,7 +2,7 @@
"mango-account": "Account Address", "mango-account": "Account Address",
"mango-account-name": "Account Name", "mango-account-name": "Account Name",
"no-results": "No Results", "no-results": "No Results",
"no-results-desc": "Try another search. Searches are case-sensitive execpt for profile names which are lowercase", "no-results-desc": "Try another search. Searches are case-sensitive",
"profile-name": "Profile Name", "profile-name": "Profile Name",
"results": "Results", "results": "Results",
"search": "Search", "search": "Search",