Skip to content

Commit

Permalink
[FILES] Subscription tab update (#1476)
Browse files Browse the repository at this point in the history
* Update copy and fix layout

* lingui extract

* make eslint :D

Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
FSM1 and actions-user authored Aug 30, 2021
1 parent 67b9446 commit 0795b57
Show file tree
Hide file tree
Showing 17 changed files with 178 additions and 213 deletions.

This file was deleted.

This file was deleted.

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
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ const CurrentProduct: React.FC = () => {
{storageSummary &&
<div className={classes.container}>
<div className={classes.storageBox}>
<Typography
variant="h3"
component="h3"
className={clsx(classes.margins)}
>
<Trans>Subscription Plan</Trans>
</Typography>
<Typography
variant="h4"
component="h4"
Expand Down
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
21 changes: 10 additions & 11 deletions packages/files-ui/src/Components/Modules/Settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useMemo } from "react"
import Profile from "./Profile"
import ProfileTab from "./ProfileTab"
import { Tabs as TabsOrigin,
TabPane as TabPaneOrigin,
Typography, Divider,
Expand All @@ -16,10 +16,11 @@ import { Tabs as TabsOrigin,
import { makeStyles, ITheme, createStyles, useThemeSwitcher } from "@chainsafe/common-theme"
import { ROUTE_LINKS, SettingsPath } from "../../FilesRoutes"
import { t, Trans } from "@lingui/macro"
import SubscriptionPlan from "./SubscriptionPlan"
import SubscriptionTab from "./SubscriptionTab"
import { ProfileIcon } from "@chainsafe/common-components"
import clsx from "clsx"
import Security from "./Security"
import SecurityTab from "./SecurityTab"

const Tabs = (props: ITabsProps<SettingsPath>) => TabsOrigin(props)
const TabPane = (props: ITabPaneProps<SettingsPath>) => TabPaneOrigin(props)
const useStyles = makeStyles(({ constants, breakpoints, palette }: ITheme) =>
Expand Down Expand Up @@ -67,15 +68,12 @@ const useStyles = makeStyles(({ constants, breakpoints, palette }: ITheme) =>
tabPane: {
flex: 1,
padding: `${constants.generalUnit * 4}px ${constants.generalUnit * 4}px`,
"&.securityPane": {
"&.fullWidthTab": {
[breakpoints.down("lg")]: {
paddingLeft: constants.generalUnit,
paddingRight: constants.generalUnit
}
},
[breakpoints.down("md")]: {
padding: `${constants.generalUnit * 2}px`
},
[breakpoints.down("md")]: {
padding: `${constants.generalUnit * 2}px 0`
}
Expand Down Expand Up @@ -189,25 +187,26 @@ const Settings: React.FC = () => {
tabKey="profile"
testId="profile-tab"
>
<Profile />
<ProfileTab />
</TabPane>
<TabPane
className={clsx(classes.tabPane, "securityPane", (!desktop && !path) ? classes.hideTabPane : "")}
className={clsx(classes.tabPane, "fullWidthTab", (!desktop && !path) ? classes.hideTabPane : "")}
icon={<LockIcon className={classes.lockIcon}/>}
iconRight={<CaretRightIcon/>}
title={t`Security`}
tabKey="security"
testId="security-tab"
>
<Security />
<SecurityTab />
</TabPane>
<TabPane
className={clsx(classes.tabPane, "fullWidthTab", (!desktop && !path) ? classes.hideTabPane : "")}
title={t`Subscription Plan`}
tabKey="plan"
icon={<SubscriptionPlanIcon className={classes.lockIcon} />}
iconRight={<CaretRightIcon/>}
>
<SubscriptionPlan />
<SubscriptionTab />
</TabPane>
</Tabs>
</div>
Expand Down
30 changes: 12 additions & 18 deletions packages/files-ui/src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ msgstr "Konto"
msgid "Add Card"
msgstr ""

#~ msgid "Add a card"
#~ msgstr ""

msgid "Add a credit card"
msgstr ""

Expand Down Expand Up @@ -58,9 +55,6 @@ msgstr "Genehmigen"
msgid "Are we on the right track? Let us know in less than 1 minute."
msgstr "Sind wir auf dem richtigen Weg? Sagen Sie es uns in weniger als 1 Minute."

msgid "Back"
msgstr ""

msgid "Back to plan settings"
msgstr ""

Expand Down Expand Up @@ -181,6 +175,9 @@ msgstr ""
msgid "Create folder"
msgstr "Ordner erstellen"

msgid "Credit card on file"
msgstr ""

msgid "Dark Theme"
msgstr "Dunkles Farbschema"

Expand Down Expand Up @@ -244,15 +241,6 @@ msgstr "Geben Sie das Passwort ein:"
msgid "Enter the verification code:"
msgstr "Geben Sie den Verifizierungscode ein:"

msgid "Error while creating new shared folder"
msgstr ""

msgid "Error while downloading {0}"
msgstr ""

msgid "Error while uploading {0}"
msgstr ""

msgid "Failed to get signature"
msgstr "Signatur kann nicht abgerufen werden"

Expand Down Expand Up @@ -421,6 +409,9 @@ msgstr "Nächste"
msgid "Nice to see you again!"
msgstr "Schön, Sie wiederzusehen!"

msgid "No Card"
msgstr ""

msgid "No file to download."
msgstr ""

Expand Down Expand Up @@ -478,6 +469,9 @@ msgstr "Passwort:"
msgid "Passwords must match"
msgstr "Passwörter müssen übereinstimmen"

msgid "Payment and Subscriptions"
msgstr ""

msgid "Please enter a file name"
msgstr "Bitte geben Sie einen Dateinamen ein"

Expand Down Expand Up @@ -652,9 +646,6 @@ msgstr "Größe"
msgid "Social Sign-in Wallet"
msgstr ""

#~ msgid "Something went wrong"
#~ msgstr ""

msgid "Something went wrong with email login! Please try again."
msgstr ""

Expand Down Expand Up @@ -745,6 +736,9 @@ msgstr ""
msgid "Update"
msgstr "Aktualisieren"

msgid "Update Card"
msgstr ""

msgid "Update Shared Folder"
msgstr ""

Expand Down
Loading

0 comments on commit 0795b57

Please sign in to comment.