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

CU-8692r3312_Create-page-Not-found_Patryk-Kosiski #10

Merged
merged 2 commits into from
Sep 17, 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
Binary file added frontend/src/Assets/NotFound/cat-error.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions frontend/src/Pages/NotFound/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Button, Center, Group, Image, Stack, Text} from "@mantine/core";
import photo from "../../Assets/NotFound/cat-error.gif";
import {ContainerVhVw} from "../../Components/ContainerVhVw";
import {useNavigate} from "react-router-dom";
import {useTranslation} from "react-i18next";

export const NotFound = () => {
const navigate = useNavigate();
const {t} = useTranslation('notfound');

return (
<ContainerVhVw vh={100} vw={99}>
<Center h={"inherit"}>
<Stack align={"center"}>
<Text size={32} weight={700}>{t('label')}</Text>
<Group align={"center"} spacing={100} >
<Image maw={240} mx="auto" radius="md" src={photo} alt="Cat error 404"/>
<Button color={'pink'} size={"xl"} variant="light" onClick={() => navigate("/")}>{t('button')}</Button>
</Group>
</Stack>
</Center>
</ContainerVhVw>
);
}
1 change: 1 addition & 0 deletions frontend/src/Pages/NotFound/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './NotFound';
3 changes: 2 additions & 1 deletion frontend/src/Pages/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Route, Routes} from "react-router-dom";
import { Layout } from "../../Components/Layout";
import { MainPage } from "../MainPage";
import {Login} from "../Login";
import {NotFound} from "../NotFound";

export const Root = () => {
return(
Expand All @@ -12,7 +13,7 @@ export const Root = () => {
{/*<Route path="/form" element={ <Form/>} />*/}
{/*<Route path="/admin" element={ <Admin/>} />*/}
</Route>
{/*<Route path="*" element={ <PageNotFound/> }/>*/}
<Route path="*" element={ <NotFound/> }/>
</Routes>
);
}
4 changes: 4 additions & 0 deletions frontend/src/Services/Utils/i18nInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import i18next from "i18next";
// english translations
import enLogin from "../../Translations/en/login.json";
import enFooter from "../../Translations/en/footer.json";
import enNotFound from "../../Translations/en/notfound.json";
// polish translations
import plLogin from "../../Translations/pl/login.json";
import plFooter from "../../Translations/pl/footer.json";
import plNotFound from "../../Translations/pl/notfound.json";

export const i18nInitializer = () => {
return i18next.init({
Expand All @@ -14,10 +16,12 @@ export const i18nInitializer = () => {
en: {
login: enLogin,
footer: enFooter,
notfound: enNotFound,
},
pl: {
login: plLogin,
footer: plFooter,
notfound: plNotFound,
}
}
});
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/Translations/en/notfound.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"button": "Go to main page",
"label": "Sorry but page that you are looking for does not exist :("
}
35 changes: 35 additions & 0 deletions frontend/src/Translations/main.babel
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,41 @@
</folder_node>
</children>
</file_node>
<file_node>
<name>notfound</name>
<children>
<concept_node>
<name>button</name>
<description/>
<comment/>
<translations>
<translation>
<language>en-US</language>
<approved>true</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>true</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>label</name>
<description/>
<comment/>
<translations>
<translation>
<language>en-US</language>
<approved>true</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>true</approved>
</translation>
</translations>
</concept_node>
</children>
</file_node>
</children>
</package_node>
</children>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/Translations/pl/notfound.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"button": "Przejdź do strony głównej",
"label": "Przykro nam, ale strona, której szukasz, nie istnieje :("
}