Make prettier

new-homepage-design
binwiederhier 2023-01-17 20:21:19 -05:00
parent 4092f7fd51
commit cead305a9a
3 changed files with 47 additions and 35 deletions

View File

@ -41,8 +41,6 @@ import (
- payment methods
- unmarshal to stripe.Subscription instead of gjson
- delete subscription when account deleted
- add tier.visible
- fix tier selection boxes
- delete messages + reserved topics on ResetTier
Limits & rate limiting:

View File

@ -210,6 +210,7 @@
"account_upgrade_dialog_tier_features_attachment_file_size": "{{filesize}} per file",
"account_upgrade_dialog_tier_features_attachment_total_size": "{{totalsize}} total storage",
"account_upgrade_dialog_tier_selected_label": "Selected",
"account_upgrade_dialog_button_cancel": "Cancel",
"account_upgrade_dialog_button_pay_now": "Pay now and subscribe",
"account_upgrade_dialog_button_cancel_subscription": "Cancel subscription",
"account_upgrade_dialog_button_update_subscription": "Update subscription",

View File

@ -20,6 +20,7 @@ import List from "@mui/material/List";
import {Check} from "@mui/icons-material";
import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemText from "@mui/material/ListItemText";
import Box from "@mui/material/Box";
const UpgradeDialog = (props) => {
const { t } = useTranslation();
@ -27,6 +28,7 @@ const UpgradeDialog = (props) => {
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
const [tiers, setTiers] = useState(null);
const [newTier, setNewTier] = useState(account?.tier?.code); // May be undefined
const [loading, setLoading] = useState(false);
const [errorText, setErrorText] = useState("");
useEffect(() => {
@ -59,8 +61,13 @@ const UpgradeDialog = (props) => {
action = Action.UPDATE;
}
if (loading) {
submitButtonEnabled = false;
}
const handleSubmit = async () => {
try {
setLoading(true);
if (action === Action.CREATE) {
const response = await accountApi.createBillingSubscription(newTier);
window.location.href = response.redirect_url;
@ -76,6 +83,8 @@ const UpgradeDialog = (props) => {
session.resetAndRedirect(routes.login);
}
// FIXME show error
} finally {
setLoading(false);
}
}
@ -118,7 +127,7 @@ const UpgradeDialog = (props) => {
}
</DialogContent>
<DialogFooter status={errorText}>
<Button onClick={props.onCancel}>Cancel</Button>
<Button onClick={props.onCancel}>{t("account_upgrade_dialog_button_cancel")}</Button>
<Button onClick={handleSubmit} disabled={!submitButtonEnabled}>{submitButtonLabel}</Button>
</DialogFooter>
</Dialog>
@ -131,17 +140,19 @@ const TierCard = (props) => {
const tier = props.tier;
return (
<Card sx={{
m: 1,
<Box sx={{
m: "7px",
minWidth: "190px",
maxWidth: "250px",
flexGrow: 1,
flexShrink: 1,
flexBasis: 0,
borderRadius: "3px",
"&:first-child": { ml: 0 },
"&:last-child": { mr: 0 },
...cardStyle
}}>
<Card sx={{ height: "100%" }}>
<CardActionArea sx={{ height: "100%" }}>
<CardContent onClick={props.onClick} sx={{ height: "100%" }}>
{props.selected &&
@ -173,6 +184,8 @@ const TierCard = (props) => {
</CardContent>
</CardActionArea>
</Card>
</Box>
);
}