-
Notifications
You must be signed in to change notification settings - Fork 53
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 network connection status to ui and redux #1312
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
20047af
feat: add network connection status to ui and redux
amy-corson-ibigroup 3fcf059
tweak styling and create status region
amy-corson-ibigroup f8141fd
Add status region to mobile
amy-corson-ibigroup 27bd548
consolidate network connection status regions into one
amy-corson-ibigroup c356f57
Merge branch 'dev' into network-connection-banner
amy-corson-ibigroup 9ab8492
French translations for network connection strings
amy-corson-ibigroup 2e495d8
Merge branch 'network-connection-banner' of https://github.com/opentr…
amy-corson-ibigroup 9c7af13
Merge branch 'dev' into network-connection-banner
amy-corson-ibigroup dffa7f8
Merge branch 'dev' into network-connection-banner
amy-corson-ibigroup 0bbb6c0
Update snapshots
amy-corson-ibigroup 8d7ca4a
Merge branch 'dev' into network-connection-banner
amy-corson-ibigroup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { CSSTransition, TransitionGroup } from 'react-transition-group' | ||
import { FormattedMessage } from 'react-intl' | ||
import React, { useRef } from 'react' | ||
import styled from 'styled-components' | ||
|
||
import { RED_ON_WHITE } from '../util/colors' | ||
import InvisibleA11yLabel from '../util/invisible-a11y-label' | ||
|
||
const containerClassname = 'network-connection-banner' | ||
const timeout = 250 | ||
|
||
const TransitionStyles = styled.div` | ||
.${containerClassname} { | ||
background: ${RED_ON_WHITE}; | ||
border-left: 1px solid #e7e7e7; | ||
border-right: 1px solid #e7e7e7; | ||
color: #fff; | ||
font-weight: 600; | ||
padding: 5px; | ||
position: absolute; | ||
text-align: center; | ||
top: 50px; | ||
width: 100%; | ||
// When banner is fully loaded, set z-index higher than nav so we're not seeing the nav border. | ||
z-index: 26; | ||
|
||
@media (max-width: 768px) { | ||
border: 0; | ||
} | ||
} | ||
.${containerClassname}-enter { | ||
opacity: 0; | ||
transform: translateY(-100%); | ||
} | ||
.${containerClassname}-enter-active { | ||
opacity: 1; | ||
transform: translateY(0); | ||
transition: opacity ${timeout}ms ease-in; | ||
} | ||
.${containerClassname}-exit { | ||
opacity: 1; | ||
transform: translateY(0); | ||
z-index: 20; | ||
} | ||
.${containerClassname}-exit-active { | ||
opacity: 0; | ||
transform: translateY(-100%); | ||
transition: opacity ${timeout}ms ease-in, transform ${timeout}ms ease-in; | ||
z-index: 20; | ||
} | ||
` | ||
|
||
export const NetworkConnectionBanner = ({ | ||
networkConnectionLost | ||
}: { | ||
networkConnectionLost: boolean | ||
}): JSX.Element => { | ||
const connectionLostBannerRef = useRef<HTMLDivElement>(null) | ||
return ( | ||
<TransitionStyles> | ||
<InvisibleA11yLabel aria-live="assertive" role="status"> | ||
{networkConnectionLost ? ( | ||
<FormattedMessage id="components.AppMenu.networkConnectionLost" /> | ||
) : ( | ||
<FormattedMessage id="components.AppMenu.networkConnectionRestored" /> | ||
)} | ||
</InvisibleA11yLabel> | ||
<TransitionGroup style={{ display: 'content' }}> | ||
{networkConnectionLost && ( | ||
<CSSTransition | ||
classNames={containerClassname} | ||
nodeRef={connectionLostBannerRef} | ||
timeout={timeout} | ||
> | ||
<div className={containerClassname} ref={connectionLostBannerRef}> | ||
<FormattedMessage id="components.AppMenu.networkConnectionLost" /> | ||
</div> | ||
</CSSTransition> | ||
)} | ||
</TransitionGroup> | ||
</TransitionStyles> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think this is causing the percy tests to fail on mobile nearby view? not sure what else would cause the issues percy has.