Skip to content

Commit 5f7998e

Browse files
authored
Update index.js
Signed-off-by: Naman Verma <149177973+Namanv0509@users.noreply.github.com>
1 parent bdcbb30 commit 5f7998e

1 file changed

Lines changed: 22 additions & 90 deletions

File tree

src/components/PricingAddons/index.js

Lines changed: 22 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -223,105 +223,37 @@ export const PricingAddons = ({ isYearly = false }) => {
223223
{/* Quantity Slider */}
224224
<Box>
225225
<Box sx={{ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }}>
226-
<Typography variant="h6" fontWeight="600">
227-
Quantity:{" "}
228-
{selectedAddon.id === "academy"
229-
? selectedAddon.learnerOptions[quantityIndex].learners === 1001
230-
? "1,000+"
231-
: selectedAddon.learnerOptions[quantityIndex].learners
232-
: quantityIndex}{" "}
233-
{selectedAddon.unitLabel}
226+
<Typography variant="h6" fontWeight="600" sx={{ fontSize: "1.1rem" }}>
227+
Quantity: {quantity} {selectedAddon.unitLabel}
234228
</Typography>
235229
<Chip
236-
label={formatPrice(totalPrice)}
230+
label={formatPrice((isYearly ? selectedAddon.yearlyPrice : selectedAddon.basePrice) * quantity)}
237231
color="primary"
238232
variant="outlined"
239-
sx={{
240-
fontWeight: "bold",
241-
fontSize: "0.9rem",
242-
transition: "all 0.3s ease-in-out",
243-
}}
233+
sx={{ fontWeight: "bold", fontSize: "0.9rem" }}
244234
/>
245235
</Box>
246236

247237
<Box sx={{ px: 1 }}>
248-
{selectedAddon.id === "academy" ? (
249-
<Slider
250-
value={quantityIndex}
251-
onChange={handleQuantityChange}
252-
min={0}
253-
max={selectedAddon.learnerOptions.length - 1}
254-
step={null}
255-
marks={selectedAddon.learnerOptions.map((option, index) => ({
256-
value: index,
257-
}))}
258-
valueLabelDisplay="auto"
259-
valueLabelFormat={(value) => {
260-
const option = selectedAddon.learnerOptions[value];
261-
const learners = option.learners === 1001 ? 1001 : option.learners;
262-
const basePrice = learners === 0 ? option.monthlyPerUser : learners * option.monthlyPerUser;
263-
const price = labLearners ? basePrice * 2 : basePrice;
264-
return `${option.learners === 1001 ? "1,000+" : option.learners} (${formatPrice(price)})`;
265-
}}
266-
sx={{
267-
color: "primary.main",
268-
"& .MuiSlider-markLabel": {
269-
color: "text.primary",
270-
},
271-
"& .MuiSlider-thumb": {
272-
width: 20,
273-
height: 20,
274-
"&:hover, &.Mui-focusVisible": {
275-
boxShadow: "0 0 0 8px rgba(0, 179, 159, 0.16)",
276-
},
277-
},
278-
"& .MuiSlider-rail": {
279-
opacity: 0.3,
280-
},
281-
"& .MuiSlider-track": {
282-
border: "none",
283-
},
284-
}}
285-
aria-label="Number of theory learners for Academy add-on"
238+
<Slider
239+
value={quantityIndex}
240+
onChange={(event, newValue) => setQuantityIndex(newValue)}
241+
min={0}
242+
max={learnerOptions.length - 1}
243+
step={null}
244+
marks={learnerOptions.map((option, index) => ({
245+
value: index,
246+
label: option.learners === 1000 ? "1,000+" : option.learners,
247+
}))}
286248
/>
287-
) : (
288-
<Slider
289-
value={quantityIndex}
290-
onChange={handleQuantityChange}
291-
min={1}
292-
max={selectedAddon.maxUnits}
293-
step={1}
294-
valueLabelDisplay="auto"
295-
valueLabelFormat={(value) => `${value} (${formatPrice(selectedAddon.basePrice * value)})`}
296-
sx={{
297-
color: "primary.main",
298-
"& .MuiSlider-thumb": {
299-
width: 20,
300-
height: 20,
301-
"&:hover, &.Mui-focusVisible": {
302-
boxShadow: "0 0 0 8px rgba(0, 179, 159, 0.16)",
303-
},
304-
},
305-
"& .MuiSlider-rail": {
306-
opacity: 0.3,
307-
},
308-
"& .MuiSlider-track": {
309-
border: "none",
310-
},
311-
mb: 2,
312-
}}
313-
/>
314-
)}
315-
{selectedAddon.id !== "academy" && (
316-
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
317-
<Typography variant="body2" color="text.secondary">
318-
1
319-
</Typography>
320-
<Typography variant="body2" color="text.secondary">
321-
{selectedAddon.maxUnits}
322-
</Typography>
323-
</Box>
324-
)}
249+
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
250+
<Typography variant="body2" color="text.secondary">
251+
1
252+
</Typography>
253+
<Typography variant="body2" color="text.secondary">
254+
{selectedAddon.maxUnits}
255+
</Typography>
256+
</Box>
325257
</Box>
326258
</Box>
327259

0 commit comments

Comments
 (0)