Skip to content

Commit 8b92819

Browse files
Merge pull request #1565 from gustavomm19/fix-docs-redirectioning
Fix docs redirectioning
2 parents a7e5756 + 6bd2a93 commit 8b92819

File tree

20 files changed

+513
-203
lines changed

20 files changed

+513
-203
lines changed

public/locales/en/course.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"create-account-text": "Create an account and start your coding journey today",
1010
"live-bootcamp": "Self-paced bootcamp",
1111
"free-course": "Free Course",
12+
"coupon-bar": {
13+
"headline": "Prices as low as {{discount}} off!!",
14+
"ends-in": "Ends in {{time}}",
15+
"see-prices": "See prices"
16+
},
1217
"title-connectors": {
1318
"learning": "Start learning",
1419
"start": "Start a career in",

public/locales/en/profile.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"payment-trial": "Payment: Trial",
8888
"payment-free": "Payment: Free",
8989
"renewal-date-cancelled": "Renewal date: Cancelled",
90+
"discount": "{{discount}} OFF",
9091
"status": {
9192
"free_trial": "Free trial",
9293
"fully_paid": "Fully paid",

public/locales/en/signup.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"read-more" :"Read the science behind it.",
1313
"read-more-link": "https://4geeks.com/mastering-technical-knowledge"
1414
},
15+
"total": "Total",
16+
"total-now": "Total now",
17+
"after-all-payments": "After all payments",
1518
"secure-checkout": "Guaranteed <strong>safe & secure</strong> checkout",
1619
"discount-value-off": "{{value}} Off",
1720
"add": "Add",
@@ -87,6 +90,8 @@
8790
"one_payment": "One payment",
8891
"many_months_payment": "{{qty}} months payment",
8992
"our_plans": "Our plans",
93+
"discount": "{{discount}} OFF",
94+
"try-again": "Try again",
9095
"join-cohort": {
9196
"cta": {
9297
"lesson": "Join cohort to get access to this lesson",

public/locales/es/course.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"create-account-text": "Crea una cuenta y comienza tu viaje en el bootcamp hoy",
1010
"live-bootcamp": "Bootcamp en vivo",
1111
"free-course": "Curso Gratis",
12+
"coupon-bar": {
13+
"headline": "¡¡Precios tan bajos como {{discount}} de descuento!!",
14+
"ends-in": "Termina en {{time}}",
15+
"see-prices": "Ver precios"
16+
},
1217
"title-connectors": {
1318
"learning": "Comienza a aprender",
1419
"start": "Comienza una carrera en",

public/locales/es/profile.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"payment-trial": "Pago: Prueba",
8888
"payment-free": "Pago: Libre",
8989
"renewal-date-cancelled": "Fecha de renovación: Cancelada",
90+
"discount": "{{discount}} DE DESCUENTO",
9091
"status": {
9192
"free_trial": "Prueba gratuita",
9293
"fully_paid": "Totalmente pagado",

public/locales/es/signup.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"read-more" :"Lee la ciencia detrás de esto.",
1313
"read-more-link": "https://4geeks.com/es/mastering-technical-knowledge"
1414
},
15+
"total": "Total",
16+
"total-now": "Total ahora",
17+
"after-all-payments": "Después de todos los pagos",
1518
"secure-checkout": "Pago <strong>seguro y protegido</strong> garantizado",
1619
"discount-value-off": "{{value}} dto.",
1720
"add": "Agregar",
@@ -87,6 +90,8 @@
8790
"one_payment": "Pago único",
8891
"many_months_payment": "{{qty}} pagos mensuales",
8992
"our_plans": "Nuestros planes",
93+
"discount": "{{discount}} DE DESCUENTO",
94+
"try-again": "Intenta de nuevo",
9095
"join-cohort": {
9196
"cta": {
9297
"lesson": "Únete a la cohorte para poder acceder a esta lección",

src/common/components/MktShowPrices.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
33
import useTranslation from 'next-translate/useTranslation';
44
import PropTypes from 'prop-types';
55
import { useRouter } from 'next/router';
6-
import { Box, Flex, LinkBox } from '@chakra-ui/react';
6+
import { Box, Flex, LinkBox, Skeleton } from '@chakra-ui/react';
77
import { PrismicRichText } from '@prismicio/react';
88
import ShowPrices from './ShowPrices';
99
import { parseQuerys } from '../../utils/url';
@@ -180,9 +180,9 @@ function MktShowPrices({ id, externalPlanProps, cohortId, title, gridColumn1, gr
180180
</Box>
181181
</GridContainer>
182182
) : (
183-
<span>
184-
loading...
185-
</span>
183+
<Box display="flex" padding="32px">
184+
<Skeleton height="300px" width="100%" />
185+
</Box>
186186
);
187187
}
188188

src/common/components/PricingCard.jsx

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
55
import useTranslation from 'next-translate/useTranslation';
66
import { useState } from 'react';
77
import useStyle from '../hooks/useStyle';
8+
import useSignup from '../store/actions/signupAction';
89
import Text from './Text';
910
import Icon from './Icon';
1011
import { parseQuerys } from '../../utils/url';
@@ -13,12 +14,22 @@ import { usePersistentBySession } from '../hooks/usePersistent';
1314

1415
export default function PricingCard({ item, courseData, isFetching, relatedSubscription, ...rest }) {
1516
const { t, lang } = useTranslation('signup');
17+
const { getPriceWithDiscount, state } = useSignup();
18+
const { coupon: selfApliedCoupon } = state;
1619
const { fontColor, hexColor, featuredCard, featuredColor } = useStyle();
1720
const [selectedFinancing, setSelectedFinancing] = useState({});
1821
const [accordionState, setAccordionState] = useState(false);
1922
const isBootcampType = item?.planType && item?.planType.toLowerCase() === 'bootcamp';
2023
const queryCoupon = getQueryString('coupon');
2124
const [coupon] = usePersistentBySession('coupon', []);
25+
26+
const courseCoupon = selfApliedCoupon?.plan === item.plan_slug && selfApliedCoupon;
27+
28+
const priceProcessed = getPriceWithDiscount(selectedFinancing?.price || item?.optionList?.[0]?.price, courseCoupon);
29+
const discountApplied = priceProcessed?.originalPrice && priceProcessed.price !== priceProcessed.originalPrice;
30+
31+
const premiumColor = () => (courseCoupon ? hexColor.green : hexColor.blueDefault);
32+
2233
const utilProps = {
2334
already_have_it: t('pricing.already-have-plan'),
2435
bootcamp: {
@@ -69,8 +80,8 @@ export default function PricingCard({ item, courseData, isFetching, relatedSubsc
6980
service_items: t('pricing.premium-plan.service_items', {}, { returnObjects: true }),
7081
featured_info: t('pricing.premium-plan.featured_info', {}, { returnObjects: true }),
7182
color: 'white',
72-
featured: hexColor.blueDefault,
73-
border: hexColor.blueDefault,
83+
featured: courseCoupon ? hexColor.green : hexColor.blueDefault,
84+
border: isFetching ? hexColor.lightColor : premiumColor(),
7485
featuredFontColor: hexColor.yellowDefault,
7586
button: {
7687
variant: 'default',
@@ -125,9 +136,45 @@ export default function PricingCard({ item, courseData, isFetching, relatedSubsc
125136
background={featuredCard.background}
126137
height="fit-content"
127138
color={fontColor}
139+
position="relative"
128140
{...rest}
129141
>
130-
<Flex height="auto" position="relative" padding="8px" flexDirection="column" gridGap="16px" background={featured} borderRadius="8px 8px 0 0">
142+
{discountApplied && (
143+
<Box position="absolute" right="20px" top="-20px">
144+
<Box
145+
borderRadius="55px"
146+
background={hexColor.green}
147+
padding="2px 8px"
148+
position="relative"
149+
zIndex="10"
150+
>
151+
<Box
152+
top="-9px"
153+
left="-37px"
154+
display="flex"
155+
justifyContent="center"
156+
flexDirection="column"
157+
alignItems="center"
158+
textAlign="center"
159+
width="44px"
160+
height="44px"
161+
fontSize="24px"
162+
position="absolute"
163+
borderRadius="41px"
164+
padding="10px"
165+
border="2px solid"
166+
borderColor="#03823E"
167+
background={hexColor.green}
168+
>
169+
🔥
170+
</Box>
171+
<Text fontSize="15px" color="#FFF">
172+
{t('discount', { discount: priceProcessed.discount })}
173+
</Text>
174+
</Box>
175+
</Box>
176+
)}
177+
<Flex height="auto" position="relative" padding="8px" paddingTop={discountApplied && '14px'} flexDirection="column" gridGap="16px" background={isFetching ? hexColor.lightColor : featured} borderRadius="8px 8px 0 0">
131178
<Text fontSize="18px" lineHeight="21px" height="auto" fontWeight={700} color={color} textAlign="center">
132179
{viewProps.hookMessage}
133180
</Text>
@@ -140,10 +187,25 @@ export default function PricingCard({ item, courseData, isFetching, relatedSubsc
140187
<Skeleton height="48px" width="10rem" borderRadius="4px" />
141188
) : (
142189
<Flex gridGap="8px" alignItems="center">
143-
<Box color={color} fontFamily="Space Grotesk Variable" fontSize="64px" fontWeight={700} textAlign="center">
190+
<Box color={color} textAlign="center">
144191
{existsOptionList
145-
? `$${selectedFinancing?.price || item?.optionList?.[0]?.price}`
146-
: (item?.price_text || item?.priceText)}
192+
? (
193+
<>
194+
{priceProcessed.originalPrice && (
195+
<s style={{ fontSize: '16px' }}>
196+
{`$${priceProcessed.originalPrice}`}
197+
</s>
198+
)}
199+
<Text fontSize="64px" fontFamily="Space Grotesk Variable" fontWeight={700} lineHeight="70px">
200+
{`$${priceProcessed.price}`}
201+
</Text>
202+
</>
203+
)
204+
: (
205+
<Text fontSize="64px" fontFamily="Space Grotesk Variable" fontWeight={700} lineHeight="70px">
206+
{item?.price_text || item?.priceText}
207+
</Text>
208+
)}
147209
</Box>
148210
{existsOptionList && manyMonths > 1 && (
149211
<Text size="36px" fontFamily="Space Grotesk Variable" color={color} letterSpacing="normal" fontWeight="700">

0 commit comments

Comments
 (0)