From 11981e28b06e2a4f51ee55c50af3980cf61ae586 Mon Sep 17 00:00:00 2001 From: desartstudio95 Date: Mon, 11 May 2026 16:57:29 +0200 Subject: [PATCH] feat: Refactor UI and subscription logic Introduce improved UI elements for the application name and logo. Implement enhanced subscription management and display features, including expiration checks and remaining days calculation. Update pricing for various subscription plans to reflect new offerings. This commit also includes: - Fixes for rendering inconsistencies. - Refinements to the analysis view and error handling. - Clarifications in admin dashboard user profile fields for subscription details. --- src/App.tsx | 4 +- src/components/AdminDashboard.tsx | 104 +++++++++++++++++++++++++----- src/components/AnalysisView.tsx | 47 ++++++++++++-- src/components/LandingPage.tsx | 4 +- src/components/Navbar.tsx | 2 +- src/components/PlansView.tsx | 8 +-- 6 files changed, 140 insertions(+), 29 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1838985..7f16f71 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -306,7 +306,7 @@ export default function App() {

- {isSecretAdminRoute ? <>FXBROS ADMIN : <>QUANTSCAN} + {isSecretAdminRoute ? <>FXBROS ADMIN : <>QUANTSCAN}

{isSecretAdminRoute ? "Acesso Restrito" : "Acesse a inteligência institucional Pro."} @@ -626,7 +626,7 @@ export default function App() { />

Olá Humano, Bem-Vindo -
QUANTSCAN
+
QUANTSCAN
+ )} + {user.isAdmin && ( diff --git a/src/components/AnalysisView.tsx b/src/components/AnalysisView.tsx index 7be77e3..f050886 100644 --- a/src/components/AnalysisView.tsx +++ b/src/components/AnalysisView.tsx @@ -18,6 +18,13 @@ export const AnalysisView: React.FC<{ userData?: any, onGoToHistory?: () => void const [mode, setMode] = useState<'Técnico' | 'Fundamental' | 'Híbrido'>('Híbrido'); const [usageInfo, setUsageInfo] = useState<{ used: number, limit: number }>({ used: 0, limit: userData?.analysisLimit ?? 8 }); + const now = Date.now(); + const isLifetime = userData?.plan === 'lifetime'; + const endsAt = userData?.subscriptionEndsAt; + const isExpired = !!(!isLifetime && endsAt && now > endsAt); + const daysRemaining = !isLifetime && endsAt ? (endsAt - now) / (1000 * 60 * 60 * 24) : null; + const isEndingSoon = daysRemaining !== null && Math.ceil(daysRemaining) <= 3 && Math.ceil(daysRemaining) > 0; + useEffect(() => { const fetchUsage = async () => { if (!auth.currentUser) return; @@ -54,6 +61,10 @@ export const AnalysisView: React.FC<{ userData?: any, onGoToHistory?: () => void }, [result, userData]); const handleStartAnalysis = async () => { + if (isExpired) { + setError("Sua assinatura expirou. Por favor, contate o administrador para renovar o plano."); + return; + } if (!preview || !file) return; if (usageInfo.used >= usageInfo.limit) { setError(`Limite diário atingido (${usageInfo.used}/${usageInfo.limit}). Faça upgrade para análises ilimitadas.`); @@ -129,6 +140,30 @@ export const AnalysisView: React.FC<{ userData?: any, onGoToHistory?: () => void return (
+ {isExpired && ( +
+ +
+

Assinatura Expirada

+

+ Sua assinatura expirou. Renove seu plano para continuar usando o scanner analisador. +

+
+
+ )} + + {isEndingSoon && ( +
+ +
+

Assinatura Expirando

+

+ Sua assinatura expira em {Math.ceil(daysRemaining)} dia(s). Renove agora para não perder o acesso ao scanner. +

+
+
+ )} +

@@ -193,10 +228,11 @@ export const AnalysisView: React.FC<{ userData?: any, onGoToHistory?: () => void {...getRootProps()} className={cn( "w-full flex flex-col items-center justify-center py-10 rounded-xl cursor-pointer transition-all duration-300 border border-transparent", - isDragActive ? "bg-brand-red/5 scale-[0.98] border-brand-red/30" : "hover:bg-zinc-800/20" + isDragActive ? "bg-brand-red/5 scale-[0.98] border-brand-red/30" : "hover:bg-zinc-800/20", + isExpired ? "opacity-50 pointer-events-none" : "" )} > - +
@@ -205,10 +241,13 @@ export const AnalysisView: React.FC<{ userData?: any, onGoToHistory?: () => void
-
@@ -334,7 +334,7 @@ export const LandingPage: React.FC = ({ onGetStarted, onViewPl

- QUANTSCAN + QUANTSCAN

diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 48fbab6..58f640a 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -37,7 +37,7 @@ export const Navbar: React.FC = ({ activeTab, setActiveTab, isAdmin />

- QUANTSCAN + QUANTSCAN IA TRADER
diff --git a/src/components/PlansView.tsx b/src/components/PlansView.tsx index de89329..72d98ac 100644 --- a/src/components/PlansView.tsx +++ b/src/components/PlansView.tsx @@ -237,7 +237,7 @@ export const PlansView: React.FC = ({ isUnauthenticated, onGetSt
= ({ isUnauthenticated, onGetSt /> = ({ isUnauthenticated, onGetSt /> = ({ isUnauthenticated, onGetSt />