refactor(ui): changed frontend to normal i18n without SSR

This commit is contained in:
akhilmhdh
2023-05-09 23:28:23 +05:30
parent 420d71d923
commit 3561c589b1
198 changed files with 5008 additions and 5253 deletions
+33 -36
View File
@@ -1,11 +1,10 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Head from 'next/head';
import { useTranslation } from 'next-i18next';
import { plans as plansConstant } from 'public/data/frequentConstants';
import Plan from '@app/components/billing/Plan';
import NavHeader from '@app/components/navigation/NavHeader';
import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import getOrganizationSubscriptions from '../../api/organization/GetOrgSubscription';
import getOrganizationUsers from '../../api/organization/GetOrgUsers';
@@ -19,43 +18,43 @@ export default function SettingsBilling() {
const plans = [
{
key: 1,
name: t('billing:starter.name')!,
price: t('billing:free')!,
priceExplanation: t('billing:starter.price-explanation')!,
text: t('billing:starter.text')!,
subtext: t('billing:starter.subtext')!,
buttonTextMain: t('billing:downgrade')!,
buttonTextSecondary: t('billing:learn-more')!,
name: t('billing.starter.name')!,
price: t('billing.free')!,
priceExplanation: t('billing.starter.price-explanation')!,
text: t('billing.starter.text')!,
subtext: t('billing.starter.subtext')!,
buttonTextMain: t('billing.downgrade')!,
buttonTextSecondary: t('billing.learn-more')!,
current: currentPlan === plansConstant.starter
},
{
key: 2,
name: 'Team',
price: '$8',
priceExplanation: t('billing:professional.price-explanation')!,
priceExplanation: t('billing.professional.price-explanation')!,
text: 'For teams that want to improve their efficiency and security.',
buttonTextMain: t('billing:upgrade')!,
buttonTextSecondary: t('billing:learn-more')!,
buttonTextMain: t('billing.upgrade')!,
buttonTextSecondary: t('billing.learn-more')!,
current: currentPlan === plansConstant.team
},
{
key: 3,
name: t('billing:professional.name')!,
name: t('billing.professional.name')!,
price: '$18',
priceExplanation: t('billing:professional.price-explanation')!,
text: t('billing:enterprise.text')!,
subtext: t('billing:professional.subtext')!,
buttonTextMain: t('billing:upgrade')!,
buttonTextSecondary: t('billing:learn-more')!,
priceExplanation: t('billing.professional.price-explanation')!,
text: t('billing.enterprise.text')!,
subtext: t('billing.professional.subtext')!,
buttonTextMain: t('billing.upgrade')!,
buttonTextSecondary: t('billing.learn-more')!,
current: currentPlan === plansConstant.professional
},
{
key: 4,
name: t('billing:enterprise.name')!,
price: t('billing:custom-pricing')!,
name: t('billing.enterprise.name')!,
price: t('billing.custom-pricing')!,
text: 'Boost the security and efficiency of your engineering teams.',
buttonTextMain: t('billing:schedule-demo')!,
buttonTextSecondary: t('billing:learn-more')!,
buttonTextMain: t('billing.schedule-demo')!,
buttonTextSecondary: t('billing.learn-more')!,
current: false
}
];
@@ -77,30 +76,30 @@ export default function SettingsBilling() {
}, []);
return (
<div className="bg-bunker-800 pb-4 flex flex-col justify-between text-white">
<div className="flex flex-col justify-between bg-bunker-800 pb-4 text-white">
<Head>
<title>{t('common:head-title', { title: t('billing:title') })}</title>
<title>{t('common.head-title', { title: t('billing.title') })}</title>
<link rel="icon" href="/infisical.ico" />
</Head>
<div className="flex flex-row">
<div className="w-full pb-2">
<NavHeader pageName={t('billing:title')} />
<div className="flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl">
<div className="flex flex-col justify-start items-start text-3xl">
<p className="font-semibold mr-4 text-gray-200">{t('billing:title')}</p>
<p className="font-normal mr-4 text-gray-400 text-base">{t('billing:description')}</p>
<NavHeader pageName={t('billing.title')} />
<div className="my-8 ml-6 flex max-w-5xl flex-row items-center justify-between text-xl">
<div className="flex flex-col items-start justify-start text-3xl">
<p className="mr-4 font-semibold text-gray-200">{t('billing.title')}</p>
<p className="mr-4 text-base font-normal text-gray-400">{t('billing.description')}</p>
</div>
</div>
<div className="flex flex-col ml-6 text-mineshaft-50 w-max">
<p className="text-xl font-semibold">{t('billing:subscription')}</p>
<div className="grid grid-cols-2 grid-rows-2 gap-y-6 gap-x-3 mt-4 overflow-x-auto">
<div className="ml-6 flex w-max flex-col text-mineshaft-50">
<p className="text-xl font-semibold">{t('billing.subscription')}</p>
<div className="mt-4 grid grid-cols-2 grid-rows-2 gap-y-6 gap-x-3 overflow-x-auto">
{plans.map((plan) => (
<Plan key={plan.name} plan={plan} />
))}
</div>
<p className="text-xl font-bold mt-12">{t('billing:current-usage')}</p>
<p className="mt-12 text-xl font-bold">{t('billing.current-usage')}</p>
<div className="flex flex-row">
<div className="mr-4 mt-8 text-gray-300 w-60 pt-6 pb-10 rounded-md bg-white/5 justify-center items-center flex flex-col">
<div className="mr-4 mt-8 flex w-60 flex-col items-center justify-center rounded-md bg-white/5 pt-6 pb-10 text-gray-300">
<p className="text-6xl font-bold">{numUsers}</p>
<p className="text-gray-300">
{numUsers > 1 ? 'Organization members' : 'Organization member'}
@@ -119,5 +118,3 @@ export default function SettingsBilling() {
}
SettingsBilling.requireAuth = true;
export const getServerSideProps = getTranslatedServerSideProps(['settings', 'billing']);