Skip to content

Commit bd18afc

Browse files
committed
latest
1 parent 5244bec commit bd18afc

File tree

8 files changed

+99
-74
lines changed

8 files changed

+99
-74
lines changed

.env

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ REACT_APP_SUBJKT='https://mpiec7jzkc.execute-api.us-east-1.amazonaws.com/dev/sub
1111
REACT_APP_UNIQUE_TAGS='https://mpiec7jzkc.execute-api.us-east-1.amazonaws.com/dev/unique_tags'
1212
REACT_APP_GRAPHQL_OBJKT='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/objkt'
1313
REACT_APP_GRAPHQL_FEED='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/feed'
14-
REACT_APP_GRAPHQL_TAGS='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/tags'
14+
REACT_APP_GRAPHQL_TAGS='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/tag'
1515
REACT_APP_GRAPHQL_COLLECTION='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/collection'
1616
REACT_APP_GRAPHQL_CREATIONS='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/creations'
17+
REACT_APP_GRAPHQL_HDAO='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/hdao'
18+
REACT_APP_GRAPHQL_RANDOM='https://e7e8qmwglf.execute-api.us-east-1.amazonaws.com/dev/random'
19+
REACT_APP_GRAPHQL_FOLLOWS=''
1720
# localhost running API
1821
#REACT_APP_FEED='http://0.0.0.0:3001/dev/feed'
1922
#REACT_APP_FEED_HDAO='http://0.0.0.0:3001/dev/hdao'

src/components/feed-item/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import styles from './styles.module.scss'
99

