Skip to content

Commit

Permalink
refactor: remove code unused
Browse files Browse the repository at this point in the history
  • Loading branch information
everton-dgn committed Feb 9, 2024
1 parent 1a19c7f commit 6f2006e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 66 deletions.
29 changes: 8 additions & 21 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import Image from 'next/image'
import { useRouter } from 'next/navigation'
import { useContext, useEffect } from 'react'

import { DataContext } from 'hooks/UseContext'
import { useEffect } from 'react'

import S from 'app/styles.module.scss'

Expand All @@ -16,7 +14,6 @@ export const Error = ({
reset: () => void
}) => {
const { push } = useRouter()
const { hasNetwork } = useContext(DataContext)

useEffect(() => {
// eslint-disable-next-line no-console
Expand All @@ -28,23 +25,13 @@ export const Error = ({
<h1>Erro 404</h1>
<div className={S.container}>
<div className={S.containImg}>
{hasNetwork ? (
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
priority
/>
) : (
<img
src="/img/not-found.svg"
alt="Erro 404"
width="400"
height="400"
fetchPriority="high"
/>
)}
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
priority
/>
</div>

<p className={S.paragraph}>
Expand Down
25 changes: 6 additions & 19 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import Image from 'next/image'
import { useRouter } from 'next/navigation'
import { useContext } from 'react'

import quicksand from 'theme/fontFamily'

import { DataContext } from 'hooks/UseContext'

import 'theme/reset.scss'
import 'theme/components/index.scss'
import S from './styles.module.scss'
Expand All @@ -19,7 +16,6 @@ type ErrorProps = {

const GlobalError = ({ error, reset }: ErrorProps) => {
const { push } = useRouter()
const { hasNetwork } = useContext(DataContext)
// eslint-disable-next-line no-console
console.log(error, reset)

Expand All @@ -45,21 +41,12 @@ const GlobalError = ({ error, reset }: ErrorProps) => {
<h1>Erro 404</h1>
<div className={S.container}>
<div className={S.containImg}>
{hasNetwork ? (
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
/>
) : (
<img
src="/img/not-found.svg"
alt="Erro 404"
width="400"
height="400"
/>
)}
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
/>
</div>

<p className={S.paragraph}>
Expand Down
28 changes: 7 additions & 21 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,24 @@

import Image from 'next/image'
import { useRouter } from 'next/navigation'
import { useContext } from 'react'

import { DataContext } from 'hooks/UseContext'

import S from 'app/styles.module.scss'

const NotFound = () => {
const { push } = useRouter()
const { hasNetwork } = useContext(DataContext)

return (
<>
<h1>Erro 404</h1>
<div className={S.container}>
<div className={S.containImg}>
{hasNetwork ? (
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
priority
/>
) : (
<img
src="/img/not-found.svg"
alt="Erro 404"
width="400"
height="400"
fetchPriority="high"
/>
)}
<Image
src="/img/not-found.svg"
alt="Erro 404"
width={400}
height={400}
priority
/>
</div>

<p className={S.paragraph}>
Expand Down
8 changes: 3 additions & 5 deletions src/providers/mainProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import type { ReactNode } from 'react'

import { enableReactTracking } from '@legendapp/state/config/enableReactTracking'

import { DataStorage } from 'hooks/UseContext'

import type { MainProvidersProps } from './types'
import 'infra/store/configPersist'

enableReactTracking({ auto: true })

export const MainProvider = ({ children }: MainProvidersProps): ReactNode => {
return <DataStorage>{children}</DataStorage>
}
export const MainProvider = ({ children }: MainProvidersProps): ReactNode => (
<>{children}</>
)

0 comments on commit 6f2006e

Please sign in to comment.