, priceString].join('');\n case Currency.VND:\n return [priceString, 'VND'].join(' ');\n case Currency.YEN:\n return ['¥', priceString].join('');\n case Currency.SUSD:\n return ['S
, priceString].join('');\n }\n};\n\nexport const getDiscountMessage = (\n country: Country,\n currency: Currency,\n discountedPrice: number\n) =\u003E {\n const formattedPrice = formatPriceByCurrency(discountedPrice, currency);\n\n switch (country) {\n case Country.VIETNAM:\n return `The price has been discounted by ${formattedPrice} because you come from Vietnam.`;\n case Country.JAPAN:\n return `We have discounted the price by ${formattedPrice} thanks to the support from Japan's government.`;\n default:\n return `It's lucky that you come from ${country}, because we're running a program that discounts the price by ${discountedPrice}.`;\n }\n};\n","id":"mod_A9gtUS7b2qyHopfhFG9Amz","is_binary":false,"title":"price.ts","sha":null,"inserted_at":"2022-11-17T07:21:15","updated_at":"2024-06-01T01:19:29","upload_id":null,"shortid":"q6Om3","source_id":"src_AFxdZarXnzYnJDjTZWnoNS","directory_shortid":"gL4P9"},{"code":"import React from 'react';\r\n\r\nimport { getDiscountMessage, formatPriceByCurrency } from '..\u002Fservices\u002Fprice';\r\nimport { Country, Currency } from '..\u002Ftypes';\r\n\r\nimport styles from '.\u002FPricingCardBody.module.css';\r\n\r\ninterface PricingCardBodyProps {\r\n price: number;\r\n currency: Currency;\r\n country?: Country;\r\n}\r\n\r\nconst PricingCardBody: React.FC\u003CPricingCardBodyProps\u003E = ({\r\n price,\r\n currency,\r\n country\r\n}) =\u003E {\r\n const discountedRatio =\r\n country === Country.VIETNAM ? 0.4 : country === Country.JAPAN ? 0.2 : 0;\r\n const isDiscounted = discountedRatio \u003E 0;\r\n const finalPrice = price * (1 - discountedRatio);\r\n const discountedPrice = price - finalPrice;\r\n\r\n return (\r\n \u003Cdiv className={styles.body}\u003E\r\n \u003Ch1\u003E{formatPriceByCurrency(finalPrice, currency)}\u003C\u002Fh1\u003E\r\n {isDiscounted && country && (\r\n \u003Cdiv className={styles.discount}\u003E\r\n {getDiscountMessage(country, currency, discountedPrice)}\r\n \u003C\u002Fdiv\u003E\r\n )}\r\n \u003Cp\u003ELearn the essential skills for modern fullstack app development.\u003C\u002Fp\u003E\r\n \u003Cbutton className={styles.buyButton}\u003EGet started\u003C\u002Fbutton\u003E\r\n \u003C\u002Fdiv\u003E\r\n );\r\n};\r\n\r\nexport default PricingCardBody;\r\n","id":"mod_Hm8CSvCzPhAcShywLrvGgm","is_binary":false,"title":"PricingCardBody.tsx","sha":null,"inserted_at":"2022-11-10T14:29:00","updated_at":"2024-06-01T01:20:09","upload_id":null,"shortid":"71EAr","source_id":"src_AFxdZarXnzYnJDjTZWnoNS","directory_shortid":"lVp41"}],"owned":false,"custom_template":null,"privacy":0};