8000 Updated Designs for 404 and Error pages by jonkafton · Pull Request #2337 · mitodl/mit-learn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Updated Designs for 404 and Error pages #2337

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

Merged
merged 4 commits into from
Jul 3, 2025
Merged

Conversation

jonkafton
Copy link
Contributor

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/7725

Description (What does it do?)

Updates the error page template to reflect the designs in Figma.

Screenshots (if appropriate):

Desktop Mobile
Screenshot 2025-07-02 at 20 08 36 Screenshot 2025-07-02 at 20 08 50
Screenshot 2025-07-02 at 19 47 42 Screenshot 2025-07-02 at 19 48 04
Screenshot 2025-07-02 at 20 07 42 Screenshot 2025-07-02 at 20 07 58

How can this be tested?

  • The 404 page can be tested by navigating to any non-existent path, e.g. http://open.odl.local:8062/no-find

  • For the forbidden error page, navigate to a restricted route without the necessary permission (check/remove in the admin), e.g. http://open.odl.local:8062/learningpaths without "is_learning_path_editor".

  • The general "Something when wrong" error can be tested by throwing an error anywhere, though it must be during the client render, ie. in a useEffect() or an event handler. There is a global error catch for errors during server render, though Next.js suppresses error detail to prevent leakage to the client, so these are handled differently. For this reason this is ideally tested in production mode as error messages are forwarded during development so there is some inconsistent behavior.

@jonkafton jonkafton added the Needs Review An open Pull Request that is ready for review label Jul 2, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this called three_quarter_half ? (I'm guessing it just came from figma? But curious if you know...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the filename in the brand assets https://brand.mit.edu/logos-marks/tim-beaver - half a body and turned three quarters!

Copy link
Contributor
@ChristopherChudzicki ChristopherChudzicki left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 103 to 105
<Button variant="primary" href={HOME}>
Home
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: Here and elsewhere, maybe we should do <Button Component="a" ... >. I don't think it matters much, but probably not a bad idea to full reload on errors so as to clear state. What do you think?

I had kind of a strange encounter with the Home button: I made the homepage throw an error (after some interaction), then I got the error page, but "Home" didn't do anything, since I was already on the home page... Switching to "a" would force a reload.

What I actually did was... I added

  const [_err, throwError] = React.useState<Error | null>(null)
  useEffect(() => {
    if (window) {
      // @ts-expect-error woof
      window.throwHomepageError = (err: unknown) => {
        throwError(() => {
          throw err
        })
      }
    }
  })

to the homepage, then:

  1. Navigate to homepage, all looks good.
  2. in browser console throwHomepageError(new Error('error').
  3. now I see error page
  4. but clicking "Home" doesn't do anything.

Again...that's pretty artificial. A fullpage reload only helps in this case because the error was thrown during render but AFTER some user interaction. If the error throws on first render, then even a full reload won't help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, agree - better to reload. The error is caught, but may interfere with client navigation.

@jonkafton jonkafton merged commit 022105e into main Jul 3, 2025
13 checks passed
@jonkafton jonkafton deleted the jk/error-page-designs branch July 3, 2025 20:10
@odlbot odlbot mentioned this pull request Jul 9, 2025
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review An open Pull Request that is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0