Add a compile-time i18n system with 270 translation keys across 5 locales (EN, DE, FR, ES, PT). Translations are embedded via include_str! and parsed lazily into flat HashMaps with English fallback for missing keys. - Add src/i18n module with Locale enum, t()/tw() lookup functions, and tests - Add JSON translation files for all 5 locales under assets/i18n/ - Provide locale Signal via Dioxus context in App, persisted to localStorage - Replace all hardcoded UI strings across 33 component/page files - Add compact locale picker (globe icon + ISO alpha-2 code) in sidebar header - Add click-outside backdrop dismissal for locale dropdown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #12
97 lines
3.0 KiB
Rust
97 lines
3.0 KiB
Rust
use dioxus::prelude::*;
|
|
|
|
use crate::app::Route;
|
|
use crate::components::{PageHeader, PricingCard};
|
|
use crate::i18n::{t, tw, Locale};
|
|
use crate::models::PricingPlan;
|
|
|
|
/// Organization pricing page displaying three plan tiers.
|
|
///
|
|
/// Clicking "Get Started" on any plan navigates to the
|
|
/// organization dashboard.
|
|
#[component]
|
|
pub fn OrgPricingPage() -> Element {
|
|
let locale = use_context::<Signal<Locale>>();
|
|
let l = *locale.read();
|
|
|
|
let navigator = use_navigator();
|
|
let plans = mock_plans(l);
|
|
|
|
rsx! {
|
|
section { class: "pricing-page",
|
|
PageHeader {
|
|
title: t(l, "org.pricing_title"),
|
|
subtitle: t(l, "org.pricing_subtitle"),
|
|
}
|
|
div { class: "pricing-grid",
|
|
for plan in plans {
|
|
PricingCard {
|
|
key: "{plan.id}",
|
|
plan,
|
|
on_select: move |_| {
|
|
navigator.push(Route::OrgDashboardPage {});
|
|
},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Returns mock pricing plans with translated names and features.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `l` - The active locale for translating user-facing plan text
|
|
fn mock_plans(l: Locale) -> Vec<PricingPlan> {
|
|
vec![
|
|
PricingPlan {
|
|
id: "starter".into(),
|
|
name: t(l, "pricing.starter"),
|
|
price_eur: 49,
|
|
features: vec![
|
|
tw(l, "pricing.up_to_users", &[("n", "5")]),
|
|
t(l, "pricing.llm_provider_1"),
|
|
t(l, "pricing.tokens_100k"),
|
|
t(l, "pricing.community_support"),
|
|
t(l, "pricing.basic_analytics"),
|
|
],
|
|
highlighted: false,
|
|
max_seats: Some(5),
|
|
},
|
|
PricingPlan {
|
|
id: "team".into(),
|
|
name: t(l, "pricing.team"),
|
|
price_eur: 199,
|
|
features: vec![
|
|
tw(l, "pricing.up_to_users", &[("n", "25")]),
|
|
t(l, "pricing.all_providers"),
|
|
t(l, "pricing.tokens_1m"),
|
|
t(l, "pricing.priority_support"),
|
|
t(l, "pricing.advanced_analytics"),
|
|
t(l, "pricing.custom_mcp"),
|
|
t(l, "pricing.sso"),
|
|
],
|
|
highlighted: true,
|
|
max_seats: Some(25),
|
|
},
|
|
PricingPlan {
|
|
id: "enterprise".into(),
|
|
name: t(l, "pricing.enterprise"),
|
|
price_eur: 499,
|
|
features: vec![
|
|
t(l, "pricing.unlimited_users"),
|
|
t(l, "pricing.all_providers"),
|
|
t(l, "pricing.unlimited_tokens"),
|
|
t(l, "pricing.dedicated_support"),
|
|
t(l, "pricing.full_observability"),
|
|
t(l, "pricing.custom_integrations"),
|
|
t(l, "pricing.sla"),
|
|
t(l, "pricing.on_premise"),
|
|
],
|
|
highlighted: false,
|
|
max_seats: None,
|
|
},
|
|
]
|
|
}
|