Fixed formatting issues

This commit is contained in:
liamcardenas 2018-03-16 11:26:44 -07:00
parent 74bab48749
commit f2f316968b
4 changed files with 21 additions and 14 deletions

View file

@ -4,7 +4,6 @@ import Lbryio from 'lbryio';
import isDev from 'electron-is-dev';
import type { Subscription } from 'redux/reducers/subscriptions';
if (isDev) {
mixpanel.init('691723e855cabb9d27a7a79002216967');
} else {
@ -16,8 +15,8 @@ type Analytics = {
setUser: Object => void,
toggle: (boolean, ?boolean) => void,
apiLogView: (string, string, string) => void,
apiLogSubscribe: (Subscription) => void,
apiLogUnsubscribe: (Subscription) => void,
apiLogSubscribe: Subscription => void,
apiLogUnsubscribe: Subscription => void,
};
let analyticsEnabled: boolean = false;
@ -60,14 +59,14 @@ const analytics: Analytics = {
apiLogSubscribe: (subscription: Subscription): void => {
if (analyticsEnabled) {
Lbryio.call('subscription', 'new', {
subscription
subscription,
}).catch(() => {});
}
},
apiLogUnsubscribe: (subscription: Subscription): void => {
if (analyticsEnabled) {
Lbryio.call('subscription', 'delete', {
subscription
subscription,
}).catch(() => {});
}
},

View file

@ -2,7 +2,14 @@ import React from 'react';
import Link from 'component/link';
import * as modals from 'constants/modal_types';
export default ({ channelName, uri, subscriptions, doChannelSubscribe, doChannelUnsubscribe, doOpenModal }) => {
export default ({
channelName,
uri,
subscriptions,
doChannelSubscribe,
doChannelUnsubscribe,
doOpenModal,
}) => {
const isSubscribed =
subscriptions.map(subscription => subscription.channelName).indexOf(channelName) !== -1;
@ -17,15 +24,14 @@ export default ({ channelName, uri, subscriptions, doChannelSubscribe, doChannel
button={isSubscribed ? 'alt' : 'primary'}
label={subscriptionLabel}
onClick={() => {
if(!subscriptions.length) {
if (!subscriptions.length) {
doOpenModal(modals.FIRST_SUBSCRIPTION);
}
subscriptionHandler({
channelName,
uri,
})
}
}
});
}}
/>
</div>
) : null;

View file

@ -10,10 +10,12 @@ const ModalFirstSubscription = props => {
<section>
<h3 className="modal__header">{__('Your first subscription!')}</h3>
<p>
{__('When you subscribe to a channel, you will automatically download, and be notified of, all of its new content.')}
{__(
'When you subscribe to a channel, you will automatically download, and be notified of, all of its new content.'
)}
</p>
<div className="modal__buttons">
<Link button="primary" onClick={closeModal} label={__("Got it")} />
<Link button="primary" onClick={closeModal} label={__('Got it')} />
</div>
</section>
</Modal>

View file

@ -19,7 +19,7 @@ export const doChannelSubscribe = (subscription: Subscription) => (dispatch: Dis
analytics.apiLogSubscribe(subscription);
dispatch(doCheckSubscription(subscription, true));
}
};
export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: Dispatch) => {
dispatch({
@ -28,7 +28,7 @@ export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: D
});
analytics.apiLogUnsubscribe(subscription);
}
};
export const doCheckSubscriptions = () => (
dispatch: Dispatch,