-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FILES] Subscription tab update (#1476)
* Update copy and fix layout * lingui extract * make eslint :D Co-authored-by: GitHub Actions <actions@github.com>
- Loading branch information
1 parent
67b9446
commit 0795b57
Showing
17 changed files
with
178 additions
and
213 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 0 additions & 59 deletions
59
packages/files-ui/src/Components/Modules/Settings/SubscriptionPlan/CurrentCard.tsx
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
packages/files-ui/src/Components/Modules/Settings/SubscriptionPlan/index.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/CurrentCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React, { useState } from "react" | ||
import { Typography, CreditCardIcon, Button } from "@chainsafe/common-components" | ||
import { makeStyles, ITheme, createStyles } from "@chainsafe/common-theme" | ||
import { Trans } from "@lingui/macro" | ||
import { useBilling } from "../../../../Contexts/BillingContext" | ||
import AddCardModal from "./AddCardModal" | ||
|
||
const useStyles = makeStyles(({ constants, palette }: ITheme) => | ||
createStyles({ | ||
container: { | ||
margin: `${constants.generalUnit * 3}px ${constants.generalUnit * 4}px` | ||
}, | ||
noCard: { | ||
margin: `${constants.generalUnit * 2}px 0` | ||
}, | ||
cardDetailsContainer: { | ||
display: "flex", | ||
margin: `${constants.generalUnit * 2}px 0` | ||
}, | ||
creditCardIcon: { | ||
marginRight: constants.generalUnit, | ||
fill: palette.additional["gray"][9] | ||
} | ||
}) | ||
) | ||
|
||
const CurrentCard: React.FC = () => { | ||
const classes = useStyles() | ||
const [isAddCardModalOpen, setIsAddCardModalOpen ] = useState(false) | ||
const { defaultCard } = useBilling() | ||
|
||
return ( | ||
<> | ||
<div className={classes.container}> | ||
<div> | ||
<Typography | ||
variant="h4" | ||
component="h4" | ||
> | ||
<Trans>Credit card on file</Trans> | ||
</Typography> | ||
</div> | ||
{defaultCard | ||
? <div className={classes.cardDetailsContainer}> | ||
<CreditCardIcon className={classes.creditCardIcon} /> | ||
<Typography> | ||
•••• •••• •••• {defaultCard.last_four_digit} | ||
</Typography> | ||
</div> | ||
: <Typography | ||
component="p" | ||
variant="body1" | ||
className={classes.noCard} | ||
> | ||
<Trans>No Card</Trans> | ||
</Typography> | ||
} | ||
<Button onClick={() => setIsAddCardModalOpen(true)}> | ||
{defaultCard | ||
? <Trans>Update Card</Trans> | ||
: <Trans>Add Card</Trans> | ||
} | ||
</Button> | ||
</div> | ||
<AddCardModal | ||
isModalOpen={isAddCardModalOpen} | ||
onClose={() => setIsAddCardModalOpen(false)} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export default CurrentCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/files-ui/src/Components/Modules/Settings/SubscriptionTab/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react" | ||
import CurrentProduct from "./CurrentProduct" | ||
import CurrentCard from "./CurrentCard" | ||
import { Divider, Typography } from "@chainsafe/common-components" | ||
import { makeStyles, createStyles, ITheme } from "@chainsafe/common-theme" | ||
import { Trans } from "@lingui/macro" | ||
|
||
const useStyles = makeStyles(({ constants }: ITheme) => | ||
createStyles({ | ||
heading: { | ||
marginBottom: constants.generalUnit * 2 | ||
} | ||
}) | ||
) | ||
|
||
const PlanView: React.FC = () => { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<div> | ||
<Typography | ||
variant="h3" | ||
component="h3" | ||
className={classes.heading} | ||
> | ||
<Trans>Payment and Subscriptions</Trans> | ||
</Typography> | ||
<Divider /> | ||
<CurrentProduct /> | ||
<CurrentCard /> | ||
</div> | ||
) | ||
} | ||
|
||
export default PlanView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.