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: add JJOptimist's Homepage realm to examples #3405

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

JJOptimist
Copy link

This pull request adds a new realm example to the Gno examples repository—JJOptimist's Homepage.

The realm includes:

  • Personal introduction and contact information
  • Configuration management system
  • Owner controls
  • Tests for ownership and rendering

@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Dec 25, 2024
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 25, 2024

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: JJOptimist/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🟢 At least 1 user(s) of the organization reviewed the pull request (with state "APPROVED")
    │       ├── 🔴 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)
    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@notJoon notJoon added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Dec 26, 2024
@leohhhn leohhhn self-requested a review December 27, 2024 04:31
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

Please check comments 🙏

Apart from that, if you want to merge something into the examples/ folder, it should provide some educational value about Gno to newcomers. Please, explore a bit more and see what interesting realms or packages you can use to make your home realm more unique, so that it can be merged into the monorepo.

If you do not want to do this, you can simply deploy persmissionlessly.

examples/gno.land/r/jjoptimist/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home_test.gno Outdated Show resolved Hide resolved
@leohhhn
Copy link
Contributor

leohhhn commented Jan 9, 2025

Hey @JJOptimist, what's the status of this PR?

@JJOptimist
Copy link
Author

Hey @JJOptimist, what's the status of this PR?

I fixed the things you pointed out and took your suggestion to use ownable. Ive been experimenting to make something creative/ worth the HoF, so i will push it all together soon

@JJOptimist
Copy link
Author

I've updated the realm

  • Integrated p/demo/ownable for proper ownership management and access control
  • Added dynamic ASCII art gnome that changes based on block height
  • Moved files to home/ directory structure
  • Added proper tests for both ownership and configuration

The gnome's expression changes based on block height divisibility (by 2, 3, 5, or 7)

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this file be removed?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for quick notice, removed it

mykey_backup.armor Outdated Show resolved Hide resolved
@leohhhn
Copy link
Contributor

leohhhn commented Jan 10, 2025

@JJOptimist

Generally, please take a look at comments and reply to them, even if they're outdated because you've changed the code completely.

@JJOptimist
Copy link
Author

Thanks for your patience. Let me explain the code evolution:

Initially, I tried to create an animated realm with CSS animations. However, I discovered that complex CSS animations weren't the best approach for a Gno realm, as:

  • CSS animations added unnecessary complexity
  • The focus should be on demonstrating Gno-specific features
  • Markdown rendering is more reliable for realm display

Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

Good start; please fix the things I mentioned in the comments below :)

examples/gno.land/r/jjoptimist/home/home_test.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/home.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/gno.mod Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/home.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
examples/gno.land/r/jjoptimist/home/home.gno Outdated Show resolved Hide resolved
@JJOptimist
Copy link
Author

I've updated the home realm:

  • Changed gnome art variables to constants for better code organization
  • Replaced if-else chain with switch statement for cleaner gnome art selection
  • Properly defined Config struct with exported fields for better type safety
  • Exported Ownable and implemented AssertCallerIsOwner for proper access control
  • Removed redundant GetOwner() function since Ownable is now exported
  • Changed require to dependencies in gno.mod following new standards
  • Properly spaced out imports for better readability
  • Registered realm in Hall of Fame for community visibility
  • Removed ownership tests to avoid testing imported package functionality
  • Using direct config access in same package for better efficiency

Comment on lines 46 to 59
func getGnomeArt(height int64) string {
var art string
switch {
case height%7 == 0:
art = gnomeArt4 // winking gnome
case height%5 == 0:
art = gnomeArt3 // starry-eyed gnome
case height%3 == 0:
art = gnomeArt2 // happy gnome
default:
art = gnomeArt1 // regular gnome
}
return "```\n" + art + "\n```\n"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this to the bottom or somewhere else, since this is a helper function

@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 🌐 tendermint v2 Issues or PRs tm2 related labels Jan 21, 2025
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tm2/pkg/overflow/overflow_impl.go 50.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Gno2D2 Gno2D2 requested a review from a team January 26, 2025 16:34
Copy link
Contributor

@leohhhn leohhhn left a comment

Choose a reason for hiding this comment

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

Just check the leftover comments, and run make fmt in examples :)

examples/gno.land/r/jjoptimist/home/config.gno Outdated Show resolved Hide resolved
"strconv"
"time"

"gno.land/p/demo/ownable"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unused

@Gno2D2 Gno2D2 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants