diff --git a/examples/gno.land/r/demo/auction/auction.gno b/examples/gno.land/r/demo/auction/auction.gno index 0b22dd26be9..d7d9baab97b 100644 --- a/examples/gno.land/r/demo/auction/auction.gno +++ b/examples/gno.land/r/demo/auction/auction.gno @@ -64,72 +64,14 @@ func Render(path string) string { return router.Render(path) } -// renderHomepage renders the homepage with links to different sections +// renderHomepage renders the homepage with links to auctions list func renderHomepage(res *mux.ResponseWriter, req *mux.Request) { var b bytes.Buffer - b.WriteString("

Auction Home

\n\n") - b.WriteString("

Create New Auction

\n\n") - b.WriteString("

Upcoming Auctions

\n\n") - b.WriteString("

Ongoing Auctions

\n\n") - res.Write(b.String()) -} - -// renderCreateAuction renders the create auction page -func renderCreateAuction(res *mux.ResponseWriter, req *mux.Request) { - var b bytes.Buffer - b.WriteString("") + b.WriteString("# Homepage\n\n") + b.WriteString("## [AuctionList](/r/demo/auction:List)\n\n") - b.WriteString("#Create New Auction\n") - b.WriteString("
\n") - b.WriteString("Title:
\n") - b.WriteString("Description:
\n") - b.WriteString("Begin:
\n") - b.WriteString("End:
\n") - b.WriteString("Starting Price:
\n") - b.WriteString("\n") - b.WriteString("
\n") - b.WriteString("") res.Write(b.String()) } - -// renderUpcomingAuctions renders the upcoming auctions page -func renderUpcomingAuctions(res *mux.ResponseWriter, req *mux.Request) { - var b bytes.Buffer - b.WriteString("

Upcoming Auctions

\n") - - for i, auc := range auctionList { - if auc.State == "upcoming" { - b.WriteString("\n\n") - b.WriteString("## " + auc.Title) - b.WriteString("\n\n") - b.WriteString("### Owner: " + auc.Owner.String() + "\n") - b.WriteString("### Description: " + auc.Description + "\n\n") - b.WriteString("This auction starts on: " + auc.Begin.String() + " and ends on: " + auc.End.String() + "\n\n") - b.WriteString("### Starting Price: " + strconv.FormatUint(auc.Price, 10) + "\n") - b.WriteString("[View Auction](/auction/" + strconv.Itoa(i) + ")\n") - } - } - res.Write(b.String()) -} - -// renderOngoingAuctions renders the ongoing auctions page -func renderOngoingAuctions(res *mux.ResponseWriter, req *mux.Request) { - var b bytes.Buffer - b.WriteString("

Ongoing Auctions

\n") - - for i, auc := range auctionList { - if auc.State == "ongoing" { - b.WriteString("##" + auc.Title + "\n") - b.WriteString("### Owner: " + auc.Owner.String() + "\n") - b.WriteString("### Description: " + auc.Description + "\n\n") - b.WriteString("This auction started on: " + auc.Begin.String() + " and ends on: " + auc.End.String() + "\n\n") - b.WriteString("### Current Price: " + strconv.FormatUint(auc.Price, 10) + "\n") - b.WriteString("[View Auction](/auction/" + strconv.Itoa(i) + ")\n") - } - } - res.Write(b.String()) -} - // renderAuctionDetails renders the details of a specific auction func renderAuctionDetails(res *mux.ResponseWriter, req *mux.Request) { idStr := req.GetVar("id") @@ -139,22 +81,16 @@ func renderAuctionDetails(res *mux.ResponseWriter, req *mux.Request) { return } auc := auctionList[id] - var b bytes.Buffer - b.WriteString("

Auction Details

\n") + b.WriteString("# Auction List\n\n") + + b.WriteString("\n\n") b.WriteString("## " + auc.Title + "\n") - b.WriteString("### Owner: " + auc.Owner.String() + "\n") + b.WriteString("### Owner: " + auc.Ownable.Owner().String() + "\n") b.WriteString("### Description: " + auc.Description + "\n\n") b.WriteString("This auction starts on: " + auc.Begin.String() + " and ends on: " + auc.End.String() + "\n\n") - b.WriteString("### Current Price: " + strconv.FormatUint(auc.Price, 10) + "\n") - - if auc.State == "ongoing" { - b.WriteString("
\n") - b.WriteString("Amount:
\n") - b.WriteString("\n") - b.WriteString("\n") - b.WriteString("
\n") - } + b.WriteString(ufmt.Sprintf("### starting Price: %d\n", auc.Price)) + b.WriteString("[View Auction](/auction/" + strconv.Itoa(id) + ")\n") res.Write(b.String()) }