Skip to content

Commit

Permalink
added series support
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Ren committed Dec 24, 2020
1 parent f00c821 commit 59aca44
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
10 changes: 6 additions & 4 deletions src/pages/nav.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ const getTopshotOverview = async () => {
pub let id: UInt32
pub let setName: String
pub var locked: Bool
init(id: UInt32, setName: String) {
pub let series: UInt32
init(id: UInt32, setName: String, series: UInt32) {
self.id = id
self.setName = setName
self.locked = false
self.series = series
self.locked = TopShot.isSetLocked(setID: id)!
}
}
Expand All @@ -34,7 +35,8 @@ const getTopshotOverview = async () => {
var sets: [Set] = []
while setID < TopShot.nextSetID {
var setName = TopShot.getSetName(setID: setID)
sets.append(Set(id: setID, setName: setName!))
var series = TopShot.getSetSeries(setID: setID)
sets.append(Set(id: setID, setName: setName!, series: series!))
setID = setID + UInt32(1)
}
self.sets = sets
Expand Down Expand Up @@ -74,7 +76,7 @@ export function TopShotNav() {
topshotOverview.sets.map((s) => {
return (
<NavDropdown.Item key={s.id} href={"/sets/" + s.id}>
{s.id} {s.setName} {s.locked ? <Red>locked</Red> : <Green>open</Green>}
{s.id} {s.setName} S{s.series} {s.locked ? <Red>locked</Red> : <Green>open</Green>}
</NavDropdown.Item>
)
})}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/plays.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ const config = {
page_size: 10,
length_menu: [ 10, 20, 50 ],
no_data_text: 'No data available!',
sort: { column: "playID", order: "desc" }
sort: { column: "playID", order: "desc" },
key_column: "playID"
}

export function TopshotPlays() {
Expand Down
10 changes: 6 additions & 4 deletions src/pages/set.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ const getTopshotSet = async (setID) => {
pub let setName: String
pub let playIDs: [UInt32]
pub let editions: [Edition]
pub var locked: Bool
pub let locked: Bool
pub let series: UInt32
init(id: UInt32, setName: String) {
self.id = id
self.setName = setName
self.playIDs = TopShot.getPlaysInSet(setID: id)!
self.locked = false
self.locked = TopShot.isSetLocked(setID: id)!
self.series = TopShot.getSetSeries(setID: id)!
var editions: [Edition] = []
var playOrder = UInt32(1)
for playID in self.playIDs {
Expand Down Expand Up @@ -119,7 +120,8 @@ const config = {
page_size: 10,
length_menu: [ 10, 20, 50 ],
no_data_text: 'No data available!',
sort: { column: "playOrder", order: "desc" }
sort: { column: "playOrder", order: "desc" },
key_column: "playID"
}

export function TopshotSet() {
Expand Down Expand Up @@ -167,7 +169,7 @@ export function TopshotSet() {
return (
<Root>
<h1>
<Muted>{TopshotSet.set.setName}</Muted>:{" "}
<Muted>{TopshotSet.set.setName}</Muted> S{TopshotSet.set.series}:
{TopshotSet.set.locked ? <Red>locked set</Red> : <Green>open set</Green>}
</h1>
<ReactDatatable
Expand Down
17 changes: 12 additions & 5 deletions src/pages/topshot.comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const getTopShot = async () => {
self.id = id
self.setName = setName
self.playIDs = TopShot.getPlaysInSet(setID: id)!
self.locked = false
self.locked = TopShot.isSetLocked(setID: id)!
for playID in self.playIDs {
var retired = false
Expand All @@ -30,8 +29,10 @@ const getTopShot = async () => {
pub let totalSupply: UInt64
pub let plays: [TopShot.Play]
pub let sets: [Set]
pub let currentSeries: UInt32
init() {
self.totalSupply = TopShot.totalSupply
self.currentSeries = TopShot.currentSeries
self.plays = TopShot.getAllPlays()
var setID = UInt32(1)
var sets: [Set] = []
Expand Down Expand Up @@ -107,10 +108,16 @@ export function TopShot() {
</h3>
<div>
{topshotData && (
<h3>
<Muted>Total Supply: </Muted>
<span>{topshotData.totalSupply}</span>
</h3>
<div>
<h3>
<Muted>Total Supply: </Muted>
<span>{topshotData.totalSupply}</span>
</h3>
<h3>
<Muted>Current Series: </Muted>
<span>S{topshotData.currentSeries}</span>
</h3>
</div>
)}
</div>

Expand Down

0 comments on commit 59aca44

Please sign in to comment.