diff --git a/src/views/components/retrospective-slides.tsx b/src/views/components/retrospective-slides.tsx index f63e780..9bfea94 100644 --- a/src/views/components/retrospective-slides.tsx +++ b/src/views/components/retrospective-slides.tsx @@ -4,12 +4,7 @@ import { } from '@/app/hooks/useMetrics'; import logoAImg from '@/assets/images/a-agape.png'; import logoImg from '@/assets/images/agape-logo.png'; -import { - BuildingIcon, - CalendarIcon, - ClockIcon, - SpinnerIcon, -} from '@phosphor-icons/react'; +import { BuildingIcon, ClockIcon, SpinnerIcon } from '@phosphor-icons/react'; import { motion } from 'framer-motion'; import * as React from 'react'; import { useSearchParams } from 'react-router-dom'; @@ -17,7 +12,6 @@ import { Navigation } from './navigation'; import ProfileCard from './ProfileCard'; import { StorySlide } from './story-slide'; - export function RetrospectiveSlides() { const [searchParams] = useSearchParams(); const cpf = searchParams.get('cpf') || ''; @@ -42,15 +36,14 @@ export function RetrospectiveSlides() { // Calcula slides baseado nos dados disponíveis const slides: number[] = []; slides.push(0); // Slide inicial - if (metricsPortal && metricsPortal.length > 0) slides.push(1); // Slide portais - if (metricsSystems && metricsSystems.length > 0) slides.push(2); // Slide sistemas + if (metricsPortal && metricsPortal.length > 0) slides.push(1); // Slide com portal principal if ( (metricsPortal && metricsPortal.length > 0) || (metricsSystems && metricsSystems.length > 0) ) { - slides.push(3); // Slide com informações gerais + slides.push(2); // Slide com podio de aplicações } - slides.push(4); // Slide final + slides.push(3); // Slide final const total = slides.length; @@ -63,9 +56,9 @@ export function RetrospectiveSlides() { ...(metricsSystems || []), ].reduce((acc, item) => acc + item.totalAcessos, 0); - // Top sistemas/portais por acessos const topItems = [...(metricsPortal || []), ...(metricsSystems || [])] + .filter((item) => (item.nomeSistema || '').toLowerCase() !== 'agportal') .sort((a, b) => b.totalAcessos - a.totalAcessos) .slice(0, 5); @@ -157,193 +150,237 @@ export function RetrospectiveSlides() { {metricsPortal && metricsPortal.length > 0 && ( -
-
+
+ + + + +
- + transition={{ duration: 0.6 }}> +

+ Você acessou +

-

- Seus Portais -

+ - {metricsPortal.length} +
+ {metricsPortal + .reduce((acc, p) => acc + p.totalAcessos, 0) + .toLocaleString('pt-BR')} +
+

+ vezes +

-

- portais acessados neste ano -

-
-
- {metricsPortal.map((portal, index) => ( - -

- {portal.nomeSistema} -

-

- Acessos -

-

- {portal.totalAcessos.toLocaleString('pt-BR')} -

-
- ))} -
-
- - )} - - {metricsSystems && metricsSystems.length > 0 && ( - -
-
- + transition={{ duration: 0.6, delay: 0.4 }}> +

+ o{' '} + + {metricsPortal[0]?.nomeSistema || 'Portal'} + +

+

+ durante o ano de {ano} +

-

- Seus Sistemas -

- - {metricsSystems.length} - -

- sistemas utilizados neste ano -

-
-
- {metricsSystems.map((sistema, index) => ( - -

- {sistema.nomeSistema} -

-

- Acessos -

-

- {sistema.totalAcessos.toLocaleString('pt-BR')} -

-
- ))} + +
+ {[...Array(3)].map((_, i) => ( + + ))} +
+
)} {topItems.length > 0 && ( - -
+ +
+ {/* Coluna esquerda - Título e informações */} - + transition={{ type: 'spring', duration: 0.6 }} + className="mb-6 md:mb-8"> + -
-

- Seu Engajamento -

+ + Seus Aplicativos Favoritos + - - {totalAcessos.toLocaleString('pt-BR')} - -

- Total de acessos ao longo do ano -

+ + Os sistemas mais acessados em {ano} + + + +
+

+ {totalAcessos.toLocaleString('pt-BR')} +

+

+ acessos totais no ano +

+
+
+ + + {/* Coluna direita - Lista vertical compacta */} +
+
+ {topItems.slice(0, 6).map((item, index) => { + const medalColors = [ + 'bg-yellow-400 text-yellow-900', + 'bg-gray-300 text-gray-900', + 'bg-orange-400 text-orange-900', + 'bg-blue-400/20 text-blue-300', + 'bg-purple-400/20 text-purple-300', + 'bg-green-400/20 text-green-300', + ]; + const isMedal = index < 3; + const medalColor = medalColors[index] || 'bg-white/20'; + + return ( + +
+ {index === 0 && '🥇'} + {index === 1 && '🥈'} + {index === 2 && '🥉'} + {index >= 3 && `#${index + 1}`} +
+ +
+

+ {item.nomeSistema} +

+

+ {item.totalAcessos.toLocaleString('pt-BR')}{' '} + acessos +

+
+ + +

+ {( + (item.totalAcessos / + (topItems[0]?.totalAcessos || 1)) * + 100 + ).toFixed(0)} + % +

+
+ +
+
+
+ ); + })}
- - - -

- Principais Recursos -

- {topItems.slice(0, 3).map((item, index) => ( - -
-

{item.nomeSistema}

-

- {item.totalAcessos.toLocaleString('pt-BR')} acessos -

-
-
- - #{index + 1} - -
-
- ))} -
+
)} -
-
+
+