60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
|
import React from 'react';
|
||
|
import {Link} from 'react-router';
|
||
|
import ProtocolUtils from '../utils/web/ProtocolUtils';
|
||
|
import i18n from '../i18n';
|
||
|
import {Routes} from '../Constants';
|
||
|
import '../styles/unsupported_browser.styl';
|
||
|
|
||
|
const BROWSERS = [
|
||
|
{id: 'discord', name: i18n.Messages.BROWSER_APP},
|
||
|
{id: 'chrome', name: i18n.Messages.BROWSER_CHROME, url: 'https://www.google.com/chrome/browser/desktop/'},
|
||
|
{id: 'firefox', name: i18n.Messages.BROWSER_FIREFOX, url: 'https://www.mozilla.org/en-US/firefox/new/?scene=2'},
|
||
|
{id: 'opera', name: i18n.Messages.BROWSER_OPERA, url: 'http://www.opera.com/download'},
|
||
|
];
|
||
|
|
||
|
const SupportedBrowser = React.createClass({
|
||
|
render() {
|
||
|
const {id, name, url} = this.props.browser;
|
||
|
let link;
|
||
|
if (url != null) {
|
||
|
link = <a className="btn" href={url} target="_blank">{i18n.Messages.DOWNLOAD}</a>;
|
||
|
} else {
|
||
|
link = <Link className="btn" to={Routes.APPS}>{i18n.Messages.DOWNLOAD}</Link>;
|
||
|
}
|
||
|
return (
|
||
|
<li>
|
||
|
<div className={`browser browser-${id}`} />
|
||
|
<div>{name}</div>
|
||
|
{link}
|
||
|
</li>
|
||
|
);
|
||
|
},
|
||
|
});
|
||
|
|
||
|
const UnsupportedBrowser = React.createClass({
|
||
|
componentDidMount() {
|
||
|
ProtocolUtils.launch('discord://' + this.props.location.pathname, supported => {
|
||
|
console.log('discord://', supported);
|
||
|
});
|
||
|
},
|
||
|
|
||
|
render() {
|
||
|
const browsers = BROWSERS.map(browser => <SupportedBrowser key={browser.id} browser={browser} />);
|
||
|
return (
|
||
|
<div id="unsupported-browser">
|
||
|
<div className="wrap">
|
||
|
<h1>{i18n.Messages.UNSUPPORTED_BROWSER_TITLE}</h1>
|
||
|
<p>{i18n.Messages.UNSUPPORTED_BROWSER_BODY}</p>
|
||
|
<ul>{browsers}</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
);
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export default UnsupportedBrowser;
|
||
|
|
||
|
|
||
|
|
||
|
// WEBPACK FOOTER //
|
||
|
// ./discord_app/components/UnsupportedBrowser.js
|