Fixed formatting issues
This commit is contained in:
parent
74bab48749
commit
f2f316968b
4 changed files with 21 additions and 14 deletions
|
@ -4,7 +4,6 @@ import Lbryio from 'lbryio';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
import type { Subscription } from 'redux/reducers/subscriptions';
|
import type { Subscription } from 'redux/reducers/subscriptions';
|
||||||
|
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
mixpanel.init('691723e855cabb9d27a7a79002216967');
|
mixpanel.init('691723e855cabb9d27a7a79002216967');
|
||||||
} else {
|
} else {
|
||||||
|
@ -16,8 +15,8 @@ type Analytics = {
|
||||||
setUser: Object => void,
|
setUser: Object => void,
|
||||||
toggle: (boolean, ?boolean) => void,
|
toggle: (boolean, ?boolean) => void,
|
||||||
apiLogView: (string, string, string) => void,
|
apiLogView: (string, string, string) => void,
|
||||||
apiLogSubscribe: (Subscription) => void,
|
apiLogSubscribe: Subscription => void,
|
||||||
apiLogUnsubscribe: (Subscription) => void,
|
apiLogUnsubscribe: Subscription => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
let analyticsEnabled: boolean = false;
|
let analyticsEnabled: boolean = false;
|
||||||
|
@ -60,14 +59,14 @@ const analytics: Analytics = {
|
||||||
apiLogSubscribe: (subscription: Subscription): void => {
|
apiLogSubscribe: (subscription: Subscription): void => {
|
||||||
if (analyticsEnabled) {
|
if (analyticsEnabled) {
|
||||||
Lbryio.call('subscription', 'new', {
|
Lbryio.call('subscription', 'new', {
|
||||||
subscription
|
subscription,
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
apiLogUnsubscribe: (subscription: Subscription): void => {
|
apiLogUnsubscribe: (subscription: Subscription): void => {
|
||||||
if (analyticsEnabled) {
|
if (analyticsEnabled) {
|
||||||
Lbryio.call('subscription', 'delete', {
|
Lbryio.call('subscription', 'delete', {
|
||||||
subscription
|
subscription,
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,14 @@ import React from 'react';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import * as modals from 'constants/modal_types';
|
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 =
|
const isSubscribed =
|
||||||
subscriptions.map(subscription => subscription.channelName).indexOf(channelName) !== -1;
|
subscriptions.map(subscription => subscription.channelName).indexOf(channelName) !== -1;
|
||||||
|
|
||||||
|
@ -17,15 +24,14 @@ export default ({ channelName, uri, subscriptions, doChannelSubscribe, doChannel
|
||||||
button={isSubscribed ? 'alt' : 'primary'}
|
button={isSubscribed ? 'alt' : 'primary'}
|
||||||
label={subscriptionLabel}
|
label={subscriptionLabel}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if(!subscriptions.length) {
|
if (!subscriptions.length) {
|
||||||
doOpenModal(modals.FIRST_SUBSCRIPTION);
|
doOpenModal(modals.FIRST_SUBSCRIPTION);
|
||||||
}
|
}
|
||||||
subscriptionHandler({
|
subscriptionHandler({
|
||||||
channelName,
|
channelName,
|
||||||
uri,
|
uri,
|
||||||
})
|
});
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
|
@ -10,10 +10,12 @@ const ModalFirstSubscription = props => {
|
||||||
<section>
|
<section>
|
||||||
<h3 className="modal__header">{__('Your first subscription!')}</h3>
|
<h3 className="modal__header">{__('Your first subscription!')}</h3>
|
||||||
<p>
|
<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>
|
</p>
|
||||||
<div className="modal__buttons">
|
<div className="modal__buttons">
|
||||||
<Link button="primary" onClick={closeModal} label={__("Got it")} />
|
<Link button="primary" onClick={closeModal} label={__('Got it')} />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const doChannelSubscribe = (subscription: Subscription) => (dispatch: Dis
|
||||||
analytics.apiLogSubscribe(subscription);
|
analytics.apiLogSubscribe(subscription);
|
||||||
|
|
||||||
dispatch(doCheckSubscription(subscription, true));
|
dispatch(doCheckSubscription(subscription, true));
|
||||||
}
|
};
|
||||||
|
|
||||||
export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: Dispatch) => {
|
export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: Dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -28,7 +28,7 @@ export const doChannelUnsubscribe = (subscription: Subscription) => (dispatch: D
|
||||||
});
|
});
|
||||||
|
|
||||||
analytics.apiLogUnsubscribe(subscription);
|
analytics.apiLogUnsubscribe(subscription);
|
||||||
}
|
};
|
||||||
|
|
||||||
export const doCheckSubscriptions = () => (
|
export const doCheckSubscriptions = () => (
|
||||||
dispatch: Dispatch,
|
dispatch: Dispatch,
|
||||||
|
|
Loading…
Reference in a new issue