Add 404 page, three phone numbers, fix nginx try_files
This commit is contained in:
17
src/App.jsx
17
src/App.jsx
@@ -1,8 +1,9 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { LanguageProvider, useLanguage } from './contexts/LanguageContext.jsx'
|
||||
import Navigation from './components/Navigation.jsx'
|
||||
import Footer from './components/Footer.jsx'
|
||||
import Home from './pages/Home.jsx'
|
||||
import NotFound from './pages/NotFound.jsx'
|
||||
|
||||
function LangSync() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -12,13 +13,25 @@ function LangSync() {
|
||||
return null
|
||||
}
|
||||
|
||||
function Router() {
|
||||
const [path, setPath] = useState(window.location.pathname)
|
||||
useEffect(() => {
|
||||
const handler = () => setPath(window.location.pathname)
|
||||
window.addEventListener('popstate', handler)
|
||||
return () => window.removeEventListener('popstate', handler)
|
||||
}, [])
|
||||
|
||||
const isHome = path === '/' || path === '/index.html'
|
||||
return isHome ? <Home /> : <NotFound />
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<LanguageProvider>
|
||||
<LangSync />
|
||||
<Navigation />
|
||||
<main>
|
||||
<Home />
|
||||
<Router />
|
||||
</main>
|
||||
<Footer />
|
||||
</LanguageProvider>
|
||||
|
||||
Reference in New Issue
Block a user