-
Notifications
You must be signed in to change notification settings - Fork 389
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
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks Summary🔴 Pending initial approval by a review team member, or review from tech-staff Manual Checks (for Reviewers):
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) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
func RegisterMetadata(params ...string) Metadata { | ||
// Validate params length | ||
if len(params) != 2 { | ||
panic(ErrInvalidMetadata) | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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
out := "" | ||
|
||
out += md.CodeBlock(i.pkgpath) + "\n" |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
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:Changes
Metadata
struct withTitle
andDescription
fieldsRegister
function to accept optional metadata parameters