@@ -21,6 +21,7 @@ import {
2121 FAQComponent ,
2222 FAQSection ,
2323} from '@gitroom/frontend/components/billing/faq.component' ;
24+ import { useT } from '@gitroom/react/translation/get.transation.service.client' ;
2425
2526const ModeComponent = dynamic (
2627 ( ) => import ( '@gitroom/frontend/components/layout/mode.component' ) ,
@@ -45,6 +46,7 @@ export const FirstBillingComponent = () => {
4546 const [ tier , setTier ] = useState ( 'STANDARD' ) ;
4647 const [ period , setPeriod ] = useState ( 'MONTHLY' ) ;
4748 const fetch = useFetch ( ) ;
49+ const t = useT ( ) ;
4850
4951 useEffect ( ( ) => {
5052 setStripe ( loadStripe ( stripeClient ) ) ;
@@ -102,29 +104,28 @@ export const FirstBillingComponent = () => {
102104 < div className = "flex px-[80px] flex-1" >
103105 < div className = "flex-1 py-[40px] flex flex-col pe-[40px]" >
104106 < div className = "text-[36px] font-[600] leading-[110%] whitespace-pre-line" >
105- Join Over{ ' ' }
106- < span className = "text-[#FC69FF]" > 18,000+ Entrepreneurs</ span > who
107- use{ '\n' } Postiz To Grow Their Social Presence
107+ { t ( 'billing_join_over' , 'Join Over' ) } { ' ' }
108+ < span className = "text-[#FC69FF]" > { t ( 'billing_entrepreneurs_count' , '18,000+ Entrepreneurs' ) } </ span > { t ( 'billing_who_use' , 'who use' ) } { '\n' } { t ( 'billing_postiz_grow_social' , 'Postiz To Grow Their Social Presence' ) }
108109 </ div >
109110
110111 < div className = "flex mt-[34px] mb-[10px]" >
111112 < div className = "flex gap-[8px]" >
112113 < div >
113114 < CheckIconComponent />
114115 </ div >
115- < div > 100% No-Risk Free Trial</ div >
116+ < div > { t ( 'billing_no_risk_trial' , ' 100% No-Risk Free Trial' ) } </ div >
116117 </ div >
117118 < div className = "flex-1 flex gap-[8px] justify-center" >
118119 < div >
119120 < CheckIconComponent />
120121 </ div >
121- < div > Pay NOTHING for the first 7-days</ div >
122+ < div > { t ( 'billing_pay_nothing_7_days' , ' Pay NOTHING for the first 7-days' ) } </ div >
122123 </ div >
123124 < div className = "flex gap-[8px]" >
124125 < div >
125126 < CheckIconComponent />
126127 </ div >
127- < div > Cancel anytime, hassle-free</ div >
128+ < div > { t ( 'billing_cancel_anytime' , ' Cancel anytime, hassle-free' ) } </ div >
128129 </ div >
129130 </ div >
130131
@@ -140,7 +141,7 @@ export const FirstBillingComponent = () => {
140141 < div className = "flex flex-col ps-[40px] border-l border-newColColor py-[40px]" >
141142 < div className = "top-[20px] sticky" >
142143 < div className = "flex mb-[24px]" >
143- < div className = "flex-1 text-[24px] font-[700]" > Choose a Plan</ div >
144+ < div className = "flex-1 text-[24px] font-[700]" > { t ( 'billing_choose_plan' , ' Choose a Plan' ) } </ div >
144145 < div className = "h-[44px] px-[6px] flex items-center justify-center gap-[12px] border border-newColColor rounded-[12px] select-none" >
145146 < div
146147 className = { clsx (
@@ -151,7 +152,7 @@ export const FirstBillingComponent = () => {
151152 ) }
152153 onClick = { ( ) => setPeriod ( 'MONTHLY' ) }
153154 >
154- Monthly
155+ { t ( 'billing_monthly' , ' Monthly' ) }
155156 </ div >
156157 < div
157158 className = { clsx (
@@ -162,9 +163,9 @@ export const FirstBillingComponent = () => {
162163 ) }
163164 onClick = { ( ) => setPeriod ( 'YEARLY' ) }
164165 >
165- < div > Yearly</ div >
166+ < div > { t ( 'billing_yearly' , ' Yearly' ) } </ div >
166167 < div className = "bg-[#AA0FA4] text-[white] px-[8px] rounded-[4px]" >
167- 20% Off
168+ { t ( 'billing_20_percent_off' , ' 20% Off' ) }
168169 </ div >
169170 </ div >
170171 </ div >
@@ -194,15 +195,15 @@ export const FirstBillingComponent = () => {
194195 ]
195196 }
196197 </ span > { ' ' }
197- / month
198+ { t ( 'billing_per_month' , ' / month' ) }
198199 </ div >
199200 </ div >
200201 ) ,
201202 [ ]
202203 ) }
203204 </ div >
204205 < div className = "flex flex-col mt-[54px] gap-[24px]" >
205- < div className = "text-[24px] font-[700]" > Features</ div >
206+ < div className = "text-[24px] font-[700]" > { t ( 'billing_features' , ' Features' ) } </ div >
206207 < BillingFeatures tier = { tier } />
207208 </ div >
208209 </ div >
@@ -212,43 +213,72 @@ export const FirstBillingComponent = () => {
212213 ) ;
213214} ;
214215
216+ type FeatureItem = {
217+ key : string ;
218+ defaultValue : string ;
219+ prefix ?: string | number ;
220+ } ;
221+
215222export const BillingFeatures : FC < { tier : string } > = ( { tier } ) => {
216- const render = useMemo ( ( ) => {
223+ const t = useT ( ) ;
224+ const features = useMemo ( ( ) => {
217225 const currentPricing = pricing [ tier ] ;
218226 const channelsOr = currentPricing . channel ;
219- const list = [ ] ;
220- list . push ( `${ channelsOr } ${ channelsOr === 1 ? 'channel' : 'channels' } ` ) ;
221- list . push (
222- `${
223- currentPricing . posts_per_month > 10000
224- ? 'Unlimited'
225- : currentPricing . posts_per_month
226- } posts per month`
227- ) ;
227+ const list : FeatureItem [ ] = [ ] ;
228+
229+ list . push ( {
230+ key : channelsOr === 1 ? 'billing_channel' : 'billing_channels' ,
231+ defaultValue : channelsOr === 1 ? 'channel' : 'channels' ,
232+ prefix : channelsOr ,
233+ } ) ;
234+
235+ list . push ( {
236+ key : 'billing_posts_per_month' ,
237+ defaultValue : 'posts per month' ,
238+ prefix : currentPricing . posts_per_month > 10000 ? 'unlimited' : currentPricing . posts_per_month ,
239+ } ) ;
240+
228241 if ( currentPricing . team_members ) {
229- list . push ( ` Unlimited team members` ) ;
242+ list . push ( { key : 'billing_unlimited_team_members' , defaultValue : ' Unlimited team members' } ) ;
230243 }
231244 if ( currentPricing ?. ai ) {
232- list . push ( ` AI auto-complete` ) ;
233- list . push ( ` AI copilots` ) ;
234- list . push ( ` AI Autocomplete` ) ;
245+ list . push ( { key : 'billing_ai_auto_complete' , defaultValue : ' AI auto-complete' } ) ;
246+ list . push ( { key : 'billing_ai_copilots' , defaultValue : ' AI copilots' } ) ;
247+ list . push ( { key : 'billing_ai_autocomplete' , defaultValue : ' AI Autocomplete' } ) ;
235248 }
236- list . push ( ` Advanced Picture Editor` ) ;
249+ list . push ( { key : 'billing_advanced_picture_editor' , defaultValue : ' Advanced Picture Editor' } ) ;
237250 if ( currentPricing ?. image_generator ) {
238- list . push (
239- `${ currentPricing ?. image_generation_count } AI Images per month`
240- ) ;
251+ list . push ( {
252+ key : 'billing_ai_images_per_month' ,
253+ defaultValue : 'AI Images per month' ,
254+ prefix : currentPricing ?. image_generation_count ,
255+ } ) ;
241256 }
242257 if ( currentPricing ?. generate_videos ) {
243- list . push ( `${ currentPricing ?. generate_videos } AI Videos per month` ) ;
258+ list . push ( {
259+ key : 'billing_ai_videos_per_month' ,
260+ defaultValue : 'AI Videos per month' ,
261+ prefix : currentPricing ?. generate_videos ,
262+ } ) ;
244263 }
245264 return list ;
246265 } , [ tier ] ) ;
247266
267+ const renderFeature = ( feature : FeatureItem ) => {
268+ const translatedText = t ( feature . key , feature . defaultValue ) ;
269+ if ( feature . prefix === 'unlimited' ) {
270+ return `${ t ( 'billing_unlimited' , 'Unlimited' ) } ${ translatedText } ` ;
271+ }
272+ if ( feature . prefix !== undefined ) {
273+ return `${ feature . prefix } ${ translatedText } ` ;
274+ }
275+ return translatedText ;
276+ } ;
277+
248278 return (
249279 < div className = "grid grid-cols-2 gap-y-[8px] gap-x-[32px]" >
250- { render . map ( ( p ) => (
251- < div key = { p } className = "flex items-center gap-[8px]" >
280+ { features . map ( ( feature ) => (
281+ < div key = { feature . key } className = "flex items-center gap-[8px]" >
252282 < div >
253283 < svg
254284 xmlns = "http://www.w3.org/2000/svg"
@@ -263,7 +293,7 @@ export const BillingFeatures: FC<{ tier: string }> = ({ tier }) => {
263293 />
264294 </ svg >
265295 </ div >
266- < div > { p } </ div >
296+ < div > { renderFeature ( feature ) } </ div >
267297 </ div >
268298 ) ) }
269299 </ div >
0 commit comments