-
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.
Merge pull request #326 from rimorin/optimise_cd
chore: code optimisations
- Loading branch information
Showing
15 changed files
with
407 additions
and
288 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from "react"; | ||
import { Container, Card, Button } from "react-bootstrap"; | ||
import { useRouteError } from "react-router-dom"; | ||
|
||
interface ErrorPageProps { | ||
onRetry?: () => void; | ||
} | ||
|
||
const GenericErrorPage: React.FC<ErrorPageProps> = ({ onRetry }) => { | ||
const error = useRouteError() as Error; | ||
const title = "An Error Occurred"; | ||
const message = "We are sorry, something went wrong."; | ||
|
||
return ( | ||
<Container className="container-main"> | ||
<Card className="card-main"> | ||
<Card.Img | ||
alt="Ministry Mapper logo" | ||
className="mm-logo" | ||
src="/android-chrome-192x192.png" | ||
/> | ||
<Card.Body> | ||
<Card.Title className="text-center">{title}</Card.Title> | ||
<Card.Text className="text-center">{message}</Card.Text> | ||
{error && ( | ||
<Card.Text className="text-center"> | ||
<small>{error.message}</small> | ||
</Card.Text> | ||
)} | ||
{onRetry && ( | ||
<div className="text-center"> | ||
<Button onClick={onRetry}>Retry</Button> | ||
</div> | ||
)} | ||
</Card.Body> | ||
</Card> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default GenericErrorPage; |
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,25 +1,16 @@ | ||
import { StrictMode } from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import Main from "./pages/index"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
import { StrictMode } from "react"; | ||
import NiceModal from "@ebay/nice-modal-react"; | ||
import RollbarMiddleware from "./components/middlewares/rollbar"; | ||
import MapsMiddleware from "./components/middlewares/googlemap"; | ||
import PostHogMiddleware from "./components/middlewares/posthog"; | ||
|
||
const root = createRoot(document.getElementById("root") as HTMLElement); | ||
root.render( | ||
<StrictMode> | ||
<RollbarMiddleware> | ||
<PostHogMiddleware> | ||
<MapsMiddleware> | ||
<NiceModal.Provider> | ||
<BrowserRouter> | ||
<Main /> | ||
</BrowserRouter> | ||
</NiceModal.Provider> | ||
</MapsMiddleware> | ||
</PostHogMiddleware> | ||
</RollbarMiddleware> | ||
</StrictMode> | ||
); | ||
const rootElement = document.getElementById("root"); | ||
|
||
if (rootElement) { | ||
const root = createRoot(rootElement); | ||
root.render( | ||
<StrictMode> | ||
<Main /> | ||
</StrictMode> | ||
); | ||
} else { | ||
console.error("Root element not found"); | ||
} |
Oops, something went wrong.