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(examples/hof): Title and description for realms #3674

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

Conversation

Ursulovic
Copy link
Contributor

Title And Description for Hall of Fame realms

Goal

Add metadata support (title and description) to realms in the Hall of Fame while maintaining backward compatibility with existing registrations.

Description

This improvement allows users to provide additional metadata for their realms through optional title and description fields. The implementation uses variadic parameters in the Register function, ensuring that:

  • Existing registered realms continue to work without changes
  • New registrations can optionally include metadata
  • Clean and consistent display of metadata in the UI

Changes

  • Added Metadata struct with Title and Description fields
  • Instead of using raw Markdown in Render..Gno, @moul 's Mardkown package will be used
  • Extended Register function to accept optional metadata parameters
  • Updated rendering to display metadata when available
  • Added validation for metadata fields:
    • Title: 1-30 characters
    • Description: 1-100 characters

@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Feb 3, 2025
@Ursulovic Ursulovic changed the title Improvement(Hall of Fame): Title and Description for Realms feat(Hall of Fame): Title and Description for Realms Feb 3, 2025
@Gno2D2 Gno2D2 requested a review from a team February 3, 2025 13:07
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Feb 3, 2025

🛠 PR Checks Summary

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

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: Ursulovic/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 not 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
    └── 🔴 Else
        └── 🔴 And
            ├── 🟢 This label is applied to pull request: review/triage-pending
            └── 🔴 On no pull request

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

@leohhhn leohhhn changed the title feat(Hall of Fame): Title and Description for Realms feat(examples/hof): Title and description for realms Feb 3, 2025
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@Ursulovic Ursulovic marked this pull request as ready for review February 3, 2025 18:32
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Feb 3, 2025
Comment on lines +105 to +109
func RegisterMetadata(params ...string) Metadata {
// Validate params length
if len(params) != 2 {
panic(ErrInvalidMetadata)
}
Copy link
Contributor

@leohhhn leohhhn Feb 4, 2025

Choose a reason for hiding this comment

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

This is a bad approach, you're using variadic arguments but you know that you will have only two arguments.

Variadic arguments should be used only in specific cases, and this isn't one of them, as you could've done this in a very straighforward manner with two arguments.

exhibition.items.Set(pkgpath, i)
exhibition.itemsSorted.Set(id.String(), i)

std.Emit("Registration")
}

func RegisterMetadata(params ...string) Metadata {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this whole function; Just add the title and description in the Register function directly. Keep the checks, but don't panic but just add an empty return, just like in the rest of the function

Copy link
Contributor

Choose a reason for hiding this comment

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

Imagine how your code will be used; if you need to use Register inside of another realm's code, if you panic, you will fully block execution of the realm that called Register. If you simply do a return, without an error, in Register, HOF will try to add the realm that called it, it may work, but if not, nothing will happen.

upvote *avl.Tree // std.Addr > struct{}{}
downvote *avl.Tree // std.Addr > struct{}{}
}

Metadata struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a reason to have this, just add two strings to the Item type

@@ -45,7 +46,7 @@ func (e Exhibition) Render(path string, dashboard bool) string {

out += "<div>\n\n"
id, _ := seqid.FromString(item.Key)
out += ufmt.Sprintf("### Submission #%d\n\n", int(id))
out += md.H3(ufmt.Sprintf("Submission #%d", int(id))) + "\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is a \n needed here? I'm not sure, please double check

Comment on lines +62 to +64
out := ""

out += md.CodeBlock(i.pkgpath) + "\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a screenshot of how the new hall of fame page will look like?

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.

You need to change the approach in your implementation; I've left comments.

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. review/triage-pending PRs opened by external contributors that are waiting for the 1st review
Projects
Status: In Progress
Status: Triage
Development

Successfully merging this pull request may close these issues.

3 participants