github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/r/gnoland/home/home.gno (about)

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