Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new realm /r/demo/microblog #791

Merged
merged 25 commits into from
Jun 20, 2023
Merged

Conversation

schollz
Copy link
Contributor

@schollz schollz commented Apr 30, 2023

Description

This is a realm exploring the idea of microblogging, where each page is routed by the user's address and each page shows a sorted list of entries from that user. This is a starting point for future realms that may incorporate incentivizing of posts, but wanted to get a working MVP. I believe this realm also serves as a nice intro into Gno (similar to blog) but here it has an exceedingly simple API and demonstrates the utility of content addressing.

How has this been tested?

Yes, I've tested this by setting up my own genesis block and using that to add the package, realm, and submit posts to the realm.

@schollz schollz requested a review from a team as a code owner April 30, 2023 15:31
@schollz
Copy link
Contributor Author

schollz commented Apr 30, 2023

This check is failing on the CI:

go run ./gnovm/cmd/gno build --verbose ./examples
./examples/gno.land/r/demo/microblog
github.com/gnolang/gno/examples/gno.land/p/demo/microblog
command-line-arguments
# command-line-arguments
Error: examples/gno.land/r/demo/microblog/microblog.gno.gen.go:30:2: imported and not used: "github.com/gnolang/gno/gnovm/stdlibs/stdshim" as std
Error: examples/gno.land/r/demo/microblog/microblog.gno.gen.go:53:24: cannot convert "" (untyped string constant) to interface{Error() string}

I don't understand why. I can run the same command on my local repo and it reports no errors.

@moul
Copy link
Member

moul commented Apr 30, 2023

I don't understand why. I can run the same command on my local repo and it reports no errors.

The difference might be that the CI runs gno precompile before gno build. To streamline the process, I suggest making precompile automatic when build is called. Can you please look into this, @harry-hov?

To improve error clarity, it would be helpful to display the mapped .gno line for each generated .go line. This will provide better context for developers to debug the errors.

@schollz schollz changed the title new realm: /r/demo/microblog feat: new realm /r/demo/microblog Apr 30, 2023
@schollz
Copy link
Contributor Author

schollz commented Apr 30, 2023

The difference might be that the CI runs gno precompile before gno build.

Thanks that was the trick I needed. I added that to my workflow and I'll be able to catch these errors from now on.

Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the idea 💯

Thank you for opening up the PR 🙏

I've left a few comments we should discuss before merging

examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog_test.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
gno.land/genesis/genesis_balances.txt Outdated Show resolved Hide resolved
examples/gno.land/r/demo/microblog/microblog_test.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog_test.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
@schollz
Copy link
Contributor Author

schollz commented May 10, 2023

Thanks @ajnavarro, @zivkovicmilos will make edits for these this weekend! Appreciate your help.

Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great realm 👍

I personally find Page for the user's posts confusing. (page makes me think of pagination, of a limited set of entries). What about Feed or Profile?

Have you thought about possibly integrating gno.land/r/demo/users for friendlier names? :)

examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
@thehowl thehowl mentioned this pull request May 22, 2023
22 tasks
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label May 22, 2023
@schollz
Copy link
Contributor Author

schollz commented May 22, 2023

Have you thought about possibly integrating gno.land/r/demo/users for friendlier names? :)

Yes, @thehowl - this is a great idea. I'm not sure about the strategy do I either

  1. make a realm-to-realm call for /r/demo/users data (if so, how?)

OR

  1. import /r/demo/users into /r/demo/microblog

?

@thehowl
Copy link
Member

thehowl commented May 23, 2023

@schollz just do an import! a key feature of gno is that realm-to-realm calls are done just by importing the realm :)

@schollz
Copy link
Contributor Author

schollz commented May 28, 2023

Its much better now, thanks @thehowl . The microblog now automatically displays user names if they are found in the users realm.

@thehowl thehowl mentioned this pull request Jun 16, 2023
14 tasks
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-approving, looks good everywhere else 👍

examples/gno.land/p/demo/microblog/microblog.gno Outdated Show resolved Hide resolved
@thehowl thehowl merged commit 2516364 into gnolang:master Jun 20, 2023
Doozers pushed a commit to Doozers/gno that referenced this pull request Aug 31, 2023
* add /r/demo/microblog

* remove unused imports

* fix: remove unused imports and error handling

* sort by last updated

* split out rendering into multiple functions

* better error handling

* NewPage is private

* turn print statements to tests

* fix typo

* move comments to README

* remove unused tests

* add status not found

* refactor to new avl.Node iterator

* revert genesis_balances.txt

* remove redundant newPage

* format time to ensure alphabetical sorting

* time bug formatting fix

* improved ui

* unexport byLastPosted

* use registered users data when available

* remove redundant types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants