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(example): r/mouss #3472

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

feat(example): r/mouss #3472

wants to merge 11 commits into from

Conversation

mous1985
Copy link

@mous1985 mous1985 commented Jan 9, 2025

Hi Gnomes ,
This is my home page. it was difficult to be creative 😅 , so i did what i can do

Home :

I put some informations about me

Screenshot 2025-01-09 at 21 14 20

World kitchen :

I'm passionate about cooking, so I've set up a page for those who want to share their national culinary specialties or just their favorite recipes, since there are so many nationalities in gno community.

Screenshot 2025-01-09 at 21 22 54

feel free to add your recipes ;)

Screenshot 2025-01-09 at 21 35 17

@leohhhn

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

Gno2D2 commented Jan 9, 2025

🛠 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)

☑️ 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: mous1985/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this 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
└── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)

Can be checked by

  • team core-contributors

@mous1985 mous1985 changed the title Home page feat: Home page Jan 9, 2025
}

func renderHomepage(res *mux.ResponseWriter, req *mux.Request) {
var b bytes.Buffer
Copy link
Member

Choose a reason for hiding this comment

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

why are you using a bytes.Buffer?

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 the feedback, i've updated the code,i use strings.Builder instead of bytes.Buffer it's more efficient for string concatenation. bytes.Buffer was just general purpose.
8f5cb186

if !isUser(caller) {
return config.ErrorUnauthorized
}
if contains(profile.Followers, addr) {
Copy link
Member

Choose a reason for hiding this comment

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

looks like you should use the freshly merged addrset library (#3448)

Copy link
Author

@mous1985 mous1985 Jan 10, 2025

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Screenshot 2025-01-10 at 07 58 40

when i run gnodev

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to run make install

Copy link
Author

@mous1985 mous1985 Jan 10, 2025

Choose a reason for hiding this comment

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

@leohhhn
I did it , i get the same error

Copy link
Author

Choose a reason for hiding this comment

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

I realized I forgot to set the home_page branch to track master as its upstream so i haven't the p/moul/addrset in home_page branch . sorry 🙏🏽

}

func isUser(addr std.Address) bool {
return !isAuthorized(addr) && !contains(profile.Followers, addr)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't the if condition be checking the exacte opposite?

Copy link
Author

Choose a reason for hiding this comment

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

I use isUser to check if follower is not admin address or if the follower exist already in the list of followers. i still working on ,I think it's could be a good feature to follow and be followed by other users.

}

func writeRecipe(b *bytes.Buffer, recipe *Recipe) {
b.WriteString("## " + recipe.Name + "\n")
Copy link
Member

Choose a reason for hiding this comment

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

i think that you should consider using a ui library.

Copy link
Author

Choose a reason for hiding this comment

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

res.Write(b.String())
}

func writeRecipe(b *bytes.Buffer, recipe *Recipe) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func writeRecipe(b *bytes.Buffer, recipe *Recipe) {
func (r Recipe) Render() string {

Copy link
Author

Choose a reason for hiding this comment

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

I also change writeProfile to (p Profile)Render
4959189b

@mous1985 mous1985 changed the title feat: Home page feat(example): r/mouss Jan 10, 2025
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
Status: Triage
Development

Successfully merging this pull request may close these issues.

4 participants