-
Notifications
You must be signed in to change notification settings - Fork 401
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): make test files & non-gno files on $source be in a collapsible sections #4063
base: master
Are you sure you want to change the base?
feat(gnoweb): make test files & non-gno files on $source be in a collapsible sections #4063
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ 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! |
Cool. I think I'm gonna add one for two more stuffs in the review tomorrow but it looks good. |
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> | ||
</svg> |
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.
Could you move this icon to the icon svg spritesheet with the other icons (icons.html
)? So we will be able to reuse it?
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.
same for the other one in "Non-Gno Files Section"
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.
done in fa42236. non-gno files section was replaced with ReadmeFile since mempackage seems to return that as the only non-.gno file
<details class="group"> | ||
<summary class="flex items-center cursor-pointer"> | ||
<h3 class="font-medium text-sm">Other Files</h3> | ||
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
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.
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
<svg class="w-4 h-4 ml-1 rotate-180 my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
let's remove animation (and transform
?)
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.
updated in fa42236 but removing the group-open:
part prevents the icon from being rotated at all so I left it in if that is okay
{{ if .NonGnoFiles }} | ||
<details class="group"> | ||
<summary class="flex items-center cursor-pointer"> | ||
<h3 class="font-medium text-sm">Other Files</h3> |
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.
<h3 class="font-medium text-sm">Other Files</h3> | |
<h3 class="font-medium font-interVar text-100">Other Files</h3> |
text-sm
doesn't exist in our theme. Also, would be better to use another font for title
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.
noted and implemented in fa42236
<details class="group"> | ||
<summary class="flex items-center cursor-pointer"> | ||
<h3 class="font-medium text-sm">Test Files</h3> | ||
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
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.
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
<svg class="w-4 h-4 ml-1 group-open:rotate-180 my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
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.
implemented in fa42236
<summary class="flex items-center cursor-pointer"> | ||
<h3 class="font-medium text-sm">Other Files</h3> | ||
<svg class="w-4 h-4 ml-1 transform group-open:rotate-180 transition-transform my-auto" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | ||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> |
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.
We should place the arrow on the left side of the text to improve UX. This change helps users scan the content more quickly and consistently, as all related icons would be aligned on the same side.
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.
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> | ||
</svg> | ||
</summary> | ||
<ul class="list-none space-y-2 pl-2 mt-2"> |
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.
<ul class="list-none space-y-2 pl-2 mt-2"> | |
<ul class="list-none space-y-2 pl-5 mt-2"> |
For a better alignment
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.
implemented in c451d47
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path> | ||
</svg> | ||
</summary> | ||
<ul class="list-none space-y-2 pl-2 mt-2"> |
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.
<ul class="list-none space-y-2 pl-2 mt-2"> | |
<ul class="list-none space-y-2 pl-5 mt-2"> |
For a better alignement
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.
done in c451d47
@@ -275,3 +277,50 @@ func (s *HTMLWebClient) FormatSource(w io.Writer, fileName string, src []byte) e | |||
func (s *HTMLWebClient) WriteFormatterCSS(w io.Writer) error { | |||
return s.Formatter.WriteCSS(w, s.chromaStyle) | |||
} | |||
|
|||
// sortFiles sorts a slice of filenames according to predefined categories: |
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.
Have you considered replacing these numbers with named constants using iota?
Although the comments explain each number's meaning, using named constants would make the code self-doc, improve readability, and reduce the risk of errors due to misnaming.
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 actually removed this sorting in 2c7b9ff as it is done in the view_sorce
file as well
Nice work 👍 Thank you! Might be cool to add some gnoweb tests too. |
- get rid of items slice - introuce a switch for better readability - remove check if the file name contains test, only check for suffix
@alexiscolin @gfanton |
Thank you for you reviews @gfanton @alexiscolin, I hope I covered everything, just for clearance this is the result: also added some tests |
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.
Thanks for adding tests on rendering; that was unexpected but welcome.
Could you update them to use Testify?
After that, we should be all set on my end. Please ping me for a final review once you've updated to Testify.
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.
please, use testify for asserting
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.
implemented in 9370ea9
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.
Use testify for assertion
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.
9370ea9 as well
Yeah I figured it couldn't hurt to add them to everything and not just my code here + it helped me understand what's happening so I can be of more help in the future. Should be okay now, thanks |
implementation of #4034
webclient_html.go
; this results in the file sorting in the right section of the$source
pageview_source.go
in 3 different categories: gno files, test files and non-gno files (README.md is in gno files since it is expected to be on the top always and the files are received sorted)toc_source.html
which replaces thetoc_generic.html
on the$source
page which kind of defeats the purpose of the "toc_generic" name because it is not generic anymore but I didn't want to rename it to avoid confusion - please let me know if neededin the issue mentioned there was a request that there non-gno files be adressed, which they are in this PR, but the abci query doesn't seem to return any non-gno files from the package except README.md
Screenshots
before:

after:


cc: @alexiscolin