Skip to content

Commit

Permalink
Merge pull request #52 from AzimovS/fix/leaderboardCollectors
Browse files Browse the repository at this point in the history
Fix/leaderboard collectors
  • Loading branch information
azf20 authored May 16, 2024
2 parents dbdafde + cb93b09 commit 4f1b9fd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
16 changes: 11 additions & 5 deletions packages/react-app/src/LeaderboardCollectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,18 @@ export default function Leaderboard(props) {
<Row justify="center">
<div className="artists-leaderboard">
<ul>
{artists.length > 0
? artists.map((artist, i) => {
{artists.length > 0
? artists
.filter(
(artist) =>
artist.address !==
"0x000000000000000000000000000000000000dead" &&
artist.address !==
"0xdead000000000000000042069420694206942069"
)
.map((artist, i) => {
if (
artist[orderBy] > 0 &&
artist.address !==
"0x000000000000000000000000000000000000dead"
artist[orderBy] > 0
) {
return (
<li
Expand Down
41 changes: 34 additions & 7 deletions packages/react-app/src/components/AddressInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,41 @@ import { Input, Badge } from 'antd';

export default function AddressInput(props) {

const [ ens, setEns ] = useState(0)
const [ value, setValue ] = useState()
const [isAddressFound, setIsAddressFound] = useState(false);

const currentValue = typeof props.value != "undefined"?props.value:value

useEffect(()=>{
setEns("")
if(currentValue && props.ensProvider){
async function getEns(){
let newEns
try{
console.log("trying reverse ens",newEns)

newEns = await props.ensProvider.lookupAddress(currentValue)
console.log("setting ens",newEns)
setEns(newEns)
}catch(e){}
console.log("checking resolve")
if( currentValue.indexOf(".eth")>0 || currentValue.indexOf(".xyz")>0 ){
try{
console.log("resolving")
let possibleAddress = await props.ensProvider.resolveName(currentValue);
console.log("GOT:L",possibleAddress)
if(possibleAddress){
setEns(currentValue)
props.onChange(possibleAddress)
}
}catch(e){}
}
}
getEns()
}
},[props.value])


const [ scan, setScan ] = useState(false)

let scannerButton = (
Expand All @@ -32,11 +62,8 @@ export default function AddressInput(props) {
let possibleAddress = await props.ensProvider.resolveName(address);
if(possibleAddress){
address = possibleAddress
setIsAddressFound(true);
}
}catch(e){}
} else {
setIsAddressFound(true);
}
setValue(address)
if(typeof props.onChange == "function") { props.onChange(address) }
Expand Down Expand Up @@ -78,15 +105,15 @@ export default function AddressInput(props) {
<div>
{scanner}
<Input
autoFocus={!isAddressFound}
autoFocus={props.autoFocus}
placeholder={props.placeholder?props.placeholder:"address"}
prefix={<Blockie address={currentValue} size={8} scale={3}/>}
value={currentValue}
value={ens?ens:currentValue}
addonAfter={scannerButton}
onChange={(e)=>{
updateAddress(e.target.value)
}}
/>
</div>
);
}
}

0 comments on commit 4f1b9fd

Please sign in to comment.