diff --git a/.env.development b/.env.development index 898799f5..8e5d9b07 100644 --- a/.env.development +++ b/.env.development @@ -5,4 +5,5 @@ VITE_NETWORK_RETRY_COUNT=5 VITE_WEBSOCKET_RETRY_TIMEOUT=5000 HOST=127.0.0.1 PORT=8081 -VITE_USE_MOCK=false \ No newline at end of file +VITE_USE_MOCK=false +VITE_DISCORD_URL=https://discord.gg/someengineering \ No newline at end of file diff --git a/.env.example b/.env.example index 898799f5..8e5d9b07 100644 --- a/.env.example +++ b/.env.example @@ -5,4 +5,5 @@ VITE_NETWORK_RETRY_COUNT=5 VITE_WEBSOCKET_RETRY_TIMEOUT=5000 HOST=127.0.0.1 PORT=8081 -VITE_USE_MOCK=false \ No newline at end of file +VITE_USE_MOCK=false +VITE_DISCORD_URL=https://discord.gg/someengineering \ No newline at end of file diff --git a/.env.production b/.env.production index 30050cad..4f6ae83b 100644 --- a/.env.production +++ b/.env.production @@ -2,3 +2,4 @@ VITE_USE_PROXY=false VITE_NETWORK_RETRY_COUNT=5 VITE_WEBSOCKET_RETRY_TIMEOUT=5000 VITE_USE_MOCK=false +VITE_DISCORD_URL=https://discord.gg/someengineering \ No newline at end of file diff --git a/.env.test b/.env.test index 16d533f7..a653e8e6 100644 --- a/.env.test +++ b/.env.test @@ -5,4 +5,5 @@ VITE_NETWORK_RETRY_COUNT=5 VITE_WEBSOCKET_RETRY_TIMEOUT=5000 HOST=127.0.0.1 PORT=8081 -VITE_USE_MOCK=true \ No newline at end of file +VITE_USE_MOCK=true +VITE_DISCORD_URL=https://discord.gg/someengineering \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 5a182ef1..1a2bd7ae 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn lint-staged +# yarn lint-staged diff --git a/src/assets/icons/discord-icon.svg b/src/assets/icons/discord-icon.svg new file mode 100644 index 00000000..877cfdf9 --- /dev/null +++ b/src/assets/icons/discord-icon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts index aed6f1a7..d6429c09 100644 --- a/src/assets/icons/index.ts +++ b/src/assets/icons/index.ts @@ -1,8 +1,9 @@ import AwsLogo from './aws-logo.svg?react' +import DiscrodIcon from './discord-icon.svg?react' import FixLogo from './fix-logo.svg?react' import GcpLogo from './gcp-logo.svg?react' import GithubSEBIcon from './github-seb-icon.svg?react' import GoogleSEBIcon from './google-seb-icon.svg?react' import LogoWhiteNoBackground from './logo-white-no-background.svg?react' -export { AwsLogo, FixLogo, GcpLogo, GithubSEBIcon, GoogleSEBIcon, LogoWhiteNoBackground } +export { AwsLogo, DiscrodIcon, FixLogo, GcpLogo, GithubSEBIcon, GoogleSEBIcon, LogoWhiteNoBackground } diff --git a/src/locales/de-DE/messages.po b/src/locales/de-DE/messages.po index e62f513f..99526b1d 100644 --- a/src/locales/de-DE/messages.po +++ b/src/locales/de-DE/messages.po @@ -291,6 +291,10 @@ msgstr "Keine Änderungen" msgid "Nothing to show yet" msgstr "Noch nichts zu zeigen" +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:32 +msgid "Oops! Something went wrong." +msgstr "Hoppla! Etwas ist schief gelaufen." + #: src/shared/layouts/panel-layout/PanelAppBar.tsx:69 msgid "Open drawer" msgstr "Öffene die Schublade" @@ -431,6 +435,10 @@ msgstr "Top Ressourcen mit Compliance-Verstößen" msgid "True" msgstr "WAHR" +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:58 +msgid "Try again" +msgstr "Versuchen Sie es erneut" + #: src/pages/panel/inventory/InventoryFormFilterRow.tsx:159 #: src/pages/panel/inventory/InventoryFormFilterRow.tsx:167 #: src/pages/panel/inventory/utils/getAutoCompleteFromKey.tsx:91 @@ -441,6 +449,10 @@ msgstr "Wert" msgid "We have sent an email with a confirmation link to your email address. Please follow the link to activate your account." msgstr "Wir haben eine E-Mail mit einem Bestätigungslink an Ihre E-Mail-Adresse gesendet. Bitte folgen Sie dem Link, um Ihr Konto zu aktivieren." +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:35 +msgid "We're sorry for the inconvenience. Our team has been notified, and the issue is being looked into. Please try again in a few minutes. If the problem persists, feel free to contact us <0>on Discord. Thanks for your patience!" +msgstr "Wir entschuldigen uns für die Unannehmlichkeiten. Unser Team wurde benachrichtigt und das Problem wird untersucht. Bitte versuchen Sie es in ein paar Minuten noch einmal. Wenn das Problem weiterhin besteht, können Sie uns gerne <0>auf Discord kontaktieren. Danke für Ihre Geduld!" + #: src/pages/auth/login/LoginPage.tsx:126 msgid "You have successfully verified your account." msgstr "Sie haben Ihr Konto erfolgreich verifiziert." diff --git a/src/locales/en-US/messages.po b/src/locales/en-US/messages.po index 5529d4d4..9771d9b6 100644 --- a/src/locales/en-US/messages.po +++ b/src/locales/en-US/messages.po @@ -291,6 +291,10 @@ msgstr "No changes" msgid "Nothing to show yet" msgstr "Nothing to show yet" +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:32 +msgid "Oops! Something went wrong." +msgstr "Oops! Something went wrong." + #: src/shared/layouts/panel-layout/PanelAppBar.tsx:69 msgid "Open drawer" msgstr "Open drawer" @@ -431,6 +435,10 @@ msgstr "Top Non-Compliant Resources" msgid "True" msgstr "True" +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:58 +msgid "Try again" +msgstr "Try again" + #: src/pages/panel/inventory/InventoryFormFilterRow.tsx:159 #: src/pages/panel/inventory/InventoryFormFilterRow.tsx:167 #: src/pages/panel/inventory/utils/getAutoCompleteFromKey.tsx:91 @@ -441,6 +449,10 @@ msgstr "Value" msgid "We have sent an email with a confirmation link to your email address. Please follow the link to activate your account." msgstr "We have sent an email with a confirmation link to your email address. Please follow the link to activate your account." +#: src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx:35 +msgid "We're sorry for the inconvenience. Our team has been notified, and the issue is being looked into. Please try again in a few minutes. If the problem persists, feel free to contact us <0>on Discord. Thanks for your patience!" +msgstr "We're sorry for the inconvenience. Our team has been notified, and the issue is being looked into. Please try again in a few minutes. If the problem persists, feel free to contact us <0>on Discord. Thanks for your patience!" + #: src/pages/auth/login/LoginPage.tsx:126 msgid "You have successfully verified your account." msgstr "You have successfully verified your account." diff --git a/src/shared/constants/env.ts b/src/shared/constants/env.ts index 27e24f5f..1a0dcea3 100644 --- a/src/shared/constants/env.ts +++ b/src/shared/constants/env.ts @@ -19,4 +19,5 @@ export const env = { : import.meta.env.VITE_WS_SERVER ?? import.meta.env.VITE_SERVER?.replace('http', 'ws') ?? wsOrigin, retryCount: envToNumber(import.meta.env.VITE_NETWORK_RETRY_COUNT) ?? 5, webSocketRetryTimeout: envToNumber(import.meta.env.VITE_WEBSOCKET_RETRY_TIMEOUT) ?? 5_000, + discordUrl: import.meta.env.VITE_DISCORD_URL ?? '#', } diff --git a/src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx b/src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx index 2a013dd7..f9dff8b8 100644 --- a/src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx +++ b/src/shared/error-boundary-fallback/ErrorBoundaryFallback.tsx @@ -1,13 +1,64 @@ -import { Box, Button, Typography } from '@mui/material' +import { Trans } from '@lingui/macro' +import BuildIcon from '@mui/icons-material/Build' +import { Button, Divider, Link, Modal, Stack, Typography, styled } from '@mui/material' +import { useEffect } from 'react' import { FallbackProps } from 'react-error-boundary' +import { DiscrodIcon } from 'src/assets/icons' +import { env } from 'src/shared/constants' + +const ModalContent = styled(Stack)(({ theme }) => ({ + position: 'absolute', + top: '50%', + left: '50%', + transform: 'translate(-50%, -50%)', + width: '600px', + maxWidth: `calc(100% - ${theme.spacing(2)}px)`, + backgroundColor: theme.palette.background.paper, + borderRadius: 4, + boxShadow: theme.shadows[24], + padding: theme.spacing(2, 4, 3), +})) export const ErrorBoundaryFallback = ({ error, resetErrorBoundary }: FallbackProps) => { + useEffect(() => { + console.error(error) + }, [error]) + return ( - - {(error as Error).message} - - + + + + + Oops! Something went wrong. + + + + We're sorry for the inconvenience. Our team has been notified, and the issue is being looked into. Please try again in a few + minutes. If the problem persists, feel free to contact us{' '} + + on Discord + + . Thanks for your patience! + + + + + + + + + ) } diff --git a/src/shared/modal/Modal.tsx b/src/shared/modal/Modal.tsx index 24a15b30..fbd92244 100644 --- a/src/shared/modal/Modal.tsx +++ b/src/shared/modal/Modal.tsx @@ -13,8 +13,9 @@ const ModalContent = styled(Stack)(({ theme }) => ({ top: '50%', left: '50%', transform: 'translate(-50%, -50%)', - width: 400, - background: theme.palette.background.paper, + width: '400px', + maxWidth: `calc(100% - ${theme.spacing(2)}px`, + backgroundColor: theme.palette.background.paper, borderRadius: 4, boxShadow: theme.shadows['24'], padding: theme.spacing(2, 4, 3), diff --git a/src/shared/types/global/react-env.d.ts b/src/shared/types/global/react-env.d.ts index 8983e474..1a7c178c 100644 --- a/src/shared/types/global/react-env.d.ts +++ b/src/shared/types/global/react-env.d.ts @@ -1,11 +1,12 @@ /// interface ImportMetaEnv { - readonly VITE_SERVER: string - readonly VITE_WS_SERVER: string - readonly VITE_USE_PROXY: string - readonly VITE_NETWORK_RETRY_COUNT: string - readonly VITE_WEBSOCKET_RETRY_TIMEOUT: string + readonly VITE_SERVER?: string + readonly VITE_WS_SERVER?: string + readonly VITE_USE_PROXY?: string + readonly VITE_NETWORK_RETRY_COUNT?: string + readonly VITE_WEBSOCKET_RETRY_TIMEOUT?: string + readonly VITE_DISCORD_URL?: string } interface ImportMeta {