Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
inform users that only Chrome is currently supported on login screen #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Mar 30, 2017
1 parent 7905d0f commit 23f90e5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ td.pulse-off input {
display: flex;
width: 100%;
height: 100%;
flex-direction: row;
flex-direction: column;
justify-content: center;
align-items: center;
}
Expand Down Expand Up @@ -1024,3 +1024,10 @@ td.pulse-off input {
.progress-leave.slidein-leave-active {
width: 0;
}

.browser-warning {
color: $brand-color-secondary;
padding-top: 10px;
max-width: 300px;
text-align: center;
}
50 changes: 50 additions & 0 deletions src/containers/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,64 @@ class Login extends Component {
}
}

userBrowser = () => {
const isChrome = !!window.chrome && !!window.chrome.webstore;

const isFirefox = typeof InstallTrigger !== 'undefined';

const isSafari = /constructor/i.test(window.HTMLElement) ||
(function (p) { return p.toString() ===
'[object SafariRemoteNotification]'; })(!window['safari'] ||
safari.pushNotification);
const isOpera = (!!window.opr && !!opr.addons) || !!window.opera ||
navigator.userAgent.indexOf(' OPR/') >= 0;

const isIE = /*@cc_on!@*/false || !!document.documentMode; // IE 6-11

const isEdge = !isIE && !!window.StyleMedia;

if(isChrome){
return 'chrome';
} else if(isFirefox){
return 'firefox';
} else if(isSafari) {
return 'safari';
} else if(isOpera) {
return 'opera';
} else if(isIE) {
return 'ie'
} else if(isEdge) {
return 'edge'
}
}

browserSupport = (...supportedBrowsers) => {

const userBrowser = this.userBrowser();
let isSupported = false;

supportedBrowsers.map(browser => {
if(userBrowser === browser){
isSupported = true;
}
});
return isSupported;
}

render() {
const {redirect} = this.props;
const isYourBrowserSupported = this.browserSupport('chrome');
return (
<div>
<div className="login-container">
<LoginForm
redirect={redirect}
/>
{! isYourBrowserSupported &&
<span className="browser-warning">
Your browser might be not fully supported
</span>
}
</div>
</div>
);
Expand Down

0 comments on commit 23f90e5

Please sign in to comment.