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

Commit

Permalink
Fix follow button
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbainter committed Mar 19, 2019
1 parent 33dc1bb commit e5fd636
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 53 deletions.
19 changes: 19 additions & 0 deletions index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@
return t;
})(document, 'script', 'twitter-wjs');
</script>
<script>
window.twttr = (function(d, s, id) {
var js,
fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = 'https://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);

t._e = [];
t.ready = function(f) {
t._e.push(f);
};

return t;
})(document, 'script', 'twitter-wjs');
</script>
<meta charset="utf-8" />
<meta name="description" content="Endlessly unique ambient music" />
<meta name="author" content="Alex Bainter" />
Expand Down
8 changes: 8 additions & 0 deletions src/components/app/about-tab/about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@
margin-right: 0.5em;
}
}

.follow-btn {
display: none;

&--rendered {
display: inline;
}
}
}
35 changes: 16 additions & 19 deletions src/components/app/about-tab/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import React, { useEffect } from 'react';
import propTypes from 'prop-types';
import { applyUpdate } from 'offline-plugin/runtime';
import './about.scss';
Expand All @@ -11,23 +11,13 @@ const handleUpdateClick = e => {
};

const AboutTabComponent = ({ version, isUpdateAvailable, isOnline }) => {
const followBtnRef = useRef(null);
useEffect(
() => {
if (window.twttr && followBtnRef.current) {
window.twttr.ready(twttr => {
twttr.widgets.createFollowButton(
'alex_bainter',
followBtnRef.current,
{ showCount: false }
);
});
}
},
window.twttr,
followBtnRef.current
);

useEffect(() => {
if (window.twttr) {
window.twttr.ready(twttr => {
twttr.widgets.load();
});
}
}, [window.twttr]);
return (
<div className="about-tab info-tab">
{isUpdateAvailable && isOnline && (
Expand Down Expand Up @@ -63,7 +53,14 @@ const AboutTabComponent = ({ version, isUpdateAvailable, isOnline }) => {
</a>
</p>
<p>
Follow on Twitter for app news and updates: <span ref={followBtnRef} />
<a
href="https://twitter.com/alex_bainter?ref_src=twsrc%5Etfw"
className="twitter-follow-button"
data-show-count="false"
>
Follow @alex_bainter
</a>{' '}
on Twitter for app news and updates.{' '}
</p>
<br />
<p>{`v${version}`}</p>
Expand Down
66 changes: 32 additions & 34 deletions src/components/app/help-tab/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,42 @@ const HelpTabComponent = () => (
This might be resolved in a future update.
</p>
<h2 className="help-tab__topic">The audio pops, crackles, or snaps</h2>
<p>
Here's some steps you can try:
<ol>
{!isMobile && (
<li>
Try turning the site volume down and using your computer's volume
instead.
</li>
)}
{isMobile && (
<li>
If you're using external speakers, try turning your device's volume
down and using your speakers' volume instead.
</li>
)}
Here's some steps you can try:
<ol>
{!isMobile && (
<li>
Try listening to the pieces towards the end of the list. Some pieces
play better than others.
Try turning the site volume down and using your computer's volume
instead.
</li>
)}
{isMobile && (
<li>
Try using a more powerful device
{isMobile && ', like a desktop or laptop'}.
If you're using external speakers, try turning your device's volume
down and using your speakers' volume instead.
</li>
</ol>
You can also report the issue{' '}
<a
href="https://github.com/generative-music/generative.fm/issues/new?title=The%20audio%20sucks&body=Please%20describe%20your%20device%2C%20operating%20system%2C%20and%20internet%20browser..."
target="_blank"
rel="noreferrer noopener"
>
on Github
</a>{' '}
or by sending an email to{' '}
<a href="mailto:[email protected]?Subject=Generative Music sucky audio">
[email protected]
</a>
.
</p>
)}
<li>
Try listening to the pieces towards the end of the list. Some pieces
play better than others.
</li>
<li>
Try using a more powerful device
{isMobile && ', like a desktop or laptop'}.
</li>
</ol>
You can also report the issue{' '}
<a
href="https://github.com/generative-music/generative.fm/issues/new?title=The%20audio%20sucks&body=Please%20describe%20your%20device%2C%20operating%20system%2C%20and%20internet%20browser..."
target="_blank"
rel="noreferrer noopener"
>
on Github
</a>{' '}
or by sending an email to{' '}
<a href="mailto:[email protected]?Subject=Generative Music sucky audio">
[email protected]
</a>
.
</div>
);

Expand Down

0 comments on commit e5fd636

Please sign in to comment.