Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error page #47

Merged
merged 6 commits into from
Aug 9, 2023
Merged
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _Can be run using `npm run codetotal:beta`_
- Doc: display linter icons

- Front-end

- Fix error page styles and apply the fallback error page to all routes
- Back-End

## [v0.2.0] - 2023-08-09
Expand Down Expand Up @@ -43,4 +43,3 @@ _Can be run using `npm run codetotal:beta`_
- Ready to use docker-compose using CodeTotal and MegaLinter images
- Online Documentation on <https://codetotal.io>
- Contributing instructions

2 changes: 1 addition & 1 deletion packages/app/src/analysis/actions/analysis-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
RepoAnalysis,
SnippetAnalysis,
} from "shared-types";
import { ApiUrl } from "../../common/utils/api-url-config";
import { ApiUrl } from "../../common/utils/backend-url";
import { AnalysisStore, AsyncState } from "../stores/analysis-store";

export const startAnalysis = async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/app/components/AppRouteProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const router = createBrowserRouter([
{
path: "/report/:requestId",
element: <LazyReportPage />,
errorElement: <ErrorPage />,
},
]);

Expand Down
47 changes: 34 additions & 13 deletions packages/app/src/app/components/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,47 @@
import { Typography } from "@mui/material";
import { Button, Theme, Typography } from "@mui/material";
import { FC } from "react";
import { NavLink } from "react-router-dom";
import { MdRefresh } from "react-icons/md";
import { makeStyles } from "tss-react/mui";

export const ErrorPage: FC = () => {
const { classes } = useStyles();

return (
<>
<header>
<Typography variant="h5">An unexpected error has occured</Typography>
</header>
<main className={classes.errorPage}>
<NavLink to="/">Back to homepage</NavLink>
</main>
</>
<div className={classes.errorPage}>
<div className={classes.emoji}>😳</div>
<Typography variant="h3" color="text.secondary">
Ooops!
</Typography>
<Typography variant="h5" color="text.secondary">
An unexpected error has occured
</Typography>
<Button
variant="contained"
color="primary"
component="a"
href="/"
className={classes.link}
startIcon={<MdRefresh />}
>
Refresh Page
</Button>
</div>
);
};

const useStyles = makeStyles()(() => ({
const useStyles = makeStyles()((theme: Theme) => ({
errorPage: {
display: "grid",
placeItems: "center",
display: "flex",
flexDirection: "column",
alignItems: "center",
paddingBlockStart: theme.spacing(10),
gap: theme.spacing(4),
},
emoji: {
fontSize: "3rem",
},
link: {
marginBlockStart: theme.spacing(5),
// color: theme.palette.text.primary,
},
}));
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from "axios";
import debounce from "lodash-es/debounce";
import { ProgrammingLanguage } from "shared-types";
import { ApiUrl } from "../../common/utils/api-url-config";
import { ApiUrl } from "../../common/utils/backend-url";
import { LanguagesStore } from "../stores/languages-store";

export const detect = async (
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/languages/actions/language-actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import { ProgrammingLanguage } from "shared-types";
import { ApiUrl } from "../../common/utils/api-url-config";
import { ApiUrl } from "../../common/utils/backend-url";
import { LanguagesStore } from "../stores/languages-store";

export const loadAllLanguages = async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/report/actions/init-report-action.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import { AnalysisStatus } from "shared-types";
import { ApiUrl } from "../../common/utils/api-url-config";
import { ApiUrl } from "../../common/utils/backend-url";
import { ReportStore } from "../stores/fe-report-store";
import { subscribeToReportProgress } from "./subscribe-report-action";

Expand Down