-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3298ca
commit 02c3847
Showing
20 changed files
with
150 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
packages/apps/examples/nft-react-hooks/src/app/scenes/Collections/Collections.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
thead td th { | ||
padding: 8px 12px; | ||
font-weight: 600; | ||
padding: 8px 12px; | ||
font-weight: 600; | ||
} | ||
|
||
tbody td th { | ||
padding: 2px 12px; | ||
} | ||
padding: 2px 12px; | ||
} |
67 changes: 38 additions & 29 deletions
67
packages/apps/examples/nft-react-hooks/src/app/scenes/Collections/Collections.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,66 @@ | ||
import { useTrendingCollections, TrendingCollectionsTimePeriod } from '@quicknode/icy-nft-hooks'; | ||
import { | ||
useTrendingCollections, | ||
TrendingCollectionsTimePeriod, | ||
} from '@quicknode/icy-nft-hooks'; | ||
import { useState } from 'react'; | ||
|
||
import './Collections.css'; | ||
|
||
function Collections() { | ||
const [cursor, setCursor] = useState<string | undefined>(undefined); | ||
const { collections, pageInfo } = useTrendingCollections({ | ||
orderBy: 'SALES', | ||
orderDirection: 'DESC', | ||
timePeriod: TrendingCollectionsTimePeriod.ONE_HOUR, | ||
first: 5, | ||
after: cursor | ||
after: cursor, | ||
}); | ||
|
||
return ( | ||
<div className="App"> | ||
<div> | ||
Stats in last hour | ||
</div> | ||
<div>Stats in last hour</div> | ||
<table> | ||
<thead> | ||
<th style={{ textAlign: "left" }}>Collection</th> | ||
<th style={{ textAlign: "right" }}>Floor</th> | ||
<th style={{ textAlign: "right" }}>Volume</th> | ||
<th style={{ textAlign: "right" }}>Total Sales</th> | ||
<th style={{ textAlign: "right" }}>Average</th> | ||
<th style={{ textAlign: 'left' }}>Collection</th> | ||
<th style={{ textAlign: 'right' }}>Floor</th> | ||
<th style={{ textAlign: 'right' }}>Volume</th> | ||
<th style={{ textAlign: 'right' }}>Total Sales</th> | ||
<th style={{ textAlign: 'right' }}>Average</th> | ||
</thead> | ||
<tbody> | ||
{collections.map( | ||
(collection) => { | ||
return ( | ||
<tr key={collection.address}> | ||
<td>{collection.name}</td> | ||
<td className="mono">Ξ{collection.stats.floor.toFixed(3)}</td> | ||
<td className="mono">Ξ{collection.stats.volume.toFixed(3)}</td> | ||
<td className="mono">{collection.stats.totalSales}</td> | ||
<td className="mono">Ξ{collection.stats.average.toFixed(3)}</td> | ||
</tr> | ||
); | ||
} | ||
)} | ||
{collections.map((collection) => { | ||
return ( | ||
<tr key={collection.address}> | ||
<td>{collection.name}</td> | ||
<td className="mono">Ξ{collection.stats.floor.toFixed(3)}</td> | ||
<td className="mono">Ξ{collection.stats.volume.toFixed(3)}</td> | ||
<td className="mono">{collection.stats.totalSales}</td> | ||
<td className="mono">Ξ{collection.stats.average.toFixed(3)}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
{pageInfo?.hasNextPage && ( | ||
<div style={{ alignItems: 'flex-end', width: '100%', justifyContent: 'flex-end', display: 'flex' }}> | ||
<button onClick={() => { | ||
setCursor(pageInfo.endCursor ?? undefined) | ||
}}>Next</button> | ||
<div | ||
style={{ | ||
alignItems: 'flex-end', | ||
width: '100%', | ||
justifyContent: 'flex-end', | ||
display: 'flex', | ||
}} | ||
> | ||
<button | ||
onClick={() => { | ||
setCursor(pageInfo.endCursor ?? undefined); | ||
}} | ||
> | ||
Next | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default Collections; | ||
|
8 changes: 4 additions & 4 deletions
8
packages/apps/examples/nft-react-hooks/src/app/scenes/Home/Home.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.Home { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/apps/examples/nft-react-hooks/src/app/scenes/Home/Home.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "./Home.css"; | ||
import './Home.css'; | ||
|
||
function Home() { | ||
return ( | ||
|
3 changes: 2 additions & 1 deletion
3
packages/apps/examples/nft-react-hooks/src/app/scenes/Wallets/Wallets.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.Wallets {} | ||
.Wallets { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.