Skip to content
Draft
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
4 changes: 4 additions & 0 deletions Premocidade/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const nextConfig = {
path: '',
},
trailingSlash: true,
// Improve SEO
poweredByHeader: false,
// Better compression
compress: true,
}

module.exports = nextConfig
98 changes: 49 additions & 49 deletions Premocidade/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Premocidade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"dependencies": {
"compression": "^1.8.0",
"express": "^4.18.2",
"next": "^13.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "^13.5.11",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/node": "^20.17.19",
Expand Down
62 changes: 62 additions & 0 deletions Premocidade/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, { Component, ReactNode } from 'react';

interface Props {
children: ReactNode;
}

interface State {
hasError: boolean;
error?: Error;
}

export default class ErrorBoundary extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = { hasError: false };
}

static getDerivedStateFromError(error: Error): State {
return { hasError: true, error };
}

componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
console.error('ErrorBoundary caught an error:', error, errorInfo);
}

render() {
if (this.state.hasError) {
return (
<div style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
minHeight: '100vh',
padding: '2rem',
backgroundColor: '#1a1a2e',
color: 'white',
textAlign: 'center'
}}>
<h1>Algo deu errado 😔</h1>
<p>Desculpe, ocorreu um erro inesperado.</p>
<button
onClick={() => this.setState({ hasError: false })}
style={{
padding: '0.5rem 1rem',
backgroundColor: '#4CAF50',
color: 'white',
border: 'none',
borderRadius: '4px',
cursor: 'pointer',
marginTop: '1rem'
}}
>
Tentar novamente
</button>
</div>
);
}

return this.props.children;
}
}
10 changes: 8 additions & 2 deletions Premocidade/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ export default function Layout({ children, title = 'Premocidade' }: LayoutProps)
<div className="layout">
<Head>
<title key="title">{pageTitle}</title>
<meta name="description" content="Programa de Premocidade da Aliança Espírita Evangélica" />
<meta name="description" content="Programa de Premocidade da Aliança Espírita Evangélica - Aprenda os ensinamentos de Jesus através de atividades interativas e dinâmicas" />
<meta name="keywords" content="premocidade, precamp, espiritismo, Jesus, educação espiritual, atividades educativas" />
<meta name="author" content="Aliança Espírita Evangélica" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" sizes="any" />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content="Programa de Premocidade da Aliança Espírita Evangélica" />
<meta property="og:type" content="website" />
<link rel="icon" href="/favicon.png" type="image/png" sizes="any" />
<link rel="canonical" href="https://roma0589.github.io/Precamp/" />
</Head>

<header className="header">
Expand Down
23 changes: 18 additions & 5 deletions Premocidade/src/components/Stars.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import React from 'react';
import React, { useMemo } from 'react';

const Stars = () => {
// Generate fixed positions to avoid server/client mismatch
const starPositions = useMemo(() => {
const positions = [];
// Use deterministic positions instead of Math.random()
for (let i = 0; i < 50; i++) {
const x = (i * 37) % 100; // Pseudo-random but deterministic
const y = (i * 23) % 100;
const delay = (i * 0.1) % 3;
positions.push({ x, y, delay });
}
return positions;
}, []);

return (
<div className="stars">
{[...Array(50)].map((_, i) => (
{starPositions.map((position, i) => (
<div
key={i}
className={`star star--${i % 3 === 0 ? 'small' : i % 3 === 1 ? 'medium' : 'large'}`}
style={{
left: `${Math.random() * 100}%`,
top: `${Math.random() * 100}%`,
animationDelay: `${Math.random() * 3}s`
left: `${position.x}%`,
top: `${position.y}%`,
animationDelay: `${position.delay}s`
}}
/>
))}
Expand Down
5 changes: 3 additions & 2 deletions Premocidade/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import '../styles/globals.css'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import Head from 'next/head'
import ErrorBoundary from '../components/ErrorBoundary'

function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter()
Expand All @@ -26,12 +27,12 @@ function MyApp({ Component, pageProps }: AppProps) {
}, [router])

return (
<>
<ErrorBoundary>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</Head>
<Component {...pageProps} />
</>
</ErrorBoundary>
)
}

Expand Down
3 changes: 2 additions & 1 deletion Premocidade/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export default function Document() {
<Html lang="pt-BR">
<Head>
<meta charSet="utf-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/favicon.png" type="image/png" />
<meta name="theme-color" content="#000000" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
</Head>
Expand Down
Loading