docs: mark MC base currency implementation as completed in redesign plan

This commit is contained in:
mik-tf
2025-09-08 15:44:39 -04:00
parent abbf59207a
commit d9a449304c
16 changed files with 139 additions and 41 deletions

View File

@@ -734,7 +734,7 @@ impl DashboardController {
if let Ok(Some(user_email)) = session.get::<String>("user_email") {
ctx.insert("user_email", &user_email);
if let Some(user_data) = crate::services::user_persistence::UserPersistence::load_user_data(&user_email) {
ctx.insert("user_display_currency", &user_data.display_currency.unwrap_or_else(|| "USD".to_string()));
ctx.insert("user_display_currency", &user_data.display_currency.unwrap_or_else(|| "MC".to_string()));
ctx.insert("user_quick_topup_amounts", &user_data.quick_topup_amounts.unwrap_or_else(|| vec![
rust_decimal_macros::dec!(10),
rust_decimal_macros::dec!(25),
@@ -743,7 +743,7 @@ impl DashboardController {
]));
} else {
// Default values if no persistent data found
ctx.insert("user_display_currency", &"USD".to_string());
ctx.insert("user_display_currency", &"MC".to_string());
ctx.insert("user_quick_topup_amounts", &vec![
rust_decimal_macros::dec!(10),
rust_decimal_macros::dec!(25),

View File

@@ -180,9 +180,9 @@ impl WalletController {
let (currency, effective_currency) = match currency_service.get_currency(&display_currency) {
Some(c) => (c, display_currency.clone()),
None => {
let usd = currency_service.get_currency("USD").expect("USD currency must be available");
display_currency = "USD".to_string();
(usd, "USD".to_string())
let mc = currency_service.get_currency("MC").expect("MC currency must be available");
display_currency = "MC".to_string();
(mc, "MC".to_string())
}
};
@@ -258,9 +258,9 @@ impl WalletController {
let (currency, effective_currency) = match currency_service.get_currency(&display_currency) {
Some(c) => (c, display_currency.clone()),
None => {
let usd = currency_service.get_currency("USD").expect("USD currency must be available");
display_currency = "USD".to_string();
(usd, "USD".to_string())
let mc = currency_service.get_currency("MC").expect("MC currency must be available");
display_currency = "MC".to_string();
(mc, "MC".to_string())
}
};

View File

@@ -886,7 +886,7 @@ impl CurrencyServiceBuilder {
return Err("Base currency cannot be empty".to_string());
}
let display_currency = self.display_currency.unwrap_or_else(|| "USD".to_string());
let display_currency = self.display_currency.unwrap_or_else(|| "MC".to_string());
Ok(crate::services::currency::CurrencyService::new_with_display_config(
cache_duration,
@@ -1225,7 +1225,7 @@ impl SessionDataBuilder {
name: self.name,
country: self.country,
timezone: self.timezone,
display_currency: Some("USD".to_string()),
display_currency: Some("MC".to_string()),
quick_topup_amounts: Some(vec![dec!(10), dec!(25), dec!(50), dec!(100)]),
..Default::default()
}

View File

@@ -325,7 +325,7 @@ impl InstantPurchaseService {
let mut persistent_data = UserPersistence::load_user_data(&user_email)
.unwrap_or_else(|| crate::services::user_persistence::UserPersistentData {
user_email: user_email.clone(),
display_currency: Some("USD".to_string()),
display_currency: Some("MC".to_string()),
quick_topup_amounts: Some(vec![dec!(10), dec!(25), dec!(50), dec!(100)]),
..Default::default()
});

View File

@@ -79,16 +79,16 @@ impl NavbarService {
// Get user's preferred display currency
let mut display_currency = self.currency_service.get_user_preferred_currency(session);
// Get currency info for formatting; fall back to USD if invalid
// Get currency info for formatting; fall back to MC if invalid
let (currency, effective_currency) = match self.currency_service.get_currency(&display_currency) {
Some(c) => (c, display_currency.clone()),
None => {
let usd = self
let mc = self
.currency_service
.get_currency("USD")
.expect("USD currency must be available");
display_currency = "USD".to_string();
(usd, "USD".to_string())
.get_currency("MC")
.expect("MC currency must be available");
display_currency = "MC".to_string();
(mc, "MC".to_string())
}
};
@@ -150,8 +150,8 @@ impl NavbarService {
user_email: String::new(),
wallet_balance: Decimal::ZERO,
wallet_balance_formatted: "Not logged in".to_string(),
display_currency: "USD".to_string(),
currency_symbol: "$".to_string(),
display_currency: "MC".to_string(),
currency_symbol: "".to_string(),
quick_actions: vec![
QuickAction {
id: "login".to_string(),

View File

@@ -1352,7 +1352,7 @@ impl UserPersistence {
UserPersistentData {
user_email: user_email.to_string(),
wallet_balance_usd: dec!(0),
display_currency: Some("USD".to_string()),
display_currency: Some("MC".to_string()),
quick_topup_amounts: Some(vec![dec!(10), dec!(25), dec!(50), dec!(100)]),
..Default::default()
}
@@ -1363,7 +1363,7 @@ impl UserPersistence {
UserPersistentData {
user_email: user_email.to_string(),
wallet_balance_usd: balance,
display_currency: Some("USD".to_string()),
display_currency: Some("MC".to_string()),
quick_topup_amounts: Some(vec![dec!(10), dec!(25), dec!(50), dec!(100)]),
..Default::default()
}

View File

@@ -15,8 +15,8 @@
}
const hyd = readHydration('hydration-dashboard-cart');
const currencySymbol = (hyd && hyd.currency_symbol) || '$';
const displayCurrency = (hyd && hyd.display_currency) || 'USD';
const currencySymbol = (hyd && hyd.currency_symbol) || '';
const displayCurrency = (hyd && hyd.display_currency) || 'MC';
const showToast = (window.showToast) ? window.showToast : function (msg, type) {
// Fallback: log to console in case toast helper isn't available

View File

@@ -2,7 +2,7 @@
(function () {
'use strict';
let HYDRATION = { currency_symbol: '$', display_currency: 'USD' };
let HYDRATION = { currency_symbol: '', display_currency: 'MC' };
function parseHydration() {
try {

View File

@@ -15,8 +15,8 @@
}
const hyd = readHydration('wallet-hydration');
const currencySymbol = (hyd && hyd.currency_symbol) || '$';
const displayCurrency = (hyd && hyd.display_currency) || 'USD';
const currencySymbol = (hyd && hyd.currency_symbol) || '';
const displayCurrency = (hyd && hyd.display_currency) || 'MC';
function showSuccessToast(message) {
try {

View File

@@ -73,7 +73,7 @@
<!-- Wallet Balance Check -->
<div class="wallet-status mb-3">
<div class="d-flex justify-content-between align-items-center">
<span>Your {{ display_currency | default(value="USD") }} Credits:</span>
<span>Your {{ display_currency | default(value="MC") }} Credits:</span>
<span class="fw-bold" id="userBalance">{{ currency_symbol | default(value="$") }}0.00</span>
</div>
<div class="balance-indicator mt-2" id="balanceIndicator">
@@ -197,7 +197,7 @@
<script id="hydration-dashboard-cart" type="application/json">
{
"currency_symbol": {{ currency_symbol | default(value="$") | json_encode() }},
"display_currency": {{ display_currency | default(value="USD") | json_encode() }}
"display_currency": {{ display_currency | default(value="MC") | json_encode() }}
}
</script>
{% endblock %}

View File

@@ -50,7 +50,7 @@
<h5 class="card-title">Wallet Balance</h5>
<div class="d-flex justify-content-between align-items-end">
<h2 class="mb-0" id="dashboardWalletBalance">{{ currency_symbol | default(value="$") }}{% if user_metrics is defined and user_metrics.wallet_balance is defined %}{{ user_metrics.wallet_balance | format_decimal(precision=2) }}{% else %}0{% endif %}</h2>
<small class="text-muted">Credits (<span id="dashboardCurrencyCode">{{ display_currency | default(value="USD") }}</span>)</small>
<small class="text-muted">Credits (<span id="dashboardCurrencyCode">{{ display_currency | default(value="MC") }}</span>)</small>
</div>
</div>
</div>
@@ -266,7 +266,7 @@
<!-- JSON hydration for dashboard charts -->
<script type="application/json" id="dashboard-chart-data">
{
"displayCurrency": "{% if display_currency is defined and display_currency %}{{ display_currency }}{% else %}USD{% endif %}",
"displayCurrency": "{% if display_currency is defined and display_currency %}{{ display_currency }}{% else %}MC{% endif %}",
"resourceUtilization": {
{% if user_metrics is defined and user_metrics.resource_utilization is defined %}
"cpu": {{ user_metrics.resource_utilization.cpu }},

View File

@@ -194,7 +194,7 @@
<script type="application/json" id="orders-hydration">
{
"currency_symbol": {{ currency_symbol | default(value='$') | json_encode() }},
"display_currency": {{ display_currency | default(value='USD') | json_encode() }}
"display_currency": {{ display_currency | default(value='MC') | json_encode() }}
}
</script>
<script src="/static/js/dashboard_orders.js"></script>

View File

@@ -20,7 +20,7 @@
{{ currency_symbol | default(value="$") }}0.00
{% endif %}
</h2>
<small class="text-light">Credits ({{ display_currency | default(value="USD") }})</small>
<small class="text-light">Credits ({{ display_currency | default(value="MC") }})</small>
</div>
</div>
</div>
@@ -270,7 +270,7 @@
</div>
<div class="mb-3">
<div class="alert alert-info">
<strong>Rate:</strong> 1 Credit = {{ currency_symbol | default(value="$") }}1 {{ display_currency | default(value="USD") }}<br>
<strong>Rate:</strong> 1 Credit = {{ currency_symbol | default(value="") }}1 {{ display_currency | default(value="MC") }}<br>
<strong>Total Cost:</strong> {{ currency_symbol | default(value="$") }}<span id="totalCost">0.00</span>
</div>
</div>
@@ -435,7 +435,7 @@
<script type="application/json" id="wallet-hydration">
{
"currency_symbol": {{ currency_symbol | default(value='$') | json_encode() }},
"display_currency": {{ display_currency | default(value='USD') | json_encode() }}
"display_currency": {{ display_currency | default(value='MC') | json_encode() }}
}
</script>
<script src="/static/js/dashboard_wallet.js"></script>