@@ -418,7 +418,7 @@ async function fetchSubjkts(subjkt) {
418
418
//console.log(subjkt)
419
419
const { errors, data } = await fetchGraphQL ( `
420
420
query subjktsQuery {
421
- hic_et_nunc_holder(where: { name: {_like : "%${ subjkt } %"}}, order_by: {hdao_balance: desc}) {
421
+ hic_et_nunc_holder(where: { name: {_ilike : "%${ subjkt } %"}}, order_by: {hdao_balance: desc}) {
422
422
address
423
423
name
424
424
hdao_balance
@@ -540,7 +540,8 @@ export class Search extends Component {
540
540
{ id : 7 , value : 'recent sales' } ,
541
541
{ id : 8 , value : '1D' } ,
542
542
{ id : 9 , value : '1W' } ,
543
- { id : 10 , value : '1M' }
543
+ { id : 10 , value : '1M' } ,
544
+ { id : 11 , value : 'ATH' }
544
545
] ,
545
546
select : [ ] ,
546
547
mouse : false ,
@@ -561,7 +562,7 @@ export class Search extends Component {
561
562
handleChange = ( e ) => {
562
563
this . setState ( { [ e . target . name ] : e . target . value } )
563
564
564
- if ( this . state . search . length >= 1 ) this . search ( )
565
+ // if (this.state.search.length >= 1) this.search()
565
566
}
566
567
567
568
update = async ( e , reset ) => {
@@ -579,6 +580,7 @@ export class Search extends Component {
579
580
let list = await fetchDay ( new Date ( ( new Date ( ) ) . getTime ( ) - 60 * 60 * 24 * 1000 ) . toISOString ( ) , this . state . offset )
580
581
list = list . map ( e => e . token )
581
582
list = [ ...this . state . feed , ...( list ) ]
583
+ list = list . filter ( e => ! arr . includes ( e . creator . address ) )
582
584
list = _ . uniqBy ( list , 'id' )
583
585
584
586
this . setState ( {
@@ -590,6 +592,8 @@ export class Search extends Component {
590
592
let list = await fetchDay ( new Date ( ( new Date ( ) ) . getTime ( ) - 60 * 60 * 24 * 7 * 1000 ) . toISOString ( ) , this . state . offset )
591
593
list = list . map ( e => e . token )
592
594
list = [ ...this . state . feed , ...( list ) ]
595
+ list = list . filter ( e => ! arr . includes ( e . creator . address ) )
596
+
593
597
list = _ . uniqBy ( list , 'id' )
594
598
595
599
this . setState ( {
@@ -602,13 +606,26 @@ export class Search extends Component {
602
606
let list = await fetchDay ( new Date ( ( new Date ( ) ) . getTime ( ) - 60 * 60 * 24 * 30 * 1000 ) . toISOString ( ) , this . state . offset )
603
607
list = list . map ( e => e . token )
604
608
list = [ ...this . state . feed , ...( list ) ]
609
+ list = list . filter ( e => ! arr . includes ( e . creator . address ) )
610
+
605
611
list = _ . uniqBy ( list , 'id' )
606
612
607
613
this . setState ( {
608
614
feed : list
609
615
} )
610
616
}
611
617
618
+ if ( e === 'ATH' ) {
619
+ let list = await fetchDay ( new Date ( '2021-05-01' ) . toISOString ( ) , this . state . offset )
620
+ list = list . map ( e => e . token )
621
+ list = [ ...this . state . feed , ...( list ) ]
622
+ list = _ . uniqBy ( list , 'id' )
623
+ console . log ( 'ath' , list )
624
+ this . setState ( {
625
+ feed : list
626
+ } )
627
+ }
628
+
612
629
if ( e === 'num' ) {
613
630
let res = await fetchFeed ( Number ( this . state . search ) + 1 - this . state . offset )
614
631
res = res . filter ( e => ! arr . includes ( e . creator_id ) )
@@ -693,24 +710,25 @@ export class Search extends Component {
693
710
let restricted = await getRestrictedAddresses ( )
694
711
result = _ . uniqBy ( [ ...this . state . feed , ...result ] , 'creator_id' )
695
712
result = result . filter ( e => ! restricted . includes ( e . creator_id ) )
696
- this . setState ( { feed : [ ...result ] , flag : true } )
713
+ this . setState ( { feed : [ ...result ] , flag : true } )
697
714
}
698
715
699
716
700
717
search = async ( e ) => {
701
718
719
+ console . log ( e )
720
+
702
721
this . setState ( { items : [ ] , feed : [ ] , search : e } )
703
722
this . setState ( { subjkt : await fetchSubjkts ( this . state . search ) } )
704
723
705
- if ( ( this . state . subjkt [ 0 ] ?. hdao_balance > 30000000 ) || ( isFloat ( Number ( this . state . search ) ) ) ) {
706
- console . log ( isFloat ( Number ( this . state . search ) ) )
707
- this . setState ( { feed : await fetchCreations ( this . state . subjkt [ 0 ] . address , this . state . offset ) , select : 'creations' } )
708
- } else if ( ! isNaN ( this . state . search ) ) {
724
+ if ( ! isNaN ( this . state . search ) ) {
709
725
this . setState ( { feed : await fetchFeed ( Number ( this . state . search ) + 1 ) , select : 'num' } )
710
726
} else {
711
727
this . setState ( { feed : _ . uniqBy ( await fetchTag ( this . state . search . toLowerCase ( ) , 9999999 ) , 'creator_id' ) , select : 'tag' } )
712
728
}
713
729
730
+
731
+ console . log ( this . state . feed )
714
732
}
715
733
716
734
hoverState = ( bool ) => this . setState ( { mouse : bool } )
@@ -722,21 +740,25 @@ export class Search extends Component {
722
740
this . update ( this . state . select , false )
723
741
}
724
742
743
+ handleKey = ( e ) => {
744
+ console . log ( this . state . search )
745
+ if ( e . key == 'Enter' ) this . search ( this . state . search )
746
+ }
747
+
725
748
render ( ) {
726
749
727
750
return (
728
751
< Page >
729
752
< Container >
730
753
< Padding >
731
- < Input
732
- type = "text"
733
- name = "search"
734
- onMouseEnter = { ( ) => this . hoverState ( true ) }
735
- onMouseLeave = { ( ) => this . hoverState ( false ) }
736
- onChange = { e => this . search ( e . target . value ) }
737
- label = "objkt id, artists, tags"
738
- placeholder = "objkt id, artists, tags"
739
- />
754
+ < Input
755
+ type = "text"
756
+ name = "search"
757
+ onChange = { this . handleChange }
758
+ label = "search ↵"
759
+ placeholder = "search ↵"
760
+ onKeyPress = { this . handleKey }
761
+ />
740
762
{
741
763
< div style = { { marginTop : '15px' } } >
742
764
{ this . state . tags . map ( e => < a className = 'tag' href = '#' onClick = { ( ) => {
0 commit comments