-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
6,944 additions
and
6,778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
|
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { FC, ReactNode } from "react"; | ||
|
||
import { APIProvider } from "@vis.gl/react-google-maps"; | ||
interface MapsMiddlewareProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MapsMiddleware: FC<MapsMiddlewareProps> = ({ children }) => { | ||
const { VITE_GOOGLE_MAPS_API_KEY } = import.meta.env; | ||
if (!VITE_GOOGLE_MAPS_API_KEY) { | ||
return <div>Missing Google Maps API Key</div>; | ||
} | ||
return ( | ||
<APIProvider apiKey={VITE_GOOGLE_MAPS_API_KEY}>{children}</APIProvider> | ||
); | ||
}; | ||
|
||
export default MapsMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { FC, ReactNode } from "react"; | ||
import { Container } from "react-bootstrap"; | ||
import VersionDisplay from "../navigation/versiondisplay"; | ||
interface MainMiddlewareProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MainMiddleware: FC<MainMiddlewareProps> = ({ children }) => { | ||
return ( | ||
<Container className="pt-2" fluid> | ||
{children} | ||
<VersionDisplay /> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default MainMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FC, useState, useEffect, ReactNode, Suspense, lazy } from "react"; | ||
import { child, onValue, ref } from "firebase/database"; | ||
import { database } from "../../firebase"; | ||
import Loader from "../statics/loader"; | ||
const MaintenanceMode = lazy(() => import("../statics/maintenance")); | ||
|
||
interface MaintenanceMiddlewareProps { | ||
children: ReactNode; | ||
} | ||
|
||
const MaintenanceMiddleware: FC<MaintenanceMiddlewareProps> = ({ | ||
children | ||
}) => { | ||
const [isMaintenance, setIsMaintenance] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
const maintenanceReference = child(ref(database), `/maintenance`); | ||
onValue(maintenanceReference, (snapshot) => { | ||
if (snapshot.exists()) { | ||
setIsMaintenance(snapshot.val()); | ||
} | ||
}); | ||
}, []); | ||
|
||
if (isMaintenance) | ||
return ( | ||
<Suspense fallback={<Loader />}> | ||
<MaintenanceMode /> | ||
</Suspense> | ||
); | ||
|
||
return <>{children}</>; | ||
}; | ||
|
||
export default MaintenanceMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Provider } from "@rollbar/react"; | ||
import { FC, ReactNode } from "react"; | ||
|
||
interface RollbarProviderProps { | ||
children: ReactNode; | ||
} | ||
|
||
const { VITE_ROLLBAR_ACCESS_TOKEN, VITE_ROLLBAR_ENVIRONMENT, VITE_VERSION } = | ||
import.meta.env; | ||
|
||
const DEFEAULT_ROLLBAR_ENVIRONMENT = "staging"; | ||
|
||
const rollbarConfig = { | ||
accessToken: VITE_ROLLBAR_ACCESS_TOKEN, | ||
payload: { | ||
environment: VITE_ROLLBAR_ENVIRONMENT || DEFEAULT_ROLLBAR_ENVIRONMENT, | ||
client: { | ||
javascript: { | ||
source_map_enabled: true, | ||
code_version: VITE_VERSION | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const RollbarMiddleware: FC<RollbarProviderProps> = ({ children }) => { | ||
return <Provider config={rollbarConfig}>{children}</Provider>; | ||
}; | ||
|
||
export default RollbarMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { FC } from "react"; | ||
|
||
const VersionDisplay: FC = () => { | ||
return ( | ||
<div className="fixed-bottom text-muted opacity-25 m-2"> | ||
<>v{import.meta.env.VITE_VERSION}</> | ||
</div> | ||
); | ||
}; | ||
|
||
export default VersionDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,22 @@ | ||
import { createRoot } from "react-dom/client"; | ||
import Main from "./pages/index"; | ||
import reportWebVitals from "./reportWebVitals"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { StrictMode } from "react"; | ||
import { Provider } from "@rollbar/react"; | ||
import NiceModal from "@ebay/nice-modal-react"; | ||
import { APIProvider } from "@vis.gl/react-google-maps"; | ||
const { VITE_ROLLBAR_ACCESS_TOKEN, VITE_ROLLBAR_ENVIRONMENT, VITE_VERSION } = | ||
import.meta.env; | ||
|
||
const DEFEAULT_ROLLBAR_ENVIRONMENT = "staging"; | ||
|
||
const rollbarConfig = { | ||
accessToken: VITE_ROLLBAR_ACCESS_TOKEN, | ||
payload: { | ||
environment: VITE_ROLLBAR_ENVIRONMENT || DEFEAULT_ROLLBAR_ENVIRONMENT, | ||
client: { | ||
javascript: { | ||
source_map_enabled: true, | ||
code_version: VITE_VERSION | ||
} | ||
} | ||
} | ||
}; | ||
import RollbarMiddleware from "./components/middlewares/rollbar"; | ||
import MapsMiddleware from "./components/middlewares/googlemap"; | ||
|
||
const root = createRoot(document.getElementById("root") as HTMLElement); | ||
root.render( | ||
<StrictMode> | ||
<Provider config={rollbarConfig}> | ||
<APIProvider apiKey={import.meta.env.VITE_GOOGLE_MAPS_API_KEY}> | ||
<RollbarMiddleware> | ||
<MapsMiddleware> | ||
<NiceModal.Provider> | ||
<BrowserRouter> | ||
<Main /> | ||
</BrowserRouter> | ||
</NiceModal.Provider> | ||
</APIProvider> | ||
</Provider> | ||
</MapsMiddleware> | ||
</RollbarMiddleware> | ||
</StrictMode> | ||
); | ||
|
||
// If you want to start measuring performance in your app, pass a function | ||
// to log results (for example: reportWebVitals(console.log)) | ||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals | ||
reportWebVitals(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.