Skip to content

Commit 262e8ff

Browse files
authored
fix(examples): hall of fame render order (#3709)
## Description Fixes rendering order in the hall of fame realm.
1 parent afd39d3 commit 262e8ff

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

examples/gno.land/r/leon/hof/datasource_test.gno

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func TestItemRecord(t *testing.T) {
151151
content, _ := r.Content()
152152
wantContent := "# Submission #1\n\n\n```\ngno.land/r/demo/test\n```\n\nby demo\n\n" +
153153
"[View realm](/r/demo/test)\n\nSubmitted at Block #42\n\n" +
154-
"#### [2👍](/r/leon/hof$help&func=Upvote&pkgpath=gno.land%2Fr%2Fdemo%2Ftest) - " +
155-
"[1👎](/r/leon/hof$help&func=Downvote&pkgpath=gno.land%2Fr%2Fdemo%2Ftest)\n\n"
154+
"**[2👍](/r/leon/hof$help&func=Upvote&pkgpath=gno.land%2Fr%2Fdemo%2Ftest) - " +
155+
"[1👎](/r/leon/hof$help&func=Downvote&pkgpath=gno.land%2Fr%2Fdemo%2Ftest)**\n\n"
156156
uassert.Equal(t, wantContent, content)
157157
}

examples/gno.land/r/leon/hof/render.gno

+3-5
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ func (e Exhibition) Render(path string, dashboard bool) string {
3838

3939
out += "<div class='columns-2'>\n\n"
4040

41-
page := pager.NewPager(e.itemsSorted, pageSize, false).MustGetPageByPath(path)
42-
43-
for i := len(page.Items) - 1; i >= 0; i-- {
44-
item := page.Items[i]
41+
page := pager.NewPager(e.itemsSorted, pageSize, true).MustGetPageByPath(path)
4542

43+
for _, item := range page.Items {
4644
out += "<div>\n\n"
4745
id, _ := seqid.FromString(item.Key)
4846
out += ufmt.Sprintf("### Submission #%d\n\n", int(id))
@@ -63,7 +61,7 @@ func (i Item) Render(dashboard bool) string {
6361
out += ufmt.Sprintf("[View realm](%s)\n\n", strings.TrimPrefix(i.pkgpath, "gno.land")) // gno.land/r/leon/home > /r/leon/home
6462
out += ufmt.Sprintf("Submitted at Block #%d\n\n", i.blockNum)
6563

66-
out += ufmt.Sprintf("#### [%d👍](%s) - [%d👎](%s)\n\n",
64+
out += ufmt.Sprintf("**[%d👍](%s) - [%d👎](%s)**\n\n",
6765
i.upvote.Size(), txlink.Call("Upvote", "pkgpath", i.pkgpath),
6866
i.downvote.Size(), txlink.Call("Downvote", "pkgpath", i.pkgpath),
6967
)

0 commit comments

Comments
 (0)