1package home
2
3import (
4 "std"
5
6 "gno.land/p/demo/ownable"
7 "gno.land/p/demo/ufmt"
8 "gno.land/p/demo/ui"
9 blog "gno.land/r/gnoland/blog"
10 events "gno.land/r/gnoland/events"
11)
12
13// XXX: p/demo/ui API is crappy, we need to make it more idiomatic
14// XXX: use an updatable block system to update content from a DAO
15// XXX: var blocks avl.Tree
16
17var (
18 override string
19 admin = ownable.NewWithAddress("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq") // @manfred by default
20)
21
22func Render(_ string) string {
23 if override != "" {
24 return override
25 }
26
27 dom := ui.DOM{Prefix: "r/gnoland/home:"}
28 dom.Title = "Welcome to gno.land"
29 dom.Classes = []string{"gno-tmpl-section"}
30
31 // body
32 dom.Body.Append(introSection()...)
33
34 dom.Body.Append(ui.Jumbotron(discoverLinks()))
35
36 dom.Body.Append(
37 ui.Columns{3, []ui.Element{
38 lastBlogposts(4),
39 upcomingEvents(),
40 lastContributions(4),
41 }},
42 )
43
44 dom.Body.Append(ui.HR{})
45 dom.Body.Append(playgroundSection()...)
46 dom.Body.Append(ui.HR{})
47 dom.Body.Append(packageStaffPicks()...)
48 dom.Body.Append(ui.HR{})
49 dom.Body.Append(worxDAO()...)
50 dom.Body.Append(ui.HR{})
51 // footer
52 dom.Footer.Append(
53 ui.Columns{2, []ui.Element{
54 socialLinks(),
55 quoteOfTheBlock(),
56 }},
57 )
58
59 // Testnet disclaimer
60 dom.Footer.Append(
61 ui.HR{},
62 ui.Bold("This is a testnet."),
63 ui.Text("Package names are not guaranteed to be available for production."),
64 )
65
66 return dom.String()
67}
68
69func lastBlogposts(limit int) ui.Element {
70 posts := blog.RenderLastPostsWidget(limit)
71 return ui.Element{
72 ui.H3("[Latest Blogposts](/r/gnoland/blog)"),
73 ui.Text(posts),
74 }
75}
76
77func lastContributions(limit int) ui.Element {
78 return ui.Element{
79 ui.H3("Latest Contributions"),
80 // TODO: import r/gh to
81 ui.Link{Text: "View latest contributions", URL: "https://github.com/gnolang/gno/pulls"},
82 }
83}
84
85func upcomingEvents() ui.Element {
86 out, _ := events.RenderEventWidget(events.MaxWidgetSize)
87 return ui.Element{
88 ui.H3("[Latest Events](/r/gnoland/events)"),
89 ui.Text(out),
90 }
91}
92
93func introSection() ui.Element {
94 return ui.Element{
95 ui.H3("We’re building gno.land, set to become the leading open-source smart contract platform, using Gno, an interpreted and fully deterministic variation of the Go programming language for succinct and composable smart contracts."),
96 ui.Paragraph("With transparent and timeless code, gno.land is the next generation of smart contract platforms, serving as the “GitHub” of the ecosystem, with realms built using fully transparent, auditable code that anyone can inspect and reuse."),
97 ui.Paragraph("Intuitive and easy to use, gno.land lowers the barrier to web3 and makes censorship-resistant platforms accessible to everyone. If you want to help lay the foundations of a fairer and freer world, join us today."),
98 }
99}
100
101func worxDAO() ui.Element {
102 // WorxDAO
103 // XXX(manfred): please, let me finish a v0, then we can iterate
104 // highest level == highest responsibility
105 // teams are responsible for components they don't owne
106 // flag : realm maintainers VS facilitators
107 // teams
108 // committee of trustees to create the directory
109 // each directory is a name, has a parent and have groups
110 // homepage team - blocks aggregating events
111 // XXX: TODO
112 /*`
113 # Directory
114
115 * gno.land (owned by group)
116 *
117 * gnovm
118 * gnolang (language)
119 * gnovm
120 - current challenges / concerns / issues
121 * tm2
122 * amino
123 *
124
125 ## Contributors
126 ``*/
127 return ui.Element{
128 ui.H3("Contributions (WorxDAO & GoR)"),
129 // TODO: GoR dashboard + WorxDAO topics
130 ui.Text(`coming soon`),
131 }
132}
133
134func quoteOfTheBlock() ui.Element {
135 quotes := []string{
136 "Gno is for Truth.",
137 "Gno is for Social Coordination.",
138 "Gno is _not only_ for DeFi.",
139 "Now, you Gno.",
140 "Come for the Go, Stay for the Gno.",
141 }
142 height := std.GetHeight()
143 idx := int(height) % len(quotes)
144 qotb := quotes[idx]
145
146 return ui.Element{
147 ui.H3(ufmt.Sprintf("Quote of the ~Day~ Block#%d", height)),
148 ui.Quote(qotb),
149 }
150}
151
152func socialLinks() ui.Element {
153 return ui.Element{
154 ui.H3("Socials"),
155 ui.BulletList{
156 // XXX: improve UI to support a nice GO api for such links
157 ui.Text("Check out our [community projects](https://github.com/gnolang/awesome-gno)"),
158 ui.Text("![Discord](static/img/ico-discord.svg) [Discord](https://discord.gg/S8nKUqwkPn)"),
159 ui.Text("![Twitter](static/img/ico-twitter.svg) [Twitter](https://twitter.com/_gnoland)"),
160 ui.Text("![Youtube](static/img/ico-youtube.svg) [Youtube](https://www.youtube.com/@_gnoland)"),
161 ui.Text("![Telegram](static/img/ico-telegram.svg) [Telegram](https://t.me/gnoland)"),
162 },
163 }
164}
165
166func playgroundSection() ui.Element {
167 return ui.Element{
168 ui.H3("[Gno Playground](https://play.gno.land)"),
169 ui.Paragraph(`Gno Playground is a web application designed for building, running, testing, and interacting
170with your Gno code, enhancing your understanding of the Gno language. With Gno Playground, you can share your code,
171execute tests, deploy your realms and packages to gno.land, and explore a multitude of other features.`),
172 ui.Paragraph("Experience the convenience of code sharing and rapid experimentation with [Gno Playground](https://play.gno.land)."),
173 }
174}
175
176func packageStaffPicks() ui.Element {
177 // XXX: make it modifiable from a DAO
178 return ui.Element{
179 ui.H3("Explore New Packages and Realms"),
180 ui.Columns{
181 3,
182 []ui.Element{
183 {
184 ui.H4("[r/gnoland](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/gnoland)"),
185 ui.BulletList{
186 ui.Link{URL: "r/gnoland/blog"},
187 ui.Link{URL: "r/gnoland/dao"},
188 ui.Link{URL: "r/gnoland/faucet"},
189 ui.Link{URL: "r/gnoland/home"},
190 ui.Link{URL: "r/gnoland/pages"},
191 },
192 ui.H4("[r/sys](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/sys)"),
193 ui.BulletList{
194 ui.Link{URL: "r/sys/names"},
195 ui.Link{URL: "r/sys/rewards"},
196 ui.Link{URL: "/r/sys/validators/v2"},
197 },
198 }, {
199 ui.H4("[r/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/r/demo)"),
200 ui.BulletList{
201 ui.Link{URL: "r/demo/boards"},
202 ui.Link{URL: "r/demo/users"},
203 ui.Link{URL: "r/demo/banktest"},
204 ui.Link{URL: "r/demo/foo20"},
205 ui.Link{URL: "r/demo/foo721"},
206 ui.Link{URL: "r/demo/microblog"},
207 ui.Link{URL: "r/demo/nft"},
208 ui.Link{URL: "r/demo/types"},
209 ui.Link{URL: "r/demo/art/gnoface"},
210 ui.Link{URL: "r/demo/art/millipede"},
211 ui.Link{URL: "r/demo/groups"},
212 ui.Text("..."),
213 },
214 }, {
215 ui.H4("[p/demo](https://github.com/gnolang/gno/tree/master/examples/gno.land/p/demo)"),
216 ui.BulletList{
217 ui.Link{URL: "p/demo/avl"},
218 ui.Link{URL: "p/demo/blog"},
219 ui.Link{URL: "p/demo/ui"},
220 ui.Link{URL: "p/demo/ufmt"},
221 ui.Link{URL: "p/demo/merkle"},
222 ui.Link{URL: "p/demo/bf"},
223 ui.Link{URL: "p/demo/flow"},
224 ui.Link{URL: "p/demo/gnode"},
225 ui.Link{URL: "p/demo/grc/grc20"},
226 ui.Link{URL: "p/demo/grc/grc721"},
227 ui.Text("..."),
228 },
229 },
230 },
231 },
232 }
233}
234
235func discoverLinks() ui.Element {
236 return ui.Element{
237 ui.Text(`<div class="columns-3">
238<div class="column">
239
240### Learn about gno.land
241
242- [About](/about)
243- [GitHub](https://github.com/gnolang)
244- [Blog](/blog)
245- [Events](/events)
246- Tokenomics (soon)
247- [Partners, Fund, Grants](/partners)
248- [Explore the Ecosystem](/ecosystem)
249- [Careers](https://jobs.ashbyhq.com/allinbits)
250
251</div><!-- end column-->
252
253<div class="column">
254
255### Build with Gno
256
257- [Write Gno in the browser](https://play.gno.land)
258- [Read about the Gno Language](/gnolang)
259- [Visit the official documentation](https://docs.gno.land)
260- [Gno by Example](https://gno-by-example.com/)
261- [Efficient local development for Gno](https://docs.gno.land/gno-tooling/cli/gno-tooling-gnodev)
262- [Get testnet GNOTs](https://faucet.gno.land)
263
264</div><!-- end column-->
265<div class="column">
266
267### Explore the universe
268
269- [Discover demo packages](https://github.com/gnolang/gno/tree/master/examples)
270- [Gnoscan](https://gnoscan.io)
271- [Portal Loop](https://docs.gno.land/concepts/portal-loop)
272- [Testnet 4](https://test4.gno.land/)
273- Testnet Faucet Hub (soon)
274
275</div><!-- end column-->
276</div><!-- end columns-3-->`),
277 }
278}
279
280func AdminSetOverride(content string) {
281 admin.AssertCallerIsOwner()
282 override = content
283}
284
285func AdminTransferOwnership(newAdmin std.Address) {
286 admin.AssertCallerIsOwner()
287 admin.TransferOwnership(newAdmin)
288}
home.gno
8.16 Kb · 288 lines