1010
export const FeedItem = (props) => {
1111
const { display_uri, id, mime, creator_id, type, artifact_uri, token_holders } = props
12-
console.log(props)
12+
/* console.log(props)
1313
console.log(type)
14-
console.log(mime)
14+
console.log(mime) */
1515
// const url =
1616
// token_info.displayUri !== ''
1717
// ? token_info.displayUri
@@ -27,7 +27,7 @@ export const FeedItem = (props) => {
2727
<div className={styles.container}>
2828
{renderMediaType({
2929
mimeType: mime,
30-
uri: mime == 'video/mp4' ? artifact_uri.split('//')[1] : display_uri.split('//')[1],
30+
uri: mime == 'video/mp4' ? artifact_uri.split('//')[1] : (display_uri !== '' ? display_uri.split('//')[1] : artifact_uri.split('//')[1]),
3131
metadata: props,
3232
})}
3333
</div>

src/components/header/index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const Header = () => {
6767
<Button onClick={() => handleRoute('/')}>
6868
<div className={styles.logo}>
6969
{/* HIC LOGO */}
70-
{false && (
70+
{true && (
7171
<svg viewBox="0 0 196.87 53.23" fill={'var(--text-color)'}>
7272
<path
7373
d="M228.9,79.31H211.51a2.26,2.26,0,0,1-.35-.34.75.75,0,0,1-.16-.42c0-11.42,0-22.85,0-34.43H193.24v35H175.41V26.27H228.9Z"
@@ -88,7 +88,7 @@ export const Header = () => {
8888
</svg>
8989
)}
9090
{/* PRIDE LOGO */}
91-
{true && (
91+
{false && (
9292
<svg
9393
width="74"
9494
height="20"
@@ -186,11 +186,15 @@ export const Header = () => {
186186
<Primary>manage assets</Primary>
187187
</Button>
188188
</li>
189-
{/* <li>
190-
<Button onClick={() => handleRoute('/config')}>
191-
<Primary>config</Primary>
192-
</Button>
193-
</li> */}
189+
{context.acc?.address ?
190+
<li>
191+
<Button onClick={() => handleRoute('/config')}>
192+
<Primary>settings</Primary>
193+
</Button>
194+
</li>
195+
:
196+
null
197+
}
194198
<li>
195199
<Button onClick={() => handleRoute('/about')}>
196200
<Primary>about</Primary>

src/components/item-info/index.js

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,14 @@ export const ItemInfo = ({
2626
useContext(HicetnuncContext)
2727
const reducer = (accumulator, currentValue) =>
2828
parseInt(accumulator) + parseInt(currentValue)
29-
console.log(id)
3029

3130
if (isDetailView) {
3231
// subtract burned pieces from total
3332
let total = 0
3433

35-
console.log('detail view', token_holders, supply)
3634
total = supply
3735
let ed = token_holders.filter(e => e.holder_id === 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9').length > 0 ? token_holders.filter(e => e.holder_id === 'KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9')[0].quantity : 'X'
38-
console.log('ed', ed)
3936

40-
console.log('swaps', swaps)
4137
let s = _.minBy(swaps, (o) => Number(o.price))
4238
let maxPrice = _.maxBy(swaps, (o) => Number(o.price))
4339

@@ -129,8 +125,22 @@ export const ItemInfo = ({
129125
<Purchase>{message}</Purchase>
130126
</Button>
131127
</div>
128+
132129
)}
133130
</div>
131+
<div>
132+
<Button onClick={() => curate(id)}>
133+
<Primary>
134+
<span
135+
className={styles.top}
136+
data-position={'top'}
137+
data-tooltip={'curate'}
138+
>
139+
140+
</span>
141+
</Primary>
142+
</Button>
143+
</div>
134144
</>
135145
)
136146
} else {
@@ -148,16 +158,16 @@ export const ItemInfo = ({
148158
</Button>
149159
</div>
150160
<Button onClick={() => curate(id)}>
151-
<Primary>
152-
<span
153-
className={styles.top}
154-
data-position={'top'}
155-
data-tooltip={'curate'}
156-
>
157-
158-
</span>
159-
</Primary>
160-
</Button>
161+
<Primary>
162+
<span
163+
className={styles.top}
164+
data-position={'top'}
165+
data-tooltip={'curate'}
166+
>
167+
168+
</span>
169+
</Primary>
170+
</Button>
161171
</div>
162172
</div>
163173
)

src/pages/config/index.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class Config extends Component {
130130
allow subjkt operators ○
131131
</button>
132132
</div> */}
133-
{/* <div style={{ paddingTop: '15%' }}>
133+
<div style={{ paddingTop: '15%' }}>
134134
<input
135135
type="text"
136136
name="subjkt"
@@ -144,18 +144,9 @@ export class Config extends Component {
144144
onChange={this.handleChange}
145145
placeholder="description"
146146
></input>
147-
<br /> */}
148-
149-
150-
{/* social media */}
151-
{/*
152-
<Container>
153-
<Padding>
154-
<input type="file" onChange={this.onFileChange} />
155-
</Padding>
156-
</Container> */}
157-
{/* <button onClick={this.subjkt_config}>config SUBJKT</button>
158-
</div> */}
147+
<br />
148+
<button style={{ border: 'none', borderBottom: '3px solid black', borderRight: '3px solid black' }} onClick={this.subjkt_config}>config SUBJKT</button>
149+
</div>
159150
<div style={{ paddingTop: '5%' }}>
160151
<input
161152
type="text"

src/pages/feeds/feeds.js

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,18 @@ export const Feeds = ({ type = 0 }) => {
2424
const [items, setItems] = useState([])
2525
const [count, setCount] = useState(0)
2626
const [lastId, setId] = useState(999999)
27+
const [offset, setOffset] = useState(0)
2728
const [hasMore, setHasMore] = useState(true)
2829
const startTime = customFloor(Date.now(), ONE_MINUTE_MILLIS)
29-
const loadMore = () => {
30-
setCount(count + 1)
31-
}
30+
const loadMore = async () => {
31+
32+
if (type === 1) {
33+
await getHdaoFeed()
34+
}
35+
if (type === 2) await getRandomFeed()
36+
if (type === 3) getLatest(Math.min.apply(Math, items.map(e => e.id)))
37+
38+
}
3239

3340
useEffect(async () => {
3441
if (error) {
@@ -51,42 +58,20 @@ export const Feeds = ({ type = 0 }) => {
5158
setError(true)
5259
})
5360
} else if (type === 1) {
54-
GethDAOFeed({ counter: count })
55-
.then((result) => {
56-
const next = items.concat(result)
57-
setItems(next)
58-
59-
// if original returns less than 10, then there's no more data coming from API
60-
if (result.length < 10) {
61-
setHasMore(false)
62-
}
63-
})
64-
.catch((e) => {
65-
setError(true)
66-
})
61+
await getHdaoFeed()
6762
} else if (type === 2) {
68-
GetRandomFeed({ counter: count })
69-
.then((result) => {
70-
// filtered isn't guaranteed to always be 10. if we're filtering they might be less.
71-
const next = items.concat(result)
7263

73-
next.map(e => console.log(e))
74-
setItems(next)
64+
await getRandomFeed()
7565

76-
// if original returns less than 10, then there's no more data coming from API
77-
if (result.length < 10) {
78-
setHasMore(false)
79-
}
80-
})
81-
.catch((e) => {
82-
setError(true)
83-
})
8466
} else if (type === 3) {
8567

8668
let result = await axios.post(process.env.REACT_APP_GRAPHQL_FEED, { lastId : lastId }).then(res => res.data)
87-
console.log(result)
88-
const next = items.concat(result)
69+
70+
const next = result.concat(result)
8971
setItems(next)
72+
if (result.length < 10) {
73+
setHasMore(false)
74+
}
9075
/* GetFeaturedFeed({ counter: count, max_time: startTime })
9176
.then((result) => {
9277
// filtered isn't guaranteed to always be 10. if we're filtering they might be less.
@@ -104,6 +89,32 @@ export const Feeds = ({ type = 0 }) => {
10489
}
10590
}, [count, type])
10691

92+
const getLatest = async (id) => {
93+
94+
let result = await axios.post(process.env.REACT_APP_GRAPHQL_FEED, { lastId : id }).then(res => res.data)
95+
const next = items.concat(result)
96+
setItems(next)
97+
if (result.length < 10) {
98+
setHasMore(false)
99+
}
100+
}
101+
102+
const getHdaoFeed = async () => {
103+
104+
let result = await axios.post(process.env.REACT_APP_GRAPHQL_HDAO, { offset : offset }).then(res => res.data)
105+
setOffset(offset + 50)
106+
const next = items.concat(result)
107+
setItems(next)
108+
109+
}
110+
111+
const getRandomFeed = async () => {
112+
let result = await axios.post(process.env.REACT_APP_GRAPHQL_RANDOM).then(res => res.data)
113+
setOffset(offset + 50)
114+
const next = items.concat(result)
115+
setItems(next)
116+
}
117+
107118
return (
108119
<Page title="">
109120
<InfiniteScroll

src/pages/objkt-display/tabs/collectors.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ import { OwnerList } from '../../../components/owner-list'
44
import { HicetnuncContext } from '../../../context/HicetnuncContext'
55
import { OwnerSwaps } from '../../../components/owner-swaps'
66

7+
const _ = require('lodash')
8+
79
export const Collectors = ({ owners, swaps, token_holders }) => {
810
const { syncTaquito, collect, acc, getAccount, cancel } =
911
useContext(HicetnuncContext)
1012
console.log(swaps)
1113
console.log('holders', token_holders)
14+
1215
// sort swaps in ascending price order
13-
swaps = swaps.sort((a, b) =>
14-
a.price.localeCompare(b.price, 'en', { numeric: true })
15-
)
16+
17+
swaps = _.orderBy(swaps, 'price', 'asc')
1618

1719
/* const filtered =
1820
(owners &&

src/pages/tags/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { Page, Container, Padding } from '../../components/layout'
1111
import { PATH } from '../../constants'
1212
import styles from './styles.module.scss'
1313

14+
const axios = require('axios')
15+
1416
export const Tags = () => {
1517
const { id } = useParams()
1618
const [error, setError] = useState(false)
@@ -22,12 +24,14 @@ export const Tags = () => {
2224
setCount(count + 1)
2325
}
2426

25-
useEffect(() => {
27+
useEffect(async () => {
2628
if (error) {
2729
console.log('returning on error')
2830
return
2931
}
3032

33+
await axios.post(process.env.REACT_APP_GRAPHQL_TAGS, { tag : id }).then(res => console.log(res.data))
34+
3135
GetTags({ tag: id, counter: count })
3236
.then((result) => {
3337
const next = items.concat(result)

0 commit comments

Comments
 (0)