From 1c55ac0af3f4dc642c7747ebac09a21fba5d021a Mon Sep 17 00:00:00 2001 From: mik-tf Date: Mon, 8 Sep 2025 13:14:47 -0400 Subject: [PATCH] feat: rename TFP to MC currency in dashboard UI and pools functionality --- src/controllers/dashboard.rs | 2 +- src/static/js/dashboard-user.js | 14 +++++++------- src/static/js/dashboard_pools.js | 16 ++++++++-------- src/views/dashboard/pools.html | 30 +++++++++++++++--------------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/controllers/dashboard.rs b/src/controllers/dashboard.rs index 28d1984..7f29515 100644 --- a/src/controllers/dashboard.rs +++ b/src/controllers/dashboard.rs @@ -1628,7 +1628,7 @@ impl DashboardController { let price_per_hour = slice_data.get("price_hour") .and_then(|v| v.as_f64()) .map(|p| rust_decimal::Decimal::from_f64_retain(p).unwrap_or(rust_decimal::Decimal::new(50, 2))) - .unwrap_or(rust_decimal::Decimal::new(50, 2)); // Fallback to 0.50 TFC/hour only if no price provided + .unwrap_or(rust_decimal::Decimal::new(50, 2)); // Fallback to 0.50 MC/hour only if no price provided // Load user data to get resource_provider name let user = Self::load_user_with_persistent_data(&session); diff --git a/src/static/js/dashboard-user.js b/src/static/js/dashboard-user.js index dd06316..9c48909 100644 --- a/src/static/js/dashboard-user.js +++ b/src/static/js/dashboard-user.js @@ -38,7 +38,7 @@ class UserDashboard { data: { labels: ['Month 1', 'Month 2', 'Month 3', 'Month 4', 'Month 5', 'Month 6'], datasets: [{ - label: 'TFC Usage', + label: 'MC Usage', data: this.userData.tfp_usage_trend || [0, 0, 0, 0, 0, 0], borderColor: '#007bff', backgroundColor: 'rgba(0, 123, 255, 0.1)', @@ -58,7 +58,7 @@ class UserDashboard { tooltip: { callbacks: { label: function(context) { - return `TFC Usage: ${context.raw} TFC`; + return `MC Usage: ${context.raw} MC`; } } } @@ -368,7 +368,7 @@ class UserDashboard { ${app.status} ${app.rating}/5 ⭐ ${app.deployments} active - ${app.monthly_revenue} TFP/month + ${app.monthly_revenue} MC/month
@@ -416,7 +416,7 @@ class UserDashboard { ${service.category} ${service.status} - ${service.price_per_hour} TFP + ${service.price_per_hour} MC ${service.clients} ${stars} @@ -472,7 +472,7 @@ class UserDashboard { ${resource.location} ${resource.status} ${resource.sla} - ${resource.monthly_cost} TFP/month + ${resource.monthly_cost} MC/month
@@ -525,7 +525,7 @@ class UserDashboard { ${rental.specs} ${rental.location} ${rental.status} - ${rental.monthly_cost} TFP/month + ${rental.monthly_cost} MC/month
@@ -558,7 +558,7 @@ class UserDashboard { if (activeRentalsElement) activeRentalsElement.textContent = activeRentals; if (vmDeploymentsElement) vmDeploymentsElement.textContent = vmDeployments; if (k8sDeploymentsElement) k8sDeploymentsElement.textContent = k8sDeployments; - if (monthlyCostElement) monthlyCostElement.textContent = `${totalMonthlyCost} TFP`; + if (monthlyCostElement) monthlyCostElement.textContent = `${totalMonthlyCost} MC`; console.log(`📊 Updated slice rental stats: ${activeRentals} active, ${vmDeployments} VM, ${k8sDeployments} K8s, ${totalMonthlyCost} TFP/month`); } diff --git a/src/static/js/dashboard_pools.js b/src/static/js/dashboard_pools.js index 38a5e31..9fde66d 100644 --- a/src/static/js/dashboard_pools.js +++ b/src/static/js/dashboard_pools.js @@ -207,7 +207,7 @@ tfpAmountTFT.addEventListener('input', () => { const amount = parseFloat(tfpAmountTFT.value) || 0; const tftCost = amount * 0.5; // 1 MC = 0.5 TFT - const modal = document.getElementById('buyTFCWithTFTModal'); + const modal = document.getElementById('buyMCWithTFTModal'); if (modal) { const rows = modal.querySelectorAll('.alert .d-flex.justify-content-between .text-end'); // rows[0] -> Amount, rows[1] -> Cost @@ -223,7 +223,7 @@ sellTfpAmountTFT.addEventListener('input', () => { const amount = parseFloat(sellTfpAmountTFT.value) || 0; const tftReceive = amount * 0.5; // 1 MC = 0.5 TFT - const modal = document.getElementById('sellTFCForTFTModal'); + const modal = document.getElementById('sellMCForTFTModal'); if (modal) { const rows = modal.querySelectorAll('.alert .d-flex.justify-content-between .text-end'); if (rows[0]) rows[0].textContent = `${amount} MC`; @@ -238,7 +238,7 @@ tfpAmountPEAQ.addEventListener('input', () => { const amount = parseFloat(tfpAmountPEAQ.value) || 0; const peaqCost = amount * 2.0; // 1 MC = 2 PEAQ - const modal = document.getElementById('buyTFCWithPEAQModal'); + const modal = document.getElementById('buyMCWithPEAQModal'); if (modal) { const rows = modal.querySelectorAll('.alert .d-flex.justify-content-between .text-end'); if (rows[0]) rows[0].textContent = `${amount} MC`; @@ -253,7 +253,7 @@ sellTfpAmountPEAQ.addEventListener('input', () => { const amount = parseFloat(sellTfpAmountPEAQ.value) || 0; const peaqReceive = amount * 2.0; // 1 MC = 2 PEAQ - const modal = document.getElementById('sellTFCForPEAQModal'); + const modal = document.getElementById('sellMCForPEAQModal'); if (modal) { const rows = modal.querySelectorAll('.alert .d-flex.justify-content-between .text-end'); if (rows[0]) rows[0].textContent = `${amount} MC`; @@ -376,7 +376,7 @@ body: JSON.stringify({ amount, payment_method: 'TFT' }), }); showSuccessToast(`Purchased ${amount} MC with TFT`); - const modal = document.getElementById('buyTFCWithTFTModal'); + const modal = document.getElementById('buyMCWithTFTModal'); if (modal && window.bootstrap) bootstrap.Modal.getOrCreateInstance(modal).hide(); } catch (e) { if (e && e.status === 402) { @@ -399,7 +399,7 @@ body: JSON.stringify({ amount, currency: 'TFT', payout_method: 'blockchain' }), }); showSuccessToast(`Sold ${amount} MC for TFT`); - const modal = document.getElementById('sellTFCForTFTModal'); + const modal = document.getElementById('sellMCForTFTModal'); if (modal && window.bootstrap) bootstrap.Modal.getOrCreateInstance(modal).hide(); } catch (e) { if (e && e.status === 402) { @@ -422,7 +422,7 @@ body: JSON.stringify({ amount, payment_method: 'PEAQ' }), }); showSuccessToast(`Purchased ${amount} MC with PEAQ`); - const modal = document.getElementById('buyTFCWithPEAQModal'); + const modal = document.getElementById('buyMCWithPEAQModal'); if (modal && window.bootstrap) bootstrap.Modal.getOrCreateInstance(modal).hide(); } catch (e) { if (e && e.status === 402) { @@ -445,7 +445,7 @@ body: JSON.stringify({ amount, currency: 'PEAQ', payout_method: 'blockchain' }), }); showSuccessToast(`Sold ${amount} MC for PEAQ`); - const modal = document.getElementById('sellTFCForPEAQModal'); + const modal = document.getElementById('sellMCForPEAQModal'); if (modal && window.bootstrap) bootstrap.Modal.getOrCreateInstance(modal).hide(); } catch (e) { if (e && e.status === 402) { diff --git a/src/views/dashboard/pools.html b/src/views/dashboard/pools.html index 15ef0ef..f2907dc 100644 --- a/src/views/dashboard/pools.html +++ b/src/views/dashboard/pools.html @@ -244,7 +244,7 @@
- +