Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React, { useEffect } from 'react';
import { SubscribeForm } from 'app/components/SubscribeForm';
import { useOvermind } from 'app/overmind';
import { Card } from './Card';
import { Title, Subheading } from '../elements';
import { Container, CustomSubHeading } from './elements';

export const PaymentInfo: React.FunctionComponent = () => {
const {
state: {
preferences: {
paymentDetailError,
paymentDetails: paymentDetailsFromHooks,
isLoadingPaymentDetails,
},
},
actions: {
preferences: { paymentDetailsRequested, paymentDetailsUpdated },
},
} = useOvermind();
useEffect(() => {
paymentDetailsRequested();
}, [paymentDetailsRequested]);

const updatePaymentDetails = ({ token }) => {
paymentDetailsUpdated({ token });
};

const paymentDetails = () => {
const { last4, name, brand } = paymentDetailsFromHooks;
if (paymentDetailError)
return <div>An error occurred: {paymentDetailError}</div>;

return (
<div>
<Subheading>Current card</Subheading>
<Card last4={last4} name={name} brand={brand} />

<CustomSubHeading>Update card info</CustomSubHeading>
<SubscribeForm
buttonName="Update"
loadingText="Updating Card Info..."
name={name}
subscribe={updatePaymentDetails}
/>
</div>
);
};

return (
<Container>
<Title>Payment Info</Title>
{isLoadingPaymentDetails ? (
<div>Loading payment details...</div>
) : (
paymentDetails()
)}
</Container>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import styled from 'styled-components';
import { Subheading } from '../elements';

export const Container = styled.div`
font-weight: 400;
color: rgba(255, 255, 255, 0.6);
`;

export const CustomSubHeading = styled(Subheading)`
margin-top: 2rem;
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { PaymentInfo } from './PaymentInfo';

export default PaymentInfo;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Appearance } from './Appearance';
import { EditorSettings } from './EditorPageSettings/EditorSettings';
import { PreviewSettings } from './EditorPageSettings/PreviewSettings';
import { CodeFormatting } from './CodeFormatting';
import { PaymentInfo } from './PaymentInfo';
import PaymentInfo from './PaymentInfo';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait does this work? @christianalfoni

import { Integrations } from './Integrations';
import { Badges } from './Badges';
import { Experiments } from './Experiments';
Expand Down