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(gnoweb): rework & Implement new gnoweb design #3195

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

Conversation

gfanton
Copy link
Member

@gfanton gfanton commented Nov 25, 2024

address #3191

Reworking the gnoweb package:

  • Implement gnoweb new interface design(cc @alexiscolin).
  • Move Markdown rendering to the server to enhance speed and security. This change also simplifies the implementation of new components, making it more standardized as a Go library.
  • Aim to keep dependencies minimal, using only goldmark for Markdown and chroma for code highlighting, with almost no (in)direct dependencies.
  • Transition to Tailwind for simplicity and maintainability.
  • Retain all features from the previous gnoweb iteration.

Preview

  • Home
    Screenshot 2024-11-25 at 19 39 54

  • Source
    Screenshot 2024-11-25 at 19 41 25

  • Docs
    Screenshot 2024-11-25 at 19 45 16

TODO:

  • port and adapt all previous tests to ensure compatibility (it should not take too long)
  • Some cleanup and restructuring + linting.

Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
Signed-off-by: gfanton <[email protected]>
@gfanton gfanton requested a review from alexiscolin November 25, 2024 18:51
@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Nov 25, 2024
@alexiscolin alexiscolin added the 🌍 gnoweb Issues & PRs related to gnoweb and render label Nov 26, 2024
@Kouteki Kouteki added the in focus Core team is prioritizing this work label Nov 27, 2024
@zivkovicmilos zivkovicmilos self-requested a review November 29, 2024 03:42
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Dec 3, 2024

🛠 PR Checks Summary

🔴 The pull request head branch must be up-to-date with its base (more info)

Manual Checks (for Reviewers):
  • SKIP: Do not block the CI for this PR
  • Determine if infra needs to be updated before merging
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)
🔴 The pull request head branch must be up-to-date with its base (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: gfanton/gno)

Then

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

The pull request head branch must be up-to-date with its base (more info)

If

🟢 Condition met
└── 🟢 On every pull request

Then

🔴 Requirement not satisfied
└── 🔴 Head branch (gfanton:feat/gnoweb-rework) is up to date with base (master): behind by 16 / ahead by 74

Manual Checks
**SKIP**: Do not block the CI for this PR

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
Determine if infra needs to be updated before merging

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: master
    └── 🟢 Or
        ├── 🔴 A changed file matches this pattern: Dockerfile
        ├── 🟢 A changed file matches this pattern: ^misc/deployments (filename: misc/deployments/staging.gno.land/docker-compose.yml)
        ├── 🔴 A changed file matches this pattern: ^misc/docker-
        ├── 🔴 A changed file matches this pattern: ^.github/workflows/releaser.*\.yml$
        └── 🔴 A changed file matches this pattern: ^.github/workflows/portal-loop\.yml$

Can be checked by

  • team devops

@leohhhn leohhhn self-requested a review December 3, 2024 16:35
gno.land/pkg/gnoweb/app.go Outdated Show resolved Hide resolved
gno.land/pkg/gnoweb/alias.go Outdated Show resolved Hide resolved
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.

pr on fork incoming

bind string
analytics bool
json bool
html bool
Copy link
Member

Choose a reason for hiding this comment

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

why have this as an option?

Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping the original behaviors of gnoweb, it has also been added recently to gnodev by @moul, so I believe we still need to keep this around as an option.

Copy link
Member

Choose a reason for hiding this comment

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

Can we have a README, not something too long / complex, but which can help me (or anyone else) quickly answer how to do changes and generally develop on gnoweb?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes definitely

assetsBase := "/" + strings.Trim(cfg.AssetsPath, "/") + "/"

// Handle assets path
mux.Handle(assetsBase, AssetHandler(true))
Copy link
Member

Choose a reason for hiding this comment

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

Should be a way to configure this, maybe from gnoweb or using a build tag, for local development

gno.land/pkg/gnoweb/handler.go Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

after discussion, think this should be gno.land/pkg/gnoweb/markdown

we can move to be more generic in the future and then to gno.land/pkg/markdown, but i suggest you focus on the specific case for now

Copy link
Member

Choose a reason for hiding this comment

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

General comment: we never set a page title anywhere. Can we configure page titles? :)

Copy link
Member

Choose a reason for hiding this comment

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

(I mean the <title> head tag in HTML)

@thehowl
Copy link
Member

thehowl commented Dec 9, 2024

other general comment, but I'm sure you thought about it:

it would be cool if the "search bar" (where the realm path is) acted kind of as a "command palette", and as such allowed to move quickly to help and source, and to move to other realms.

I imagine this is somewhat envisioned/planned. I'm looking forward :)

@thehowl thehowl mentioned this pull request Dec 9, 2024
@leohhhn
Copy link
Contributor

leohhhn commented Dec 10, 2024

Just another design point @alexiscolin
I think the italic is a bit too italic,
and I think the margin/padding of the codeblocks might be a bit too large. WDYT?

Screenshot 2024-12-10 at 17 11 42

"log/slog"
"net/http"

gnodev "github.com/gnolang/gno/contribs/gnodev/pkg/dev"
"github.com/gnolang/gno/gno.land/pkg/gnoweb"
gnoweb "github.com/gnolang/gno/gno.land/pkg/gnoweb"
Copy link
Member

@moul moul Dec 10, 2024

Choose a reason for hiding this comment

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

Suggested change
gnoweb "github.com/gnolang/gno/gno.land/pkg/gnoweb"
"github.com/gnolang/gno/gno.land/pkg/gnoweb"

@@ -1,13 +0,0 @@
# gnoweb
Copy link
Member

@moul moul Dec 10, 2024

Choose a reason for hiding this comment

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

Keep a README in this folder, but feel free to remove the "install" part and only mention that people can view previews on gno.land or run it with gnodev, linking to the gnodev folder.

@@ -1,14 +0,0 @@
package main
Copy link
Member

Choose a reason for hiding this comment

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

Please keep it this way: 1. to facilitate the addition of second tests later, and 2. to ensure that go test does not skip this folder and passes the basic syntax checks.

@@ -0,0 +1,12 @@
{{ define "breadcrumb" }}
Copy link
Member

@moul moul Dec 10, 2024

Choose a reason for hiding this comment

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

Can we consider not committing those generated files (and gitignore them) and ensure that each install command runs go generate?

go install -v .

# Generate process
generate: clean css ts fonts
Copy link
Member

Choose a reason for hiding this comment

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

should have a CI workflow to ensure it's always up-to-date

@leohhhn
Copy link
Contributor

leohhhn commented Dec 10, 2024

@alexiscolin another small bug; with ordered lists the number does not show up:

Screenshot 2024-12-10 at 18 52 36

Copy link
Contributor

Choose a reason for hiding this comment

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

Since faucet config is removed from config, would it not be accessible from Gnoweb anymore?
Which is the entrypoint of Faucet so far? Because CAPTCHA_SITE_KEY is not set anywhere else, and is the one intended to be used by a Gnofaucet frontend.

cc: @zivkovicmilos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌍 gnoweb Issues & PRs related to gnoweb and render in focus Core team is prioritizing this work 📦 ⛰️ gno.land Issues or PRs gno.land package related
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

[gnoweb] Long text popping out [gnoweb] Display line numbers on package & realm source code renders
8 participants