home.gno

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