lbry-desktop/ui/modal/modalFirstSubscription/view.jsx

73 lines
2 KiB
React
Raw Normal View History

2018-09-26 19:48:07 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
2019-11-18 22:57:03 +01:00
import * as PAGES from 'constants/pages';
import Card from 'component/common/card';
2018-09-26 19:48:07 +02:00
type Props = {
closeModal: () => void,
2019-11-18 22:57:03 +01:00
accessToken: string,
user: any,
doAuth: () => void,
history: { push: string => void },
location: UrlLocation,
2018-09-26 19:48:07 +02:00
};
const ModalFirstSubscription = (props: Props) => {
2019-11-18 22:57:03 +01:00
const {
closeModal,
accessToken,
user,
history,
location: { pathname },
} = props;
const title = __('You Followed Your First Channel!');
return (
<Modal type="card" isOpen contentLabel={title}>
<Card
title={title}
subtitle={
<>
{__('Awesome! You just followed your first channel.')}{' '}
{user && user.primary_email
? __('You will receive notifications related to new content.')
: __('Sign in with lbry.tv to receive notifications about new content.')}
</>
}
actions={
<div className="section__actions">
<Button button="primary" onClick={closeModal} label={__('Got it')} />
2019-11-19 22:59:29 +01:00
<React.Fragment>
{user && user.primary_email ? (
<React.Fragment>
<Button
button="link"
href={`https://lbry.com/list/edit/${accessToken}`}
label={__('Update email preferences')}
/>
</React.Fragment>
) : (
<React.Fragment>
<Button
button="link"
onClick={() => {
closeModal();
history.push(`/$/${PAGES.AUTH}?redirect=${pathname}`);
}}
label={__('Sign in')}
/>
</React.Fragment>
)}
2019-11-19 22:59:29 +01:00
</React.Fragment>
</div>
}
/>
</Modal>
);
};
export default ModalFirstSubscription;