diff --git a/src/app/(auth)/oauth/page.tsx b/src/app/(auth)/oauth/page.tsx index 3e4ea2a..728f43d 100644 --- a/src/app/(auth)/oauth/page.tsx +++ b/src/app/(auth)/oauth/page.tsx @@ -1,33 +1,14 @@ 'use client'; -import { signIn, useSession } from 'next-auth/react'; -import { useRouter } from 'next/navigation'; -import { useEffect, useState } from 'react'; -import { useSearchParams } from 'next/navigation'; -import { Suspense } from 'react'; +import { signIn } from 'next-auth/react'; +import { useRouter, useSearchParams } from 'next/navigation'; +import { useEffect, useState, Suspense } from 'react'; import { toast } from 'sonner'; -import { useMutation } from '@tanstack/react-query'; import loadImage from '@/public/loading.gif'; import { CircularProgress } from '@mui/material'; -const signInWithToken = async ({ - token, - refresh, -}: { - token: string; - refresh: string; -}) => { - const result = await signIn('credentials', { - token, - refresh, - redirect: false, - }); -}; - const OAuthContent = () => { const router = useRouter(); - const { data: session } = useSession(); - const [message, setMessage] = useState('Carregando...'); const searchParams = useSearchParams(); const token = searchParams.get('token'); const refresh = searchParams.get('refresh'); @@ -45,7 +26,7 @@ const OAuthContent = () => { toast.error('Erro ao efetuar login, por favor tente novamente!'); router.push('/login'); } - + setIsPending(false); localStorage.setItem('token', JSON.stringify(token)); localStorage.setItem('refresh', JSON.stringify(refresh)); router.push('/home'); @@ -60,7 +41,7 @@ const OAuthContent = () => { return (
- {isPending ? : message} + {isPending ? : 'Carregando...'}
); }; diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index d4ba751..4387527 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -11,7 +11,6 @@ import { DialogActions, DialogContent, DialogTitle, - Button, Typography, } from '@mui/material'; @@ -90,7 +89,7 @@ const Admin: React.FC = () => { if (selectedUser && selectedRole) { try { const token = JSON.parse(localStorage.getItem('token')!); - await updateUserRole(selectedUser._id, selectedRole,token); + await updateUserRole(selectedUser._id, selectedRole, token); const updatedUsers = users.map((user) => user._id === selectedUser._id ? { ...user, role: selectedRole } diff --git a/src/app/forgot-password/page.tsx b/src/app/forgot-password/page.tsx index 539fa10..fa05491 100644 --- a/src/app/forgot-password/page.tsx +++ b/src/app/forgot-password/page.tsx @@ -2,7 +2,7 @@ import Image from 'next/image'; import MyButton from '@/components/ui/buttons/myButton.component'; -import { Box, TextField, Button } from '@mui/material'; +import { Box, TextField } from '@mui/material'; import { useMutation } from '@tanstack/react-query'; import calcuclusLogo from '@/public/calculus-logo.svg'; import { forgotPassword } from '@/services/user.service'; @@ -25,15 +25,15 @@ export default function ForgotPassword() { resolver: zodResolver(forgotPasswordSchema), }); - const { mutate, isPending } = useMutation({ + const { mutate } = useMutation({ mutationFn: async (data: ForgotPasswordData) => await forgotPassword(data), - onSuccess: (data) => { + onSuccess: () => { toast.success( 'Email enviado com sucesso! Verifique sua caixa de entrada para obter as instruções.', ); router.push('/'); }, - onError: (error) => { + onError: () => { toast.error( 'Ocorreu um erro ao enviar o email. Tente novamente mais tarde.', ); diff --git a/src/app/home/page.tsx b/src/app/home/page.tsx index c294cc2..bc3af1c 100644 --- a/src/app/home/page.tsx +++ b/src/app/home/page.tsx @@ -1,11 +1,6 @@ -'use client'; - -import { useSession } from 'next-auth/react'; import HomePrincipalPage from '@/components/home/homePage'; export default function HomePage() { - const { data: session } = useSession(); - return (
diff --git a/src/app/journey-page/[journeyId]/page.tsx b/src/app/journey-page/[journeyId]/page.tsx index 97f6f2f..35d418b 100644 --- a/src/app/journey-page/[journeyId]/page.tsx +++ b/src/app/journey-page/[journeyId]/page.tsx @@ -1,20 +1,31 @@ 'use client'; import React, { useEffect, useState } from 'react'; -import { Box, CircularProgress, Divider, IconButton, Typography } from '@mui/material'; +import { + Box, + CircularProgress, + Divider, + IconButton, + Typography, +} from '@mui/material'; import JourneyInfo from '@/components/journey/journeyInfo'; import JourneyPath from '@/components/journey/journeyPath'; -import { getJourney, getJourneysByPoint, getTrails } from '@/services/studioMaker.service'; +import { + getJourney, + getJourneysByPoint, + getTrails, +} from '@/services/studioMaker.service'; import { Journey } from '@/lib/interfaces/journey.interface'; import { Trail } from '@/lib/interfaces/trails.interface'; import { useParams, useRouter } from 'next/navigation'; -import { getSubscribedJourneys, } from '@/services/user.service'; +import { + getSubscribedJourneys, + getCompletedTrails, +} from '@/services/user.service'; import { useSession } from 'next-auth/react'; -import { getCompletedTrails } from '@/services/user.service'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; - export default function JourneyPage() { const { journeyId } = useParams(); const router = useRouter(); @@ -56,13 +67,17 @@ export default function JourneyPage() { const pointId = journeyData.point; if (pointId) { const relatedJourneys: Journey[] = await getJourneysByPoint(pointId); - const next = relatedJourneys.find(j => j.order === journeyData.order + 1); + const next = relatedJourneys.find( + (j) => j.order === journeyData.order + 1, + ); if (next != undefined) { setNextJourney(next); console.log(next); console.log(nextJourney); } - const previous = relatedJourneys.find(j => j.order === journeyData.order - 1); + const previous = relatedJourneys.find( + (j) => j.order === journeyData.order - 1, + ); if (previous != undefined) { setPreviousJourney(previous); console.log(previous); @@ -90,11 +105,11 @@ export default function JourneyPage() { const handleNext = async () => { router.push(`/journey-page/${nextJourney?._id}`); - } + }; const handlePrevious = async () => { router.push(`/journey-page/${previousJourney?._id}`); - } + }; if (error) { return
{error}
; @@ -109,45 +124,53 @@ export default function JourneyPage() { ); return ( - - {(previousJourney) && - + + {previousJourney && ( + - } - - {(nextJourney) && - + )} + + {nextJourney && ( + - } - + )} + - + - + {!trails.length ? ( ) : ( - - - + )} diff --git a/src/app/journey/[...pointId]/page.tsx b/src/app/journey/[...pointId]/page.tsx index e2cf2dc..b3cb4f7 100644 --- a/src/app/journey/[...pointId]/page.tsx +++ b/src/app/journey/[...pointId]/page.tsx @@ -27,7 +27,7 @@ import { toast } from 'sonner'; export default function JourneyPage({ params, }: { - params: { pointId: string }; + readonly params: { pointId: string }; }) { const fetchJourneys = async (): Promise => { let journeys = await getJourneysByPoint(params.pointId); @@ -85,8 +85,6 @@ export default function JourneyPage({ const handleJourneyAction = (action: string) => { if (action === 'editar') setEditionDialogOpen(true); - if (action === 'gerenciar') { - } if (action === 'excluir') setExclusionDialogOpen(true); }; @@ -116,20 +114,12 @@ export default function JourneyPage({ } }; - const handleCloseCreateDialog = () => { - setCreateDialogOpen(false); - }; - if (isLoading) { return ; } if (error) { - return ( - - Error fetching journeys: {(error as Error).message} - - ); + return Error fetching journeys; } return ( diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index 4b6a722..03bd19a 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Box, Typography, IconButton, Link, Grid } from '@mui/material'; +import { Box, Typography, Link, Grid } from '@mui/material'; import Image from 'next/image'; import maoCerebro from '@/public/mao_cerebro.png'; import { SingUpForm } from '@/components/forms/signUpForm'; diff --git a/src/app/reset-password/page.tsx b/src/app/reset-password/page.tsx index a038ec5..ac30da7 100644 --- a/src/app/reset-password/page.tsx +++ b/src/app/reset-password/page.tsx @@ -5,26 +5,19 @@ import { Box, TextField, IconButton, InputAdornment } from '@mui/material'; import { Visibility, VisibilityOff } from '@mui/icons-material'; import MyButton from '@/components/ui/buttons/myButton.component'; import calculusLogos from '@/public/calculus-logo.svg'; -import { useSearchParams } from 'next/navigation'; +import { useSearchParams, useRouter } from 'next/navigation'; import { ResetPasswordData, resetPasswordSchema, } from '@/lib/schemas/password.schema'; import { useForm, SubmitHandler } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; -import { useRouter } from 'next/navigation'; import { resetPassword } from '@/services/user.service'; import { useMutation } from '@tanstack/react-query'; import { toast } from 'sonner'; import { useState, Suspense } from 'react'; export default function ResetPassword() { - const SearchParamsComponent = () => { - const searchParams = useSearchParams(); - const token = searchParams.get('token'); - return { token }; - }; - return ( Loading...
}> @@ -47,7 +40,7 @@ function SearchParamsComponentWrapper() { resolver: zodResolver(resetPasswordSchema), }); - const { mutate, isPending } = useMutation({ + const { mutate } = useMutation({ mutationFn: async (data: any) => await resetPassword(data), onSuccess: (data) => { toast.success('Senha alterada com sucesso'); diff --git a/src/app/starting-points/page.tsx b/src/app/starting-points/page.tsx index 92f5787..60298ad 100644 --- a/src/app/starting-points/page.tsx +++ b/src/app/starting-points/page.tsx @@ -14,7 +14,7 @@ import { } from '@mui/material'; import ButtonRed from '@/components/ui/buttons/red.button'; import SearchBar from '@/components/admin/SearchBar'; -import StartpointTable from '@/components/tables/startingpoints.table'; +import StartPointTable from '@/components/tables/startingpoints.table'; import { StartPoint } from '@/lib/interfaces/startPoint.interface'; import { UserRole } from '@/lib/enum/userRole.enum'; import { @@ -32,7 +32,9 @@ const StartPointPage: React.FC = () => { const router = useRouter(); const { data: session } = useSession(); const [listStartPoints, setListStartPoints] = useState([]); - const [filteredStartPoints, setFilteredStartPoints] = useState([]); + const [filteredStartPoints, setFilteredStartPoints] = useState( + [], + ); const [searchQuery, setSearchQuery] = useState(''); const [selectedStartPoint, setSelectedStartPoint] = @@ -45,15 +47,15 @@ const StartPointPage: React.FC = () => { const fetchStartPoints = async (): Promise => { let startPoints: StartPoint[] = []; - + if (session?.user.role === UserRole.ADMIN) { startPoints = await getStartPoints(); } else { startPoints = await getStartPointsByUser(session?.user.id!); } - + startPoints.sort((a, b) => a.order - b.order); - + setListStartPoints(startPoints); setFilteredStartPoints(startPoints); return startPoints; @@ -99,9 +101,7 @@ const StartPointPage: React.FC = () => { if (action === 'excluir') setExclusionDialogOpen(true); if (action === 'gerenciar') { router.push(`/journey/${selectedStartPoint!._id}`); - } - }; const addStartPoint = (startPoint: StartPoint) => { @@ -137,11 +137,7 @@ const StartPointPage: React.FC = () => { } if (error) { - return ( - - Error fetching start points: {(error as Error).message} - - ); + return Error fetching start points; } const updateStartPoints = (updatedStartPoints: StartPoint[]) => { @@ -163,7 +159,7 @@ const StartPointPage: React.FC = () => { - { - const index = contents.findIndex(content => content._id === id); + const index = contents.findIndex((content) => content._id === id); if (index !== -1) { setContentId(id); setCurrentIndex(index); @@ -56,7 +54,6 @@ function TrailPage() { setContentId(contentsData[0]._id); setCurrentIndex(0); } - } catch (error) { setError('Failed to fetch trail data'); } @@ -66,7 +63,7 @@ function TrailPage() { }, [trailId]); useEffect(() => { - const index = contents.findIndex(content => content._id === contentId); + const index = contents.findIndex((content) => content._id === contentId); if (index !== -1) { setCurrentIndex(index); } @@ -78,7 +75,7 @@ function TrailPage() { setCurrentIndex(newIndex); setContentId(contents[newIndex]._id); } else if (trail && journey) { - const trailIndex = journey.trails!.findIndex(t => t === trail._id); + const trailIndex = journey.trails!.findIndex((t) => t === trail._id); if (trailIndex > 0) { const previousTrailId = journey.trails![trailIndex - 1]; router.push(`/trail-page/${previousTrailId}`); @@ -97,13 +94,13 @@ function TrailPage() { await completeTrail({ userId: session?.user.id as string, trailId: trail._id, - accessToken: session?.user.accessToken as string + accessToken: session?.user.accessToken as string, }); } catch (error) { console.error('Failed to complete trail:', error); } } - const trailIndex = journey.trails!.findIndex(t => t === trail._id); + const trailIndex = journey.trails!.findIndex((t) => t === trail._id); if (trailIndex < journey.trails!.length - 1) { const nextTrailId = journey.trails![trailIndex + 1]; router.push(`/trail-page/${nextTrailId}`); @@ -119,8 +116,13 @@ function TrailPage() { return Loading...; } - const isPreviousDisabled = currentIndex === 0 && journey.trails!.findIndex(t => t === trail._id) === 0; - const isNextDisabled = currentIndex === contents.length - 1 && journey.trails!.findIndex(t => t === trail._id) === journey.trails!.length - 1; + const isPreviousDisabled = + currentIndex === 0 && + journey.trails!.findIndex((t) => t === trail._id) === 0; + const isNextDisabled = + currentIndex === contents.length - 1 && + journey.trails!.findIndex((t) => t === trail._id) === + journey.trails!.length - 1; return ( - {currentIndex < contents.length - 1 ? <>Próximo Conteúdo : <>Próxima Trilha} + {currentIndex < contents.length - 1 ? ( + <>Próximo Conteúdo + ) : ( + <>Próxima Trilha + )} diff --git a/src/app/trail/[...journeyId]/page.tsx b/src/app/trail/[...journeyId]/page.tsx index 2930074..c4e7c51 100644 --- a/src/app/trail/[...journeyId]/page.tsx +++ b/src/app/trail/[...journeyId]/page.tsx @@ -13,9 +13,8 @@ import { useSession } from 'next-auth/react'; export default function ManageTrack({ params, }: { - params: { journeyId: string }; + readonly params: { journeyId: string }; }) { - const { data: session } = useSession(); const [jorney, setJorney] = useState({} as Journey); const fetchTrails = async (): Promise => { let trails = await getTrails({ @@ -42,19 +41,13 @@ export default function ManageTrack({ } if (error) { - return ( - - Error fetching journeys: {(error as Error).message} - - ); + return Error fetching journeys; } return ( - <> - -

{jorney.title}

- -
- + +

{jorney.title}

+ +
); } diff --git a/src/components/forms/journey.form.tsx b/src/components/forms/journey.form.tsx index c655f4e..a716c77 100644 --- a/src/components/forms/journey.form.tsx +++ b/src/components/forms/journey.form.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Box, Button, TextField } from '@mui/material'; +import { Box, TextField } from '@mui/material'; import { useForm, SubmitHandler } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { toast } from 'sonner'; diff --git a/src/components/forms/signInForm.tsx b/src/components/forms/signInForm.tsx index 4f21f43..f038898 100644 --- a/src/components/forms/signInForm.tsx +++ b/src/components/forms/signInForm.tsx @@ -1,13 +1,6 @@ 'use client'; -import { - Box, - Button, - IconButton, - InputAdornment, - Link, - TextField, -} from '@mui/material'; +import { Box, IconButton, InputAdornment, Link } from '@mui/material'; import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { SigninData, signinSchema } from '@/lib/schemas/singin.schemas'; @@ -46,7 +39,6 @@ export function SingInForm() { const { register, - handleSubmit, watch, formState: { errors }, } = useForm({ diff --git a/src/components/forms/signUpForm.tsx b/src/components/forms/signUpForm.tsx index 9b7ea84..1cca7e6 100644 --- a/src/components/forms/signUpForm.tsx +++ b/src/components/forms/signUpForm.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Box, Button, TextField } from '@mui/material'; +import { Box } from '@mui/material'; import { SignupData, signupSchema } from '@/lib/schemas/singup.schemas'; import { useForm, SubmitHandler } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; diff --git a/src/components/home/JourneyCard.tsx b/src/components/home/JourneyCard.tsx index 9e919b2..6168904 100644 --- a/src/components/home/JourneyCard.tsx +++ b/src/components/home/JourneyCard.tsx @@ -11,14 +11,16 @@ interface JourneyCardProps { } const JourneyCard: React.FC = ({ title, image, Id }) => { - const router = useRouter(); const handleClick = () => { router.push('/journey-page/' + Id); - } + }; return ( -
+
+ ); }; diff --git a/src/components/home/StartPointsCard.tsx b/src/components/home/StartPointsCard.tsx index 5290907..419319d 100644 --- a/src/components/home/StartPointsCard.tsx +++ b/src/components/home/StartPointsCard.tsx @@ -83,7 +83,7 @@ const StartCard: React.FC = ({ return (
-
{ setIsOpen(!isOpen); }} @@ -91,11 +91,11 @@ const StartCard: React.FC = ({ > {title}

{title}

-

{description || ""}

+

{description || ''}

{isOpen ? : }
-
+ {isOpen && (
{journeys.length > 0 ? ( @@ -105,7 +105,7 @@ const StartCard: React.FC = ({ key={index} className="h-52 w-58 flex flex-col items-center cursor-pointer " > -
handleOnclick(jornada._id)} > @@ -115,7 +115,7 @@ const StartCard: React.FC = ({ width={120} height={120} /> -
+

{jornada.title}

{index < journeys.length - 1 && ( @@ -134,4 +134,4 @@ const StartCard: React.FC = ({ ); }; -export default StartCard; \ No newline at end of file +export default StartCard; diff --git a/src/components/home/homePage.tsx b/src/components/home/homePage.tsx index bfd5f22..319fa84 100644 --- a/src/components/home/homePage.tsx +++ b/src/components/home/homePage.tsx @@ -1,3 +1,5 @@ +'use client'; + import React, { useState, useEffect } from 'react'; import Carousel from 'react-multi-carousel'; import 'react-multi-carousel/lib/styles.css'; @@ -15,8 +17,8 @@ const HomePrincipalPage = () => { const [allPoints, setAllPoints] = useState([]); useEffect(() => { - try { - const fetchJourneys = async () => { + const fetchJourneys = async () => { + try { const { fetchUserJourneys, fetchJourneyById } = JourneyService(); const journeyIds = await fetchUserJourneys(session); @@ -25,22 +27,20 @@ const HomePrincipalPage = () => { ); setUserJourneys(journeysDetails.filter((j) => j !== null)); - }; + } catch (error) { + console.log(error); + } + }; - fetchJourneys(); - } catch (error) { - console.log(error); - } + fetchJourneys(); }, [session]); - useEffect(() => { try { const loadPoints = async () => { const { fetchPoints } = JourneyService(); const allPoints = await fetchPoints(); - - allPoints.sort((a, b) => a.order - b.order); + allPoints!.sort((a, b) => a.order - b.order); setAllPoints(allPoints); }; loadPoints(); @@ -48,7 +48,7 @@ const HomePrincipalPage = () => { console.log(error); } }, []); - + const filteredPoints = searchQuery.length > 0 ? allPoints.filter( @@ -59,7 +59,7 @@ const HomePrincipalPage = () => { .includes(searchQuery.toLowerCase()), ) : []; - + const responsive = { superLargeDesktop: { breakpoint: { max: 4000, min: 3000 }, @@ -87,18 +87,16 @@ const HomePrincipalPage = () => { <>
Em andamento
{userJourneys.length > 0 ? ( - <> - - {userJourneys.map((jornada) => ( - - ))} - - + + {userJourneys.map((jornada) => ( + + ))} + ) : (

@@ -117,12 +115,12 @@ const HomePrincipalPage = () => {

{filteredPoints.map((jornada) => ( + key={jornada._id} + title={jornada.name} + description={jornada.description} + image={jornada.image || Foto} + Id={jornada._id} + /> ))}
) : ( diff --git a/src/components/home/service/home.services.tsx b/src/components/home/service/home.services.tsx index a8bc610..6f310ea 100644 --- a/src/components/home/service/home.services.tsx +++ b/src/components/home/service/home.services.tsx @@ -1,3 +1,4 @@ +import { StartPoint } from '@/lib/interfaces/startPoint.interface'; import axios from 'axios'; import { toast } from 'sonner'; @@ -42,33 +43,40 @@ const JourneyService = () => { } }; - const fetchPoints = async () =>{ - try { - const response = await axios.get(`${process.env.NEXT_PUBLIC_API_URL_STUDIO}/points/`); - return response.data; - } catch (error) { - console.error('Erro ao buscar pontos de partida:', error); - return null; - } + const fetchPoints = async (): Promise => { + try { + const response = await axios.get( + `${process.env.NEXT_PUBLIC_API_URL_STUDIO}/points/`, + ); + return response.data; + } catch (error) { + console.error('Erro ao buscar pontos de partida:', error); + throw error; } + }; - const fetchJourneybyPoint = async (id: string) => { - try { - const response = await axios.get(`${process.env.NEXT_PUBLIC_API_URL_STUDIO}/points/${id}/journeys`); - return response.data; - } catch (error) { - console.error(`Erro ao buscar jornadas do Ponto de Partida com ID ${id}:`, error); - return null; - } + const fetchJourneybyPoint = async (id: string) => { + try { + const response = await axios.get( + `${process.env.NEXT_PUBLIC_API_URL_STUDIO}/points/${id}/journeys`, + ); + return response.data; + } catch (error) { + console.error( + `Erro ao buscar jornadas do Ponto de Partida com ID ${id}:`, + error, + ); + return null; } + }; - return { - fetchUserJourneys, - fetchJourneys, - fetchJourneyById, - fetchPoints, - fetchJourneybyPoint, - }; + return { + fetchUserJourneys, + fetchJourneys, + fetchJourneyById, + fetchPoints, + fetchJourneybyPoint, + }; }; export default JourneyService; diff --git a/src/components/journey/journeyInfo.tsx b/src/components/journey/journeyInfo.tsx index ed9de00..32fb597 100644 --- a/src/components/journey/journeyInfo.tsx +++ b/src/components/journey/journeyInfo.tsx @@ -19,8 +19,7 @@ const JourneyInfo: React.FC = ({ hasJourney, completedTrailsCount, }) => { - - const progressValue = Math.floor(( completedTrailsCount / trailCount ) * 100); + const progressValue = Math.floor((completedTrailsCount / trailCount) * 100); return ( = ({ justifyContent: 'flex-end', }} ml={55} - > - + > ) : ( = ({ mb: 1, }} > - - Progresso: - - - {`${progressValue}%`} - + Progresso: + {`${progressValue}%`} = ({ sx={{ height: '8px', borderRadius: '5px', - backgroundColor: '#e0e0e0', + backgroundColor: '#e0e0e0', '& .MuiLinearProgress-bar': { backgroundColor: 'green', - borderRadius: '5px', + borderRadius: '5px', }, }} /> diff --git a/src/components/journey/journeyPath.tsx b/src/components/journey/journeyPath.tsx index 93b3e37..8dbed09 100644 --- a/src/components/journey/journeyPath.tsx +++ b/src/components/journey/journeyPath.tsx @@ -11,7 +11,11 @@ interface JourneyPathProps { hasJourney: boolean; } -const JourneyPath: React.FC = ({ trails, journeyId, hasJourney }) => { +const JourneyPath: React.FC = ({ + trails, + journeyId, + hasJourney, +}) => { const nodeSpacing = 120; const nodeSize = 80; const zigzagOffset = 100; @@ -28,7 +32,7 @@ const JourneyPath: React.FC = ({ trails, journeyId, hasJourney try { const completed = await getCompletedTrails(session.user.id); setCompletedTrails(completed); - console.log("resultado do completed: ", completed); + console.log('resultado do completed: ', completed); } catch (error) { console.error('Error fetching completed trails:', error); } @@ -44,8 +48,6 @@ const JourneyPath: React.FC = ({ trails, journeyId, hasJourney const svg = svgRef.current; const svgNS = 'http://www.w3.org/2000/svg'; const svgWidth = svg.clientWidth; - const svgHeight = svg.clientHeight; - const container = containerRef.current; while (svg.firstChild) { svg.removeChild(svg.firstChild); @@ -109,7 +111,7 @@ const JourneyPath: React.FC = ({ trails, journeyId, hasJourney position: 'relative', height: `${Math.max(trails.length * nodeSpacing + nodeSize + 50, 400)}px`, backgroundColor: '#f0f0f0', - overflow: 'hidden', + overflow: 'hidden', zIndex: 1, }} > @@ -148,7 +150,9 @@ const JourneyPath: React.FC = ({ trails, journeyId, hasJourney sx={{ width: `${nodeSize}px`, height: `${nodeSize}px`, - backgroundColor: completedTrails.includes(trail._id) ? 'green' : 'lightgray', + backgroundColor: completedTrails.includes(trail._id) + ? 'green' + : 'lightgray', borderRadius: '10px', boxShadow: '0 4px 8px rgba(0,0,0,0.3)', color: 'black', diff --git a/src/components/navBar.component.tsx b/src/components/navBar.component.tsx index 5502ef4..be2e265 100644 --- a/src/components/navBar.component.tsx +++ b/src/components/navBar.component.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { AppBar, Toolbar, IconButton, Typography, Box } from '@mui/material'; +import { AppBar, Toolbar, IconButton, Box } from '@mui/material'; import MenuIcon from '@mui/icons-material/Menu'; import Sidebar from './sidebar.component'; import { SignOutButton } from './ui/buttons/signOut.button'; diff --git a/src/components/studio/MarkdownPage.tsx b/src/components/studio/MarkdownPage.tsx index 02882ed..14cfd94 100644 --- a/src/components/studio/MarkdownPage.tsx +++ b/src/components/studio/MarkdownPage.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { useEffect, useRef, useState } from 'react'; +import React, { useEffect } from 'react'; import { Box, AppBar, Toolbar } from '@mui/material'; import { useSession } from 'next-auth/react'; import MarkdownToolbar from './MarkdownToolbar'; diff --git a/src/components/studio/MarkdownSidebar.tsx b/src/components/studio/MarkdownSidebar.tsx index 4202c0c..7855311 100644 --- a/src/components/studio/MarkdownSidebar.tsx +++ b/src/components/studio/MarkdownSidebar.tsx @@ -3,7 +3,7 @@ import { useMaterialReactTable, type MRT_ColumnDef, type MRT_Row, - MRT_TableContainer, + MRT_TableContainer as MrtTableContainer, } from 'material-react-table'; import { Box, IconButton, Button } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; @@ -47,7 +47,7 @@ const MarkdownSidebar: React.FC = ({