diff options
| author | physcik <mynameisgennadiy@vk.com> | 2026-04-10 20:45:57 +0500 |
|---|---|---|
| committer | physcik <mynameisgennadiy@vk.com> | 2026-04-10 20:45:57 +0500 |
| commit | e243f101b3266ed98a1b668562a639408ffe36d7 (patch) | |
| tree | 9476be3e45f39c1a07655607002a41a914daf7e3 | |
| parent | fd5b5fedfec1921930257b1003245f3740536556 (diff) | |
router setup
| -rw-r--r-- | front/README.md | 38 | ||||
| -rw-r--r-- | front/package-lock.json | 57 | ||||
| -rw-r--r-- | front/package.json | 5 | ||||
| -rw-r--r-- | front/src/App.js | 25 | ||||
| -rw-r--r-- | front/src/App.test.tsx (renamed from front/src/App.test.js) | 1 | ||||
| -rw-r--r-- | front/src/App.tsx | 27 | ||||
| -rw-r--r-- | front/src/Emelents/ClassList.tsx | 7 | ||||
| -rw-r--r-- | front/src/Emelents/IndexElement.tsx | 9 | ||||
| -rw-r--r-- | front/src/Emelents/Sidebar.tsx | 12 | ||||
| -rw-r--r-- | front/src/index.css | 13 | ||||
| -rw-r--r-- | front/src/index.tsx (renamed from front/src/index.js) | 4 | ||||
| -rw-r--r-- | front/src/react-app-env.d.ts | 1 | ||||
| -rw-r--r-- | front/src/reportWebVitals.ts (renamed from front/src/reportWebVitals.js) | 4 | ||||
| -rw-r--r-- | front/src/setupTests.ts (renamed from front/src/setupTests.js) | 0 | ||||
| -rw-r--r-- | front/tsconfig.json | 26 | ||||
| -rw-r--r-- | package-lock.json | 6 |
16 files changed, 152 insertions, 83 deletions
diff --git a/front/README.md b/front/README.md index 58beeac..b87cb00 100644 --- a/front/README.md +++ b/front/README.md @@ -9,10 +9,10 @@ In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in your browser. +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. -The page will reload when you make changes.\ -You may also see any lint errors in the console. +The page will reload if you make edits.\ +You will also see any lint errors in the console. ### `npm test` @@ -31,40 +31,16 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d ### `npm run eject` -**Note: this is a one-way operation. Once you `eject`, you can't go back!** +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** -If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. +If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. -You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. +You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `npm run build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/front/package-lock.json b/front/package-lock.json index 3ff892a..fe858e6 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -12,10 +12,15 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^13.5.0", + "@types/jest": "^27.5.2", + "@types/node": "^16.18.126", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", "react": "^19.2.5", "react-dom": "^19.2.5", "react-router": "^7.14.0", "react-scripts": "5.0.1", + "typescript": "^4.9.5", "web-vitals": "^2.1.4" } }, @@ -3640,6 +3645,16 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "27.5.2", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.2.tgz", + "integrity": "sha512-mpT8LJJ4CMeeahobofYWIjFo0xonRS/HfxnVEPMPFSQdGUt1uHCnoPT7Zhb+sjDU2wz0oKV0OLUR0WzrHNgfeA==", + "license": "MIT", + "dependencies": { + "jest-matcher-utils": "^27.0.0", + "pretty-format": "^27.0.0" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -3659,13 +3674,10 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz", - "integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==", - "license": "MIT", - "dependencies": { - "undici-types": "~7.19.0" - } + "version": "16.18.126", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", + "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", + "license": "MIT" }, "node_modules/@types/node-forge": { "version": "1.3.14", @@ -3706,6 +3718,24 @@ "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", "license": "MIT" }, + "node_modules/@types/react": { + "version": "19.2.14", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", + "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, "node_modules/@types/resolve": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", @@ -6285,6 +6315,12 @@ "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", "license": "MIT" }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -16128,7 +16164,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -16161,12 +16196,6 @@ "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", "license": "MIT" }, - "node_modules/undici-types": { - "version": "7.19.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", - "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==", - "license": "MIT" - }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", diff --git a/front/package.json b/front/package.json index 95b2521..b705d58 100644 --- a/front/package.json +++ b/front/package.json @@ -7,10 +7,15 @@ "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", "@testing-library/user-event": "^13.5.0", + "@types/jest": "^27.5.2", + "@types/node": "^16.18.126", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", "react": "^19.2.5", "react-dom": "^19.2.5", "react-router": "^7.14.0", "react-scripts": "5.0.1", + "typescript": "^4.9.5", "web-vitals": "^2.1.4" }, "scripts": { diff --git a/front/src/App.js b/front/src/App.js deleted file mode 100644 index 3784575..0000000 --- a/front/src/App.js +++ /dev/null @@ -1,25 +0,0 @@ -import logo from './logo.svg'; -import './App.css'; - -function App() { - return ( - <div className="App"> - <header className="App-header"> - <img src={logo} className="App-logo" alt="logo" /> - <p> - Edit <code>src/App.js</code> and save to reload. - </p> - <a - className="App-link" - href="https://reactjs.org" - target="_blank" - rel="noopener noreferrer" - > - Learn React - </a> - </header> - </div> - ); -} - -export default App; diff --git a/front/src/App.test.js b/front/src/App.test.tsx index 1f03afe..2a68616 100644 --- a/front/src/App.test.js +++ b/front/src/App.test.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { render, screen } from '@testing-library/react'; import App from './App'; diff --git a/front/src/App.tsx b/front/src/App.tsx new file mode 100644 index 0000000..47cc1ed --- /dev/null +++ b/front/src/App.tsx @@ -0,0 +1,27 @@ +import './App.css'; +import Sidebar from './Emelents/Sidebar'; +import { createBrowserRouter, RouterProvider } from 'react-router'; +import IndexElement from './Emelents/IndexElement'; +import ClassesList from './Emelents/ClassList'; + +const router = createBrowserRouter([ + { + index: true, + element: (<IndexElement />), + }, + { + path: "/classes", + element: (<ClassesList />), + }, +]); + +function App() { + return ( + <div> + <Sidebar /> + <RouterProvider router={router} /> + </div> + ); +} + +export default App; diff --git a/front/src/Emelents/ClassList.tsx b/front/src/Emelents/ClassList.tsx new file mode 100644 index 0000000..f0f6fcc --- /dev/null +++ b/front/src/Emelents/ClassList.tsx @@ -0,0 +1,7 @@ +function ClassesList() { + return ( + <h1> Classes list </h1> + ); +} + +export default ClassesList; diff --git a/front/src/Emelents/IndexElement.tsx b/front/src/Emelents/IndexElement.tsx new file mode 100644 index 0000000..4eda815 --- /dev/null +++ b/front/src/Emelents/IndexElement.tsx @@ -0,0 +1,9 @@ +function IndexElement() { + return ( + <div> + <h1> Index element </h1> + </div> + ); +} + +export default IndexElement; diff --git a/front/src/Emelents/Sidebar.tsx b/front/src/Emelents/Sidebar.tsx new file mode 100644 index 0000000..c5a4a9c --- /dev/null +++ b/front/src/Emelents/Sidebar.tsx @@ -0,0 +1,12 @@ +function Sidebar() { + return ( + <nav className='Sidebar'> + <h1> Test </h1> + <ul> + <li> <a href="/classes"> Class list </a> </li> + </ul> + </nav> + ) +} + +export default Sidebar; diff --git a/front/src/index.css b/front/src/index.css index ec2585e..dfdc4ba 100644 --- a/front/src/index.css +++ b/front/src/index.css @@ -1,13 +1,16 @@ body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', + padding: 0; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + position: absolute; + top: 0px; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; } diff --git a/front/src/index.js b/front/src/index.tsx index d563c0f..032464f 100644 --- a/front/src/index.js +++ b/front/src/index.tsx @@ -4,7 +4,9 @@ import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; -const root = ReactDOM.createRoot(document.getElementById('root')); +const root = ReactDOM.createRoot( + document.getElementById('root') as HTMLElement +); root.render( <React.StrictMode> <App /> diff --git a/front/src/react-app-env.d.ts b/front/src/react-app-env.d.ts new file mode 100644 index 0000000..6431bc5 --- /dev/null +++ b/front/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// <reference types="react-scripts" /> diff --git a/front/src/reportWebVitals.js b/front/src/reportWebVitals.ts index 5253d3a..49a2a16 100644 --- a/front/src/reportWebVitals.js +++ b/front/src/reportWebVitals.ts @@ -1,4 +1,6 @@ -const reportWebVitals = onPerfEntry => { +import { ReportHandler } from 'web-vitals'; + +const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); diff --git a/front/src/setupTests.js b/front/src/setupTests.ts index 8f2609b..8f2609b 100644 --- a/front/src/setupTests.js +++ b/front/src/setupTests.ts diff --git a/front/tsconfig.json b/front/tsconfig.json new file mode 100644 index 0000000..a273b0c --- /dev/null +++ b/front/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": [ + "src" + ] +} diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index bf34cc6..0000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "cyberpunk_su", - "lockfileVersion": 3, - "requires": true, - "packages": {} -} |
