From 34b7c8a4928a53c9d21d3257f02b9d0a7f69a46c Mon Sep 17 00:00:00 2001 From: Itay Date: Tue, 8 Aug 2023 22:21:48 +0300 Subject: [PATCH 1/5] Error page --- CHANGELOG.md | 6 +++ .../src/analysis/actions/analysis-actions.ts | 2 +- packages/app/src/app/components/ErrorPage.tsx | 47 ++++++++++++++----- .../{api-url-config.ts => backend-url.ts} | 0 .../actions/detect-language-actions.ts | 2 +- .../src/languages/actions/language-actions.ts | 2 +- .../src/report/actions/init-report-action.ts | 2 +- 7 files changed, 44 insertions(+), 17 deletions(-) rename packages/app/src/common/utils/{api-url-config.ts => backend-url.ts} (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff596d..768c25d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] (beta, main branch content) + - Language selection in snippet analysis form + - Language name added next to the icon in report header + - "CodeTotal" text added to the footer - Use `latest` codetotal-server docker image in production docker-compose.yml - Deploy online doc when any markdown file is updated @@ -20,4 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Ready to use docker-compose using CodeTotal and MegaLinter images - Online Documentation on - Contributing instructions +<<<<<<< Updated upstream +======= +>>>>>>> Stashed changes diff --git a/packages/app/src/analysis/actions/analysis-actions.ts b/packages/app/src/analysis/actions/analysis-actions.ts index 0563d74..fe8bf73 100644 --- a/packages/app/src/analysis/actions/analysis-actions.ts +++ b/packages/app/src/analysis/actions/analysis-actions.ts @@ -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 () => { diff --git a/packages/app/src/app/components/ErrorPage.tsx b/packages/app/src/app/components/ErrorPage.tsx index 063a35b..3a6530d 100644 --- a/packages/app/src/app/components/ErrorPage.tsx +++ b/packages/app/src/app/components/ErrorPage.tsx @@ -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 ( - <> -
- An unexpected error has occured -
-
- Back to homepage -
- +
+
😳
+ + Ooops! + + + An unexpected error has occured + + +
); }; -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, }, })); diff --git a/packages/app/src/common/utils/api-url-config.ts b/packages/app/src/common/utils/backend-url.ts similarity index 100% rename from packages/app/src/common/utils/api-url-config.ts rename to packages/app/src/common/utils/backend-url.ts diff --git a/packages/app/src/languages/actions/detect-language-actions.ts b/packages/app/src/languages/actions/detect-language-actions.ts index fea1ab9..baa4810 100644 --- a/packages/app/src/languages/actions/detect-language-actions.ts +++ b/packages/app/src/languages/actions/detect-language-actions.ts @@ -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 ( diff --git a/packages/app/src/languages/actions/language-actions.ts b/packages/app/src/languages/actions/language-actions.ts index fb9c5e5..bb6e015 100644 --- a/packages/app/src/languages/actions/language-actions.ts +++ b/packages/app/src/languages/actions/language-actions.ts @@ -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 () => { diff --git a/packages/app/src/report/actions/init-report-action.ts b/packages/app/src/report/actions/init-report-action.ts index facb1c6..75c4f64 100644 --- a/packages/app/src/report/actions/init-report-action.ts +++ b/packages/app/src/report/actions/init-report-action.ts @@ -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"; From 97eff2b9eb889f3007665283aa2a59c26f8f0a94 Mon Sep 17 00:00:00 2001 From: Itay Date: Tue, 8 Aug 2023 22:23:46 +0300 Subject: [PATCH 2/5] Add error page to report page as well --- packages/app/src/app/components/AppRouteProvider.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/app/src/app/components/AppRouteProvider.tsx b/packages/app/src/app/components/AppRouteProvider.tsx index 3f958cb..34eaa52 100644 --- a/packages/app/src/app/components/AppRouteProvider.tsx +++ b/packages/app/src/app/components/AppRouteProvider.tsx @@ -17,6 +17,7 @@ const router = createBrowserRouter([ { path: "/report/:requestId", element: , + errorElement: , }, ]); From 4c8505278ca6dc41007fe1ba7d9bd902f4a7ad8c Mon Sep 17 00:00:00 2001 From: itayox Date: Tue, 8 Aug 2023 19:27:00 +0000 Subject: [PATCH 3/5] [MegaLinter] Apply linters fixes --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 768c25d..bfe13bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] (beta, main branch content) - - Language selection in snippet analysis form - - Language name added next to the icon in report header - - "CodeTotal" text added to the footer +- Language selection in snippet analysis form +- Language name added next to the icon in report header +- "CodeTotal" text added to the footer - Use `latest` codetotal-server docker image in production docker-compose.yml - Deploy online doc when any markdown file is updated From 4cc26e375e0f54ff9af9874d5f510145321d17d2 Mon Sep 17 00:00:00 2001 From: Itay Date: Wed, 9 Aug 2023 12:59:41 +0300 Subject: [PATCH 4/5] Fix bad merge --- CHANGELOG.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfe13bf..680b9a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] (beta, main branch content) -- Language selection in snippet analysis form -- Language name added next to the icon in report header -- "CodeTotal" text added to the footer - - Use `latest` codetotal-server docker image in production docker-compose.yml - Deploy online doc when any markdown file is updated - Language selection in snippet analysis form @@ -23,7 +19,3 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Ready to use docker-compose using CodeTotal and MegaLinter images - Online Documentation on - Contributing instructions -<<<<<<< Updated upstream - -======= ->>>>>>> Stashed changes From 85f3598616bcfaa61fdc5d4e85cb9a56e7d20403 Mon Sep 17 00:00:00 2001 From: Itay Date: Wed, 9 Aug 2023 13:04:51 +0300 Subject: [PATCH 5/5] Add changelog message about error page --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b759f..bd842ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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