2023-11-05 14:13:34 +03:00
|
|
|
import { Suspense } from 'react';
|
|
|
|
|
2023-11-03 12:06:55 +03:00
|
|
|
import { Routes, Route, Outlet } from "react-router-dom";
|
|
|
|
import Home from "./pages/Home";
|
|
|
|
import About from "./pages/About";
|
|
|
|
import Dashboard from "./pages/Dashboard";
|
2023-11-13 02:46:50 +03:00
|
|
|
import ToPdf from "./pages/convert/ToPdf"
|
2023-11-03 12:06:55 +03:00
|
|
|
import NoMatch from "./pages/NoMatch";
|
|
|
|
import NavBar from "./components/NavBar";
|
|
|
|
|
2023-11-04 14:03:09 +03:00
|
|
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
2023-11-05 14:13:34 +03:00
|
|
|
import { Container } from "react-bootstrap";
|
|
|
|
|
|
|
|
import i18n from "i18next";
|
|
|
|
import { useTranslation, initReactI18next } from "react-i18next";
|
|
|
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
|
|
import ar from './locales/ar.json';
|
|
|
|
import en from './locales/en.json';
|
|
|
|
|
|
|
|
import './general.css'
|
|
|
|
|
|
|
|
i18n
|
|
|
|
.use(LanguageDetector)
|
|
|
|
.use(initReactI18next) // passes i18n down to react-i18next
|
|
|
|
.init({
|
|
|
|
fallbackLng: "en",
|
|
|
|
resources: { ar,en },
|
|
|
|
});
|
2023-11-04 14:03:09 +03:00
|
|
|
|
2023-11-03 12:06:55 +03:00
|
|
|
export default function App() {
|
2023-11-05 14:13:34 +03:00
|
|
|
|
2023-10-28 19:56:16 +03:00
|
|
|
return (
|
2023-11-05 14:13:34 +03:00
|
|
|
<Suspense fallback="loading">
|
2023-11-03 12:06:55 +03:00
|
|
|
{/* Routes nest inside one another. Nested route paths build upon
|
|
|
|
parent route paths, and nested route elements render inside
|
|
|
|
parent route elements. See the note about <Outlet> below. */}
|
|
|
|
<Routes>
|
|
|
|
<Route path="/" element={<Layout />}>
|
|
|
|
<Route index element={<Home />} />
|
|
|
|
<Route path="about" element={<About />} />
|
|
|
|
<Route path="dashboard" element={<Dashboard />} />
|
2023-11-13 02:46:50 +03:00
|
|
|
<Route path="to-pdf" element={<ToPdf />} />
|
2023-11-03 12:06:55 +03:00
|
|
|
|
|
|
|
{/* Using path="*"" means "match anything", so this route
|
|
|
|
acts like a catch-all for URLs that we don't have explicit
|
|
|
|
routes for. */}
|
|
|
|
<Route path="*" element={<NoMatch />} />
|
|
|
|
</Route>
|
|
|
|
</Routes>
|
2023-11-05 14:13:34 +03:00
|
|
|
</Suspense>
|
2023-11-03 12:06:55 +03:00
|
|
|
);
|
|
|
|
}
|
2023-10-28 19:56:16 +03:00
|
|
|
|
2023-11-03 12:06:55 +03:00
|
|
|
function Layout() {
|
2023-11-05 14:13:34 +03:00
|
|
|
const { t } = useTranslation();
|
2023-11-03 12:06:55 +03:00
|
|
|
return (
|
2023-11-05 14:13:34 +03:00
|
|
|
<div lang-direction={t('language.direction')}>
|
2023-11-04 14:03:09 +03:00
|
|
|
<NavBar/>
|
2023-10-29 20:19:59 +02:00
|
|
|
|
2023-11-03 12:06:55 +03:00
|
|
|
{/* An <Outlet> renders whatever child route is currently active,
|
|
|
|
so you can think about this <Outlet> as a placeholder for
|
|
|
|
the child routes we defined above. */}
|
2023-11-04 14:03:09 +03:00
|
|
|
<Container fluid="sm" className="">
|
|
|
|
<div className="row justify-content-center">
|
|
|
|
<div className="col-md-6">
|
|
|
|
<Outlet/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Container>
|
2023-10-28 19:56:16 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|