Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ B3yond/
├─ docker-compose.yml
├─ .env # env do backend
└─ README.md
```
```
14 changes: 7 additions & 7 deletions frontend/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ const theme = createTheme({

const router = createBrowserRouter([
{
element: <RootLayout />, // AuthProvider fica dentro do RootLayout
element: <RootLayout />,
children: [
{ path: '/', element: <Navigate to="/app" replace /> },
{ path: '/login', element: <LoginPage /> },
{ path: '/signup', element: <SignupPage /> },
{
path: '/app',
element: (
<RequireAuth>
<ProfileGate>
//<RequireAuth>
//<ProfileGate>
<HomePage />
</ProfileGate>
</RequireAuth>
//</ProfileGate>
//</RequireAuth>
),
},
{
path: '/profile',
element: (
<RequireAuth>
//<RequireAuth>
<ProfilePage />
</RequireAuth>
//</RequireAuth>
),
},
],
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/app/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Outlet } from 'react-router-dom';
import { AuthProvider } from '../features/auth/hooks/useAuth';

export default function RootLayout() {
return (
<AuthProvider>
//<AuthProvider>
<Outlet />
</AuthProvider>
//</AuthProvider>
);
}
9 changes: 4 additions & 5 deletions frontend/src/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@ export const router = createBrowserRouter([
element: <RootLayout />,
children: [
{ path: '/', element: <Navigate to="/app" replace /> },
{ path: '/login', element: <LoginPage /> },
{
path: '/app',
element: (
<RequireAuth>
//<RequireAuth>
<HomePage />
</RequireAuth>
//</RequireAuth>
),
},
{
path: '/profile',
element: (
<RequireAuth>
//<RequireAuth>
<ProfilePage />
</RequireAuth>
//</RequireAuth>
),
},
],
Expand Down
35 changes: 18 additions & 17 deletions frontend/src/app/screens/AppHome.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { useAuth } from '../../features/auth';
import React from 'react';
import { Box } from '@mui/material';
import { Navbar } from '../../shared/components/Navbar';
import { PageHeader } from '../../shared/components/PageHeader';
import { InitiativesSection } from '../../shared/components/Home/InitiativesSection';
import { IdeasSection } from '../../shared/components/Home/IdeasSection';
import { InnovatorsSection } from '../../shared/components/Home/InnovatorsSection';

export default function AppHome() {
const { user, signOut, refresh } = useAuth();
if (user === undefined) return <p>Carregando…</p>;
const AppHome: React.FC = () => {
return (
<main>
{user ? (
<>
<h2>Bem-vindo, {user.nome}</h2>
<p>ID: {user.id}</p>
<button onClick={refresh}>Recarregar</button>
<button onClick={signOut}>Sair</button>
</>
) : (
<p>Sem sessão. Vá para /auth.</p>
)}
</main>
<Box>
<Navbar />
<PageHeader />
<InitiativesSection />
<IdeasSection />
<InnovatorsSection />
</Box>
);
}
};

export default AppHome;
72 changes: 72 additions & 0 deletions frontend/src/shared/components/Home/IdeasSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import React from 'react';
import { Box, Typography, Paper, IconButton, Button } from '@mui/material';
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';

export const IdeasSection: React.FC = () => {
const mockIdeias = Array(3).fill({
usuario: 'Nome do usuário',
titulo: 'Título da ideia',
descricao:
'Pequenas descrição da ideia. Pequenas descrição da ideia. Pequenas descrição da ideia.',
curtidas: 9,
comentarios: 12,
});

return (
<Box sx={{ backgroundColor: '#001769', color: '#fff', p: 6 }}>
<Typography variant="h5" fontWeight="bold" align="center">
Ideias mais relevantes
</Typography>
<Typography variant="body1" align="center" sx={{ opacity: 0.8, mb: 4 }}>
As ideias mais curtidas do fórum da B3
</Typography>

<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 2 }}>
<IconButton sx={{ color: '#FFD862' }}>
<ArrowBackIosNewIcon />
</IconButton>

{mockIdeias.map((ideia, i) => (
<Paper
key={i}
sx={{
p: 3,
backgroundColor: '#172E7A',
color: '#fff',
width: 280,
height: 240,
}}
>
<Typography variant="body2" fontWeight="bold">
{ideia.usuario}
</Typography>
<Typography variant="h6" sx={{ mt: 1 }}>
{ideia.titulo}
</Typography>
<Typography variant="body2" sx={{ mt: 1 }}>
{ideia.descricao}
</Typography>
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Typography variant="caption">{ideia.curtidas} curtidas</Typography>
<Typography variant="caption">{ideia.comentarios} comentários</Typography>
</Box>
</Paper>
))}

<IconButton sx={{ color: '#FFD862' }}>
<ArrowForwardIosIcon />
</IconButton>
</Box>

<Box sx={{ display: 'flex', justifyContent: 'center', mt: 4 }}>
<Button
variant="contained"
sx={{ backgroundColor: '#FFD862', color: '#001769', fontWeight: 'bold' }}
>
VER TODAS AS IDEIAS
</Button>
</Box>
</Box>
);
};
56 changes: 56 additions & 0 deletions frontend/src/shared/components/Home/InitiativesSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import { Box, Typography, Button, Grid, Paper } from '@mui/material';
import { CategoryTag } from '../CategoryTag';

export const InitiativesSection: React.FC = () => {
const mockIniciativas = Array(4).fill({
usuario: 'Nome do usuário',
titulo: 'Este é o título da iniciativa',
descricao: 'Pequena descrição da ideia. Pequena descrição da ideia. Pequena descrição da ideia.',
categorias: ['Categoria 1', 'Categoria 1', 'Categoria 1']
});

return (
<Box sx={{ backgroundColor: '#f8f8f8', p: 6 }}>
<Typography variant="h5" fontWeight="bold" align="center">
Últimas iniciativas
</Typography>
<Typography variant="body1" align="center" sx={{ color: '#777', mb: 4 }}>
As iniciativas mais recentes em andamento
</Typography>

<Grid container spacing={3} justifyContent="center">
{mockIniciativas.map((ini, index) => (
<Grid item xs={12} md={5} key={index}>
<Paper elevation={2} sx={{ p: 3 }}>
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>
{ini.usuario}
</Typography>
<Typography variant="h6" sx={{ mt: 1 }}>
{ini.titulo}
</Typography>
<Typography variant="body2" sx={{ mb: 2 }}>
{ini.descricao}
</Typography>

<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
{ini.categorias.map((cat, i) => (
<CategoryTag key={i} label={cat} />
))}
</Box>
</Paper>
</Grid>
))}
</Grid>

<Box sx={{ display: 'flex', justifyContent: 'center', mt: 4 }}>
<Button
variant="contained"
sx={{ backgroundColor: '#FFD862', color: '#001769', fontWeight: 'bold' }}
>
VER TODAS AS INICIATIVAS
</Button>
</Box>
</Box>
);
};
63 changes: 63 additions & 0 deletions frontend/src/shared/components/Home/InnovatorsSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from 'react';
import { Box, Typography, Paper, Avatar } from '@mui/material';

const cores = ['#FFFACD', '#D3D3D3', '#FFDAB9', '#ffffff', '#ffffff'];

export const InnovatorsSection: React.FC = () => {
const mockRanking = Array(5).fill({
nome: 'Nome do usuário',
username: '@usuario',
contribuições: 'XX',
comentários: 'XX',
ideias: 'XX',
iniciativas: 'XX',
});

return (
<Box
sx={{
p: 6,
background: 'url(/grafico-bg.png)',
backgroundSize: 'cover',
backgroundPosition: 'center',
}}
>
<Typography variant="h5" fontWeight="bold" align="center" color="white">
Funcionários mais Inovadores
</Typography>
<Typography variant="body1" align="center" sx={{ opacity: 0.8, color: '#fff', mb: 4 }}>
Os funcionários mais engajados na área de Inovação da B3
</Typography>

{mockRanking.map((user, i) => (
<Paper
key={i}
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
backgroundColor: cores[i],
mb: 1,
p: 2,
}}
>
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
<Typography variant="h6">{i + 1}</Typography>
<Avatar />
<Box>
<Typography fontWeight="bold">{user.nome}</Typography>
<Typography variant="body2">{user.username}</Typography>
</Box>
</Box>

<Box sx={{ display: 'flex', gap: 3 }}>
<Typography variant="body2">{user.contribuições} Contribuições</Typography>
<Typography variant="body2">{user.comentários} Comentários</Typography>
<Typography variant="body2">{user.ideias} Ideias</Typography>
<Typography variant="body2">{user.iniciativas} Iniciativas</Typography>
</Box>
</Paper>
))}
</Box>
);
};