From bbae09f2a613a8f47ed38c1ef10faf0adbcad3f4 Mon Sep 17 00:00:00 2001 From: moul <94029+moul@users.noreply.github.com> Date: Fri, 6 Dec 2024 19:34:20 +0100 Subject: [PATCH] chore: fixup Signed-off-by: moul <94029+moul@users.noreply.github.com> --- examples/gno.land/p/moul/web25/web25.gno | 14 +++++++-- examples/gno.land/r/moul/home/home.gno | 16 ++++++++-- examples/gno.land/r/moul/home/z1_filetest.gno | 11 +++++-- examples/gno.land/r/moul/home/z2_filetest.gno | 29 +++++++++++-------- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/examples/gno.land/p/moul/web25/web25.gno b/examples/gno.land/p/moul/web25/web25.gno index bd63c207fb7..4152e07af49 100644 --- a/examples/gno.land/p/moul/web25/web25.gno +++ b/examples/gno.land/p/moul/web25/web25.gno @@ -5,8 +5,9 @@ package web25 import "strings" type Config struct { - CID string - URL string + CID string + URL string + Text string } func (c *Config) SetRemoteFrontendByURL(url string) { @@ -26,6 +27,8 @@ func (c Config) GetLink() string { return c.URL } +const DefaultText = `Click [here]({link}) to visit the full rendering experience.\n` + // Render displays a frontend link at the top of your realm's Render function in // a concistent way to help gno visitors to have a consistent experience. // @@ -35,5 +38,10 @@ func (c Config) Render(path string) string { if strings.Contains(path, "?no-web25") { return "" } - return "Checkout the full experience from the [web2.5 frontend](" + c.GetLink() + ")" + text := c.Text + if text == "" { + text = DefaultText + } + text = strings.ReplaceAll(text, "{link}", c.GetLink()) + return text } diff --git a/examples/gno.land/r/moul/home/home.gno b/examples/gno.land/r/moul/home/home.gno index 28bdb6a703d..591e2d2c6f9 100644 --- a/examples/gno.land/r/moul/home/home.gno +++ b/examples/gno.land/r/moul/home/home.gno @@ -3,6 +3,7 @@ package home import ( "strconv" + "gno.land/p/moul/mdtable" "gno.land/p/moul/txlink" "gno.land/p/moul/umd" "gno.land/p/moul/web25" @@ -41,19 +42,28 @@ func Render(path string) string { content += umd.H2("Personal ToDo List") content += umd.BulletItem("test") for i, todo := range todos { - deleteLink := umd.Link("del", txlink.Call("DeleteTodo", "idx", strconv.Itoa(i))) + deleteLink := umd.Link("x", txlink.Call("DeleteTodo", "idx", strconv.Itoa(i))) content += umd.BulletItem(todo + " " + deleteLink) } content += umd.Paragraph( - umd.Link("new todo", txlink.Call("AddNewTodo")), + umd.Link("new", txlink.Call("AddTodo")), ) + content += umd.H2("Table Example") + // TODO: replace with a useful example + table := mdtable.Table{ + Headers: []string{"foo", "bar"}, + } + table.Append([]string{"foo1", "bar1"}) + table.Append([]string{"foo2", "bar2"}) + content += table.String() + // TODO: my r/boards posts // TODO: my r/events events return content } -func AddNewTodo(todo string) { +func AddTodo(todo string) { config.AssertIsAdmin() todos = append(todos, todo) } diff --git a/examples/gno.land/r/moul/home/z1_filetest.gno b/examples/gno.land/r/moul/home/z1_filetest.gno index a118737b2ef..be825d83c88 100644 --- a/examples/gno.land/r/moul/home/z1_filetest.gno +++ b/examples/gno.land/r/moul/home/z1_filetest.gno @@ -7,13 +7,18 @@ func main() { } // Output: -// Checkout the full experience from the [web2.5 frontend](https://ipfs.io/ipfs/12345678)# Manfred's (gn)home Dashboard +// Click [here](https://ipfs.io/ipfs/12345678) to visit the full rendering experience.\n# Manfred's (gn)home Dashboard // ## Meme // ![meme](https://i.imgflip.com/7ze8dc.jpg) // ## Status // Online // [update](/r/moul/home$help&func=UpdateStatus)## Personal ToDo List // - test -// - fill this todo list... [del](/r/moul/home$help&func=DeleteTodo&idx=0) -// [new todo](/r/moul/home$help&func=AddNewTodo) +// - fill this todo list... [x](/r/moul/home$help&func=DeleteTodo&idx=0) +// [new](/r/moul/home$help&func=AddTodo) +// ## Table Example +// | foo | bar | +// | --- | --- | +// | foo1 | bar1 | +// | foo2 | bar2 | // diff --git a/examples/gno.land/r/moul/home/z2_filetest.gno b/examples/gno.land/r/moul/home/z2_filetest.gno index d6386ef43c4..8421edbf18e 100644 --- a/examples/gno.land/r/moul/home/z2_filetest.gno +++ b/examples/gno.land/r/moul/home/z2_filetest.gno @@ -8,28 +8,33 @@ import ( func main() { std.TestSetOrigCaller("g1manfred47kzduec920z88wfr64ylksmdcedlf5") - home.AddNewTodo("aaa") - home.AddNewTodo("bbb") - home.AddNewTodo("ccc") - home.AddNewTodo("ddd") - home.AddNewTodo("eee") + home.AddTodo("aaa") + home.AddTodo("bbb") + home.AddTodo("ccc") + home.AddTodo("ddd") + home.AddTodo("eee") home.UpdateStatus("Lorem Ipsum") home.DeleteTodo(3) println(home.Render("")) } // Output: -// Checkout the full experience from the [web2.5 frontend](https://ipfs.io/ipfs/12345678)# Manfred's (gn)home Dashboard +// Click [here](https://ipfs.io/ipfs/12345678) to visit the full rendering experience.\n# Manfred's (gn)home Dashboard // ## Meme // ![meme](https://i.imgflip.com/7ze8dc.jpg) // ## Status // Lorem Ipsum // [update](/r/moul/home$help&func=UpdateStatus)## Personal ToDo List // - test -// - fill this todo list... [del](/r/moul/home$help&func=DeleteTodo&idx=0) -// - aaa [del](/r/moul/home$help&func=DeleteTodo&idx=1) -// - bbb [del](/r/moul/home$help&func=DeleteTodo&idx=2) -// - ddd [del](/r/moul/home$help&func=DeleteTodo&idx=3) -// - eee [del](/r/moul/home$help&func=DeleteTodo&idx=4) -// [new todo](/r/moul/home$help&func=AddNewTodo) +// - fill this todo list... [x](/r/moul/home$help&func=DeleteTodo&idx=0) +// - aaa [x](/r/moul/home$help&func=DeleteTodo&idx=1) +// - bbb [x](/r/moul/home$help&func=DeleteTodo&idx=2) +// - ddd [x](/r/moul/home$help&func=DeleteTodo&idx=3) +// - eee [x](/r/moul/home$help&func=DeleteTodo&idx=4) +// [new](/r/moul/home$help&func=AddTodo) +// ## Table Example +// | foo | bar | +// | --- | --- | +// | foo1 | bar1 | +// | foo2 | bar2 | //