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

chore: refactor p/demo/ui #902

Merged
merged 4 commits into from
Jun 22, 2023
Merged

chore: refactor p/demo/ui #902

merged 4 commits into from
Jun 22, 2023

Conversation

moul
Copy link
Member

@moul moul commented Jun 16, 2023

Refactor p/demo/ui: various fixes and API updates.

  • add support dom.Prefix for automatic related link generation
  • add support for dom.WithComments for adding annotation comments in the generated markdown
  • switching to an API based on objects instead of constructors

Blocks #898
Continues #527
Related with #781
Addresses #903

Contributors Checklist

  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

Maintainers Checklist

  • Checked that the author followed the guidelines in CONTRIBUTING.md
  • Checked the conventional-commit (especially PR title and verb, presence of BREAKING CHANGE: in the body)
  • Ensured that this PR is not a significant change or confirmed that the review/consideration process was appropriate for the change

@moul moul self-assigned this Jun 16, 2023
@moul moul changed the title dev/moul/uirefactor chore: refactor p/demo/ui Jun 16, 2023
@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages. and removed 📦 🤖 gnovm Issues or PRs gnovm related labels Jun 16, 2023
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul moul mentioned this pull request Jun 16, 2023
13 tasks
@moul moul marked this pull request as ready for review June 16, 2023 07:51
@moul moul requested a review from a team as a code owner June 16, 2023 07:51
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; some nits.

examples/gno.land/p/demo/ui/ui.gno Outdated Show resolved Hide resolved
}

type Raw struct {
Content string
}

func (r Raw) String() string {
func (r Raw) String(_ DOM) string {
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
func (r Raw) String(_ DOM) string {
func (r Raw) String(DOM) string {

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't aware we can do this.

Anyway, I prefer the other method which emphasizes more on the explicit ignore, like what we do with anonymous imports.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any other opinions?

I'm okay to change my habit here, but not sure what's the best.

Copy link
Member

Choose a reason for hiding this comment

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

I've reviewed Effective Go, Google and Uber Style guide and there doesn't seem to be any reference to what to do here.

Personally I interpret not even using _ as being an even stronger indicator that the argument is not used, and that it is put there only to match an interface. But I'm fine with whatever we go with.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also okay with your solution, so please, someone else? :)

Comment on lines +157 to +166
func (text H1) String(_ DOM) string { return "# " + string(text) + "\n" }
func (text H2) String(_ DOM) string { return "## " + string(text) + "\n" }
func (text H3) String(_ DOM) string { return "### " + string(text) + "\n" }
func (text H4) String(_ DOM) string { return "#### " + string(text) + "\n" }
func (text H5) String(_ DOM) string { return "##### " + string(text) + "\n" }
func (text H6) String(_ DOM) string { return "###### " + string(text) + "\n" }
func (text Bold) String(_ DOM) string { return "**" + string(text) + "**" }
func (text Italic) String(_ DOM) string { return "_" + string(text) + "_" }
func (text Paragraph) String(_ DOM) string { return "\n" + string(text) + "\n" }
func (_ HR) String(_ DOM) string { return "\n---\n" }
Copy link
Member

Choose a reason for hiding this comment

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

remove blank identifier?

func (text Paragraph) String(_ DOM) string { return "\n" + string(text) + "\n" }
func (_ HR) String(_ DOM) string { return "\n---\n" }

func (text Code) String(_ DOM) string {
Copy link
Member

Choose a reason for hiding this comment

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

same here

moul added 3 commits June 18, 2023 22:12
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
@moul
Copy link
Member Author

moul commented Jun 22, 2023

Let's merge the changes and have a discussion about anonymous variables later. Once we reach a decision on the official approach, we should update either the CONTRIBUTING.md guidelines or a linter accordingly.

@moul moul merged commit dcbe130 into gnolang:master Jun 22, 2023
29 checks passed
@moul moul deleted the dev/moul/uirefactor branch June 22, 2023 20:26
Doozers pushed a commit to Doozers/gno that referenced this pull request Aug 31, 2023
@moul moul added this to the 🌟 main.gno.land (wanted) milestone Sep 18, 2023
@moul moul mentioned this pull request Oct 12, 2023
7 tasks
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
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants