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: Add banner for when the API is down #254

Open
wants to merge 42 commits into
base: dev
Choose a base branch
from

Conversation

madkarmaa
Copy link
Member

@madkarmaa madkarmaa commented Aug 18, 2024

What's this?

This PR adds the <Banner /> component and some functionality. Originated from issue #191

Screenshots (as of commit 8fa880b)

Level: caution

image

Level: warning

image

Level: info

image

@madkarmaa madkarmaa self-assigned this Aug 18, 2024
@oSumAtrIX
Copy link
Member

Caution should use a different icon & all the colors are too saturated, use the same saturation/contrast as the other colors. The info banner should use the blue highlight color

@oSumAtrIX oSumAtrIX requested review from PalmDevs and Ushie August 18, 2024 17:50
@oSumAtrIX oSumAtrIX changed the title feat: banner implementation feat: Add info, warning and caution banner Aug 18, 2024
@madkarmaa
Copy link
Member Author

madkarmaa commented Aug 18, 2024

Caution should use a different icon

Such as? I've searched for "caution" on svgrepo.com

All the colors are too saturated, use the same saturation/contrast as the other colors

They're just placeholders, I didn't really follow the theme (for now)

The info banner should use the blue highlight color

The text selection color wasn't altered, or are you referring to something else?

@oSumAtrIX
Copy link
Member

They're just placeholders, I didn't really follow the theme (for now)

If the PR isn't ready, mark as a draft

@oSumAtrIX oSumAtrIX marked this pull request as draft August 18, 2024 18:47
@madkarmaa
Copy link
Member Author

above commit ^^^ tested to work with static build

@madkarmaa
Copy link
Member Author

Level: warning

image

Level: caution

image

@madkarmaa madkarmaa requested a review from oSumAtrIX August 19, 2024 14:45
@oSumAtrIX
Copy link
Member

Warning should be orange/yellow tinted

@madkarmaa
Copy link
Member Author

Warning should be orange/yellow tinted

I couldn't find anything that follows the m3 color rules

Copy link
Member

@PalmDevs PalmDevs left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@oSumAtrIX oSumAtrIX left a comment

Choose a reason for hiding this comment

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

When the API is down and the banner is dismissed, does it remember? Because otherwise loading another page or refreshing will cause the banner to show up again.

@oSumAtrIX oSumAtrIX changed the title feat: Add info, warning and caution banner feat: Add banner for when the API is down Aug 25, 2024
src/lib/components/Banner.svelte Show resolved Hide resolved
@Ushie
Copy link
Member

Ushie commented Aug 25, 2024

When the API is down and the banner is dismissed, does it remember? Because otherwise loading another page or refreshing will cause the banner to show up again.

Refreshing the page will show it again, but going to a different page won't, I think that's good behavior because I might come back 5-10m later to check if it's working now

@oSumAtrIX
Copy link
Member

I was thinking of a permanent banner, but not as obtrusive as this one, specifically for the down API. The only reason you would want to dismiss this banner is because it blocks elements. Due to that, the user can not know if the API is up again. If the API down banner can be adjusted so that it appears as a small red strip a the top for example that can not be dismissed, but also does not block any view or space, then this problem would be solved.

The easiest way to achieve this is to add a parameter "permanent" for example. If it is true, the CSS will be used which displays the banner as a slim strip at the top of the site and hides the dismiss button. Other banners such as when used in #195 can set the parameter to false so that the banner overlaps like it currently does and has a dismiss button.

@oSumAtrIX oSumAtrIX linked an issue Aug 25, 2024 that may be closed by this pull request
@madkarmaa
Copy link
Member Author

Refreshing the page will show it again, but going to a different page won't, I think that's good behavior because I might come back 5-10m later to check if it's working now

that's exactly what it does

@madkarmaa
Copy link
Member Author

@oSumAtrIX what's the practical use of a permanent banner when a simple page refresh is gonna bring it back? I don't see any user willing to stay with the website open on their browser until the API is back up again

@oSumAtrIX
Copy link
Member

The practical use is that it does not overlap over any content so the user isn't drawn to dismiss the banner & isn't needed ro refresh the page. If the API is down & the banner is dismissed there's no indication left that the site won't work properly. A permanent small banner at the top prevents that.

Copy link
Member

@Ushie Ushie left a comment

Choose a reason for hiding this comment

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

  • Resolve the navbar not sticking to the top when scrolling
  • Confirm the API outage banner is only displayed when appropriate

@oSumAtrIX oSumAtrIX removed their request for review September 2, 2024 11:19
Copy link
Member

@Ushie Ushie left a comment

Choose a reason for hiding this comment

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

The margin-top changes across pages doesn't consider cases where there is no banner being displayed, perhaps a minor refactor where we wouldn't need magic numbers would be good

@madkarmaa
Copy link
Member Author

@Ushie where exactly?

@oSumAtrIX
Copy link
Member

The issue is a bit difficult to solve. The banner is sticky so we have to simulate a hidden non sticky banner so the content shifts down. I guess what we can do is add the margin to that simulated banner, so when the banner is hidden, the margin is gone too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: API status banner
4 participants