-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
fix: automated DocsButton #1188
Conversation
Signed-off-by: akshatnema <20bcs022@iiitdmj.ac.in>
✅ Deploy Preview for asyncapi-website ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-1188--asyncapi-website.netlify.app/ |
Signed-off-by: akshatnema <20bcs022@iiitdmj.ac.in>
@alequetzalli Functionality implemented!! It is not as effective as manual insertion right now, but it will be improved as we need this improvement quite urgently. I have removed the manual insertion of components in the pages so far. I'll like to have your review first as Lukasz is on vacation right now. |
@magicmatatjahu @derberg @alequetzalli Kindly look into the implementation and preview of this PR and review it. Till now, I found this to be a quick and effective solution to automate these buttons according to DocTree. Kindly suggest or give your feedback on the implementation made. |
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.
as we need this only for docs layout, why you added this new code to Layout.js
?
const allDocPosts = posts.filter(p => p.slug.startsWith('/docs/')) | ||
const treePosts = buildNavTree(allDocPosts) | ||
let structuredPosts = [] | ||
const convertDocPosts = (docObject) => { |
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.
for future us 😄 , please add a comment what the purpose of this function is, why the conversion is needed and what is converted. I don't think you are converting anything, you are rather generating a flat list of all docs 🤔
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.
Sure 👍
This is because |
Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
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.
lgtm, please just add as many comments as possible 🙏🏼
things like index-2>=0
or index+1<countDocPages
scare the hell out of me when I think that sometime I will have to go there and make some adjustments 😆 and will end up needing to debug every single line 😄
Signed-off-by: akshatnema <20bcs022@iiitdmj.ac.in>
@derberg Comments are added to the changes. You can now review the implementation and logic behind the buttons. |
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.
@akshatnema thanks ❤️
one final question, sorry. Wouldn't it be better if this is all calculated in https://github.com/asyncapi/website/blob/master/scripts/build-post-list.js
Yeah, I have a plan of doing that in building the posts list, but right now I couldn't find the logic. Since, we need something right now, I build this solution in frontend 😅. |
So you mean that once we merge, you will work on followup PR? I'm ok to accept it. @magicmatatjahu ? |
Yeah, because I need to do some hit and trials while creating and implementing the logic. I'll probably have to change the processing of posts list little bit to add these fields during the build time. |
Heyo, @akshatnema ! this is so exciting! ✨✨✨✨✨ I was on vacation and just got back. ✌🏽 |
Signed-off-by: akshatnema <20bcs022@iiitdmj.ac.in>
@alequetzalli Done with removing buttons in the |
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.
NOW FOR REAL 😄✨✨✨✨✨✨
@derberg your review is needed for this PR. |
just please create followup issue for the implementation improvement |
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 try to write such a logic inside Layout
component and it should be written on building phase (in one of scripts) - atm every page on building phase and runtime is affected and we process unnecessary operations. In other words, please move logic to the scripts and add new metadata to the pages nodes.
Ok. That is my plan for the next follow up PR and I completely understand that current implementation will increase the run time of the website while rendering different pages. If you want the logic to be written in |
@akshatnema If we were to have a release by Friday then I would accept it and have no problem, but due to the fact that the website code (overall) looks terrible and is becoming less and less readable (plus we don't have releases and we have a lot of time) then I would prefer it to be done in this PR. If other codeowners are in favour of such a code push, I can accept it, but let them rethink my thoughts above. |
@magicmatatjahu I shared my feedback here already #1188 (comment). @akshatnema is aware of the issue that code is in a wrong place, but this is a quick fix to address missing buttons in generator documentation that was added recently. this is a maintainer contribution, not a random contributor that just came for one contribution and throw code on our backs, but maintainer that will create a followup issue to improve the code. So yeah, I trust we will soon get a follow up cleanup |
@derberg your review needed!! |
YEAH LUKASZ, GET OVER HERE STAT!! |
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.
go go go
no need to wait for me if @alequetzalli and @magicmatatjahu already gave a green light
/rtm |
Description
This PR consists of automating the
DocsButton
component for all the Doc pages. TheUp Next
andGo Back
Buttons are automated according to the order of the pages given in the Doc Tree.Related issue(s)
Fixes #1000