Skip to content

Commit a86b364

Browse files
committed
Update sub modal
1 parent 2bc3833 commit a86b364

File tree

1 file changed

+76
-25
lines changed

1 file changed

+76
-25
lines changed

llmstack/client/src/components/SubscriptionUpdateModal.jsx

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import {
1414
Radio,
1515
RadioGroup,
1616
Stack,
17-
Tab,
18-
Tabs,
1917
Typography,
2018
} from "@mui/material";
2119
import { enqueueSnackbar } from "notistack";
@@ -25,7 +23,7 @@ import { axios } from "../data/axios";
2523
const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
2624
const [subscriptionPrices, setSubscriptionPrices] = useState([]);
2725
const [subscription, setSubscription] = useState("");
28-
const [tabValue, setTabValue] = useState(0);
26+
const [tabValue, setTabValue] = useState("0");
2927
const [updateButtonLoading, setUpdateButtonLoading] = useState(false);
3028
const [updateButtonDisabled, setUpdateButtonDisabled] = useState(false);
3129
const [cancelButtonDisabled, setCancelButtonDisabled] = useState(false);
@@ -54,7 +52,11 @@ const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
5452
<Card
5553
component="label"
5654
key={subscriptionPrice.id}
57-
sx={{ width: "150px", height: "150px" }}
55+
sx={{
56+
boxShadow: "none",
57+
border: "solid 1px #ddd",
58+
borderRadius: "8px",
59+
}}
5860
>
5961
<CardHeader
6062
title={subscriptionPrice.product_name}
@@ -64,14 +66,20 @@ const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
6466
<CardContent>
6567
<Stack>
6668
{subscriptionPrice.recurring_interval && (
67-
<Typography variant="h5" sx={{ textAlign: "center" }}>
69+
<Typography
70+
variant="h5"
71+
sx={{ textAlign: "center", color: "#666" }}
72+
>
6873
${subscriptionPrice.unit_amount}
6974
{isSubscription ? " / " : null}
7075
{subscriptionPrice.recurring_interval}
7176
</Typography>
7277
)}
7378
{!subscriptionPrice.recurring_interval && (
74-
<Typography variant="body2" sx={{ textAlign: "center" }}>
79+
<Typography
80+
variant="body2"
81+
sx={{ textAlign: "center", color: "#666" }}
82+
>
7583
{subscriptionPrice.description} at $
7684
<b>{subscriptionPrice.unit_amount} </b>
7785
</Typography>
@@ -90,12 +98,31 @@ const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
9098
</CardContent>
9199
</Card>
92100
));
101+
const defaultMobileTabStyle = {
102+
backgroundColor: "gray.main",
103+
color: "black",
104+
width: "50%",
105+
106+
"&:hover": {
107+
backgroundColor: "gray.main",
108+
},
109+
};
110+
111+
const selectedMobileTabStyle = {
112+
backgroundColor: "corral.main",
113+
color: "white",
114+
width: "50%",
115+
116+
"&:hover": {
117+
backgroundColor: "corral.dark",
118+
},
119+
};
93120

94121
return (
95122
<Dialog open={open} onClose={handleCloseCb} fullWidth>
96123
<DialogTitle>Manage Subscription</DialogTitle>
97124
<DialogContent>
98-
<Typography variant="body1">
125+
<Typography variant="body1" sx={{ color: "#666" }}>
99126
Please pick an option that suits you best. For more details, please
100127
visit our{" "}
101128
<a
@@ -117,24 +144,48 @@ const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
117144
row
118145
sx={{ gap: 4 }}
119146
>
120-
<Stack spacing={2}>
121-
<Tabs
122-
value={tabValue}
123-
onChange={(e, newValue) => setTabValue(newValue)}
147+
<Stack
148+
sx={{
149+
display: "flex",
150+
width: "100%",
151+
padding: "8px 0",
152+
flexDirection: "row",
153+
justifyContent: "center",
154+
gap: 2,
155+
height: "40px",
156+
}}
157+
>
158+
<Button
159+
variant="contained"
160+
size="small"
161+
sx={
162+
tabValue === "0"
163+
? selectedMobileTabStyle
164+
: defaultMobileTabStyle
165+
}
166+
onClick={() => setTabValue("0")}
167+
id="credits-tab"
168+
aria-controls="credits-tabpanel"
124169
>
125-
<Tab
126-
label="Buy credits"
127-
id="credits-tab"
128-
aria-controls="credits-tabpanel"
129-
/>
130-
<Tab
131-
label="Subscription"
132-
id="subscription-tab"
133-
aria-controls="subscription-tabpanel"
134-
/>
135-
</Tabs>
136-
137-
{tabValue === 0 && (
170+
Buy Credits
171+
</Button>
172+
<Button
173+
variant="contained"
174+
size="small"
175+
sx={
176+
tabValue === "1"
177+
? selectedMobileTabStyle
178+
: defaultMobileTabStyle
179+
}
180+
onClick={() => setTabValue("1")}
181+
id="subscription-tab"
182+
aria-controls="subscription-tabpanel"
183+
>
184+
Subscription
185+
</Button>
186+
</Stack>
187+
<Stack spacing={2}>
188+
{tabValue === "0" && (
138189
<Box
139190
id="credits-tabpanel"
140191
aria-labelledby="credits-tab"
@@ -144,7 +195,7 @@ const SubscriptionUpdateModal = ({ open, handleCloseCb }) => {
144195
{getPriceCards(false)}
145196
</Box>
146197
)}
147-
{tabValue === 1 && (
198+
{tabValue === "1" && (
148199
<Box
149200
id="subscription-tabpanel"
150201
aria-labelledby="subscription-tab"

0 commit comments

Comments
 (0)