-
Notifications
You must be signed in to change notification settings - Fork 1k
Refactoring Site Creation and Additions #157
Conversation
Hey @ollelauribostrom since this PR touches a lot of places of your first refactoring attempt would be lovely if you can get around to look over :] |
/gcbrun |
@LaRuaNa At a first glance, this looks really awesome 🎉 Will look over it more closely when I have some free time tomorrow 🙂 |
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.
Amazing job, @LaRuaNa! LGTM! 🎉
A few observations below.
/gcbrun |
All of this looks really good. Just one concern. This is a HUGE PR which I generally discourage. Lots going on in there and many decisions. Do you think we can split it? |
@MylesBorins doesn't seem to be working on my end. The build I mean. Want to test it. |
@ahmadawais there is something wrong with the build. The resources uploaded but there is no index.html Perhaps a bug from the refactor? Can you test locally |
@MylesBorins Seems to be a problem with redirects I'm on 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.
Really nice job, this is much needed and make stuff a lot more solid 👍 A few minor stuff pointed out below. You could run yarn run tslint -p ./tsconfig.json
to find some minor nits (some pointed out by @sagirk below).
|
||
return ( | ||
<Layout title={title} description={description}> | ||
<Hero title={title} /> | ||
<Navigation sections={navigationSections} /> |
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.
This removes the navigation from the 404 page, I don't think that's what we want? 🙂
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'd take care of that after refactoring the navigation if we wanna keep this. (see https://github.com/nodejs/nodejs.dev/issues/169) I don't see FWIW to run a graphql request for 404 page and additionally we would need to implement same logic we have in gatsby-node
to provide the navigation data.
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.
Navigation felt like a good idea on the 404 page.
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.
+1 to retaining the navigation.
The 404 page content being boxed into the navigation area looks weird design-wise on larger screens (i.e., too much whitespace on the right).
This is caused due to the layout grid. As a hacky stopgap measure, adding an empty div in place of <Navigation>
fixes it
- <Navigation sections={navigationSections} />
+ <div />
On the other hand, if we don't keep the navigation, we need to tweak the text accordingly.
- The page you're trying to access does not exist. Go back to the Homepage or find what you're looking for in the menu.
+ The page you're trying to access does not exist. Go back to the Homepage.
However, this PR has been running for long. As suggested by @LaRuaNa, we can take care of these concerns on a follow-up PR.
Could it be because of this duplicate redirect? |
The problem with redirect is that gcp doesn't care about redirects we've in our config. So we've 2 possible ways to solve that problem:
I'd go for firebase option. Thoughts? |
Yep, since they're different sections it was my interpretation. Though we can ofc change it. Any concrete thoughts / suggestions? |
In my opinion, it would make sense to mark any previous section as done as well. Let's merge this with the current behaviour, we can open a separate issue to discuss this further 🙂 |
@MylesBorins pink :] #157 (comment) |
@LaRuaNa there is nothing special GCP or Firebase related for staging... it is just a CDN bucket and the output from gatsby. I've tested between this branch and master and it appears there is a regression between master and the static output of this branch... as Bisecting rn to see if I can narrow down which change made this happen |
@MylesBorins This line generates |
@LaRuaNa we definitely can rely on serverside behavior for redirects but that will require us to introduce more complicated infrastructure for staging. I'm personally fond of how elegant it is that we can currently direct all traffic to index.html and it "just works". If you can replicate that behavior that would be great. FWIW, do we need to mount everything right now on /learn? It seems premature, and something we could easily do at learn.nodejs.dev in the future without or something similar. Until we have additional material we are hosting on this site do you think there is a reason to force that path? |
@MylesBorins Totally agree with you on elegant infrastructure point. That's reasonable. I'll change the PR a bit so that it "just works" with staging. :] I wasn't aware of the opportunity i just mentioned.
Quite frankly, that's a good point I didn't question yet. |
e34f476
to
9b0e891
Compare
I agree with @MylesBorins assessment on the |
PTAL @ollelauribostrom @sagirk @MylesBorins Can you please check staging |
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, lets get this merged and we can adress some of the above discussions later on. Would be great if you could run yarn run tslint -p ./tsconfig.json
and fix a few lint issues before merging this 🙂
Argh! I messed up my tslint config while working on prettier integration. That explains why they slipped my attention :] |
So one thing to consider here I wasn't thinking about last night. If we get
rid of the learn slug we will be breaking any links people have made to the
site. Perhaps we don't care... But we should be intentional about that
…On Tue, Mar 5, 2019, 5:29 AM Onur Laru ***@***.***> wrote:
Argh! I messed up my tslint config while working on prettier integration.
That explains why they slipped my attention :]
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#157 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAecVzOKvqXClcz6S8J3Mu8Yw0uNCWZyks5vTkcJgaJpZM4bZKri>
.
|
@MylesBorins we can handle that with a redirect file, not sure how it works with GCP, but for Netlify it's just a simple netlify.toml file with old to new link mapping with 301 status. Without breaking any links. |
@MylesBorins I googled before I removed the rewrites. There are 2-3 links shared with |
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.
Looks good, @LaRuaNa! 🎉
A few observations below (mostly nits; fixes are tiny, but no worries if we want to take care of these on a follow-up PR).
|
||
return ( | ||
<Layout title={title} description={description}> | ||
<Hero title={title} /> | ||
<Navigation sections={navigationSections} /> |
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.
+1 to retaining the navigation.
The 404 page content being boxed into the navigation area looks weird design-wise on larger screens (i.e., too much whitespace on the right).
This is caused due to the layout grid. As a hacky stopgap measure, adding an empty div in place of <Navigation>
fixes it
- <Navigation sections={navigationSections} />
+ <div />
On the other hand, if we don't keep the navigation, we need to tweak the text accordingly.
- The page you're trying to access does not exist. Go back to the Homepage or find what you're looking for in the menu.
+ The page you're trying to access does not exist. Go back to the Homepage.
However, this PR has been running for long. As suggested by @LaRuaNa, we can take care of these concerns on a follow-up PR.
parent: { relativePath }, | ||
} = node; | ||
|
||
let previousNodeData = undefined; |
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.
nit: Can we initialize it with null
instead of undefined
. That way, the intent is more explicit — assigning a deliberate non-value.
let previousNodeData = null; //null - deliberate non-value
Or if we need it to be initialized with undefined
, we can just leave it uninitialized.
let previousNodeData; //undefined - unintentional value
+same throughout.
This PR has been open for a while now. And, #172, #168, #166 and #97 are, in fact, waiting on it to be landed. Since it looks good for the most part, I'm merging it in its current state. We can spin up #157 (comment), #157 (comment) and #157 (comment) into new issues later. |
#157 (comment): Issue https://github.com/nodejs/nodejs.dev/issues/176 |
Hi all,
happily we improved our codebase in last few days quite a lot! Though all the problems I run into while working on bugs led me to prepare this big refactoring PR. Please take a look and let me know if there is any room for improvements or if you have any concerns about new structure.
PS: Sorry about big PR I needed to approve my approach in most of the cases. After having all the code together I didn’t split them up again. :|
Closes:
#23
#106
#24