Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit df78c67

Browse files
author
Sash
authored
Merge pull request #1 from easteregg/platform-os
os detect download links
2 parents 4bad133 + 08ed5f0 commit df78c67

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/javascript/static/pages/platforms.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const isIndonesia = require('../../app/common/country_base').isIndonesia;
33
const getElementById = require('../../_common/common_functions').getElementById;
44
const TabSelector = require('../../_common/tab_selector');
55
const isBinaryApp = require('../../config').isBinaryApp;
6+
const { OSDetect } = require('../../_common/os_detect')
67

78
const os_list = [
89
{
@@ -47,6 +48,18 @@ const Platforms = (() => {
4748
.then(gridapp => {
4849
$('.download-grid-app').attr('href', `https://grid.binary.me/download/${gridapp.name}`);
4950
});
51+
const os = OSDetect();
52+
const desktop_button = document.querySelector('.desktop-download-grid-app');
53+
const android_app = document.querySelector('.android-download-grid-app');
54+
if (os === 'ios') {
55+
const ios_message = document.querySelector('.ios-download-grid-app');
56+
ios_message.classList.remove('invisible');
57+
desktop_button.classList.add('invisible');
58+
android_app.classList.add('invisible');
59+
} else if (os === 'android') {
60+
desktop_button.classList.add('invisible');
61+
}
62+
5063
};
5164

5265
return {

src/templates/static/platforms.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,11 @@ const PlatformsGridApp = ({
6363
<div className='gr-row'>
6464
<div className='gr-12'>
6565
<p>
66-
<a className='button-secondary download-grid-app'><span>{it.L('Download for Android')}</span></a>
66+
<a className='button-secondary android-download-grid-app download-grid-app'><span>{it.L('Download for Android')}</span></a>
67+
<span className='ios-download-grid-app invisible'>{it.L('iOS coming soon')}</span>
6768
<span className='divider-sm' />
6869
{ url &&
69-
<a className='button-secondary mobile-hide' href={url} target={target || undefined} rel={/http/.test(url) ? 'noopener noreferrer' : undefined}><span>{button_text}</span></a>
70+
<a className='desktop-download-grid-app button-secondary mobile-hide' href={url} target={target || undefined} rel={/http/.test(url) ? 'noopener noreferrer' : undefined}><span>{button_text}</span></a>
7071
}
7172
</p>
7273
</div>

0 commit comments

Comments
 (0)