From 8c9ceb31c438baed8ed8846287e6f348da2da1ec Mon Sep 17 00:00:00 2001 From: SPT-dev Date: Thu, 2 Mar 2023 21:12:11 -0500 Subject: [PATCH] feat: Include item ID in url --- items/frontend/package.json | 17 +- items/frontend/src/index.tsx | 10 +- items/frontend/src/pages/InteractiveArea.tsx | 26 ++ items/frontend/src/pages/MainPage.tsx | 29 +- items/frontend/src/pages/PageNotFound.tsx | 44 +++ .../pages/mainPageComponents/SearchArea.tsx | 353 +++++++++--------- items/frontend/yarn.lock | 53 ++- 7 files changed, 320 insertions(+), 212 deletions(-) create mode 100644 items/frontend/src/pages/InteractiveArea.tsx create mode 100644 items/frontend/src/pages/PageNotFound.tsx diff --git a/items/frontend/package.json b/items/frontend/package.json index 70df6b5..32d3d53 100644 --- a/items/frontend/package.json +++ b/items/frontend/package.json @@ -13,8 +13,9 @@ "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "cross-env": "^7.0.3", - "cypress": "^8.6.0", - "start-server-and-test": "^1.14.0" + "cypress": "9.0.0", + "start-server-and-test": "^1.14.0", + "typescript": "^4.1.2" }, "dependencies": { "@emotion/react": "^11.4.1", @@ -22,11 +23,12 @@ "@mui/icons-material": "^5.0.3", "@mui/material": "^5.0.3", "@mui/styles": "^5.0.1", + "history": "5", "react": "^17.0.2", "react-dom": "^17.0.2", "react-json-view": "^1.21.3", + "react-router-dom": "6", "react-scripts": "4.0.3", - "typescript": "^4.1.2", "web-vitals": "^1.0.1", "zustand": "^3.5.13" }, @@ -59,8 +61,13 @@ ] }, "nyc": { - "include":["src/**/*.ts", "src/**/*.tsx"], - "exclude": ["src/reportWebVitals.ts"], + "include": [ + "src/**/*.ts", + "src/**/*.tsx" + ], + "exclude": [ + "src/reportWebVitals.ts" + ], "excludeAfterRemap": true } } diff --git a/items/frontend/src/index.tsx b/items/frontend/src/index.tsx index 7998135..6031b20 100644 --- a/items/frontend/src/index.tsx +++ b/items/frontend/src/index.tsx @@ -4,13 +4,13 @@ import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( - - - , - document.getElementById('root') + + + , + document.getElementById('root') ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); +reportWebVitals(); \ No newline at end of file diff --git a/items/frontend/src/pages/InteractiveArea.tsx b/items/frontend/src/pages/InteractiveArea.tsx new file mode 100644 index 0000000..34a79d7 --- /dev/null +++ b/items/frontend/src/pages/InteractiveArea.tsx @@ -0,0 +1,26 @@ +import {Box} from '@mui/material' +import {NavigationBreadcrumb} from './mainPageComponents/NavigationBreadcrumb' +import {SearchArea} from './mainPageComponents/SearchArea' +import {makeStyles} from "@mui/styles"; +import React from "react"; + +const useStyles = makeStyles(() => ({ + searchContainer: { + display: 'flex', + flexDirection: 'row', + flexGrow: 1, + padding: '2vh 2vw 1vh 2vw' + } +})) + +export const InteractiveArea = () => { + const classes = useStyles(); + return ( + <> + + + + + + ) +} diff --git a/items/frontend/src/pages/MainPage.tsx b/items/frontend/src/pages/MainPage.tsx index a5c3b33..4d92486 100644 --- a/items/frontend/src/pages/MainPage.tsx +++ b/items/frontend/src/pages/MainPage.tsx @@ -1,11 +1,13 @@ -import {Box, Theme} from '@mui/material' +import {Box} from '@mui/material' import {Footer} from '../components/Footer' import {Header} from '../components/Header' -import {NavigationBreadcrumb} from './mainPageComponents/NavigationBreadcrumb' -import {SearchArea} from './mainPageComponents/SearchArea' import {makeStyles} from "@mui/styles"; +import {BrowserRouter, Navigate, Route, Routes} from "react-router-dom"; +import React from "react"; +import {InteractiveArea} from "./InteractiveArea"; +import {PageNotFound} from "./PageNotFound"; -const useStyles = makeStyles((theme: Theme) => ({ +const useStyles = makeStyles(() => ({ container: { background: 'background.default', display: 'flex', @@ -13,12 +15,6 @@ const useStyles = makeStyles((theme: Theme) => ({ flexGrow: 1, height: '100vh', maxheight: '100vh', - }, - searchContainer: { - display: 'flex', - flexDirection: 'row', - flexGrow: 1, - padding: '2vh 2vw 1vh 2vw' } })) @@ -28,10 +24,15 @@ export const MainPage = () => { <>
- - - - + + + }> + }/> + + }/> + }/> + +