From e243f101b3266ed98a1b668562a639408ffe36d7 Mon Sep 17 00:00:00 2001 From: physcik Date: Fri, 10 Apr 2026 20:45:57 +0500 Subject: router setup --- front/README.md | 38 +++++-------------------- front/package-lock.json | 57 ++++++++++++++++++++++++++++--------- front/package.json | 5 ++++ front/src/App.js | 25 ---------------- front/src/App.test.js | 8 ------ front/src/App.test.tsx | 9 ++++++ front/src/App.tsx | 27 ++++++++++++++++++ front/src/Emelents/ClassList.tsx | 7 +++++ front/src/Emelents/IndexElement.tsx | 9 ++++++ front/src/Emelents/Sidebar.tsx | 12 ++++++++ front/src/index.css | 13 +++++---- front/src/index.js | 17 ----------- front/src/index.tsx | 19 +++++++++++++ front/src/react-app-env.d.ts | 1 + front/src/reportWebVitals.js | 13 --------- front/src/reportWebVitals.ts | 15 ++++++++++ front/src/setupTests.js | 5 ---- front/src/setupTests.ts | 5 ++++ front/tsconfig.json | 26 +++++++++++++++++ 19 files changed, 193 insertions(+), 118 deletions(-) delete mode 100644 front/src/App.js delete mode 100644 front/src/App.test.js create mode 100644 front/src/App.test.tsx create mode 100644 front/src/App.tsx create mode 100644 front/src/Emelents/ClassList.tsx create mode 100644 front/src/Emelents/IndexElement.tsx create mode 100644 front/src/Emelents/Sidebar.tsx delete mode 100644 front/src/index.js create mode 100644 front/src/index.tsx create mode 100644 front/src/react-app-env.d.ts delete mode 100644 front/src/reportWebVitals.js create mode 100644 front/src/reportWebVitals.ts delete mode 100644 front/src/setupTests.js create mode 100644 front/src/setupTests.ts create mode 100644 front/tsconfig.json (limited to 'front') 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 ( -
-
- logo -

- Edit src/App.js and save to reload. -

- - Learn React - -
-
- ); -} - -export default App; diff --git a/front/src/App.test.js b/front/src/App.test.js deleted file mode 100644 index 1f03afe..0000000 --- a/front/src/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import App from './App'; - -test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/front/src/App.test.tsx b/front/src/App.test.tsx new file mode 100644 index 0000000..2a68616 --- /dev/null +++ b/front/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); 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: (), + }, + { + path: "/classes", + element: (), + }, +]); + +function App() { + return ( +
+ + +
+ ); +} + +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 ( +

Classes list

+ ); +} + +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 ( +
+

Index element

+
+ ); +} + +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 ( + + ) +} + +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.js deleted file mode 100644 index d563c0f..0000000 --- a/front/src/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; - -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - - - -); - -// 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(); diff --git a/front/src/index.tsx b/front/src/index.tsx new file mode 100644 index 0000000..032464f --- /dev/null +++ b/front/src/index.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import './index.css'; +import App from './App'; +import reportWebVitals from './reportWebVitals'; + +const root = ReactDOM.createRoot( + document.getElementById('root') as HTMLElement +); +root.render( + + + +); + +// 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(); 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 @@ +/// diff --git a/front/src/reportWebVitals.js b/front/src/reportWebVitals.js deleted file mode 100644 index 5253d3a..0000000 --- a/front/src/reportWebVitals.js +++ /dev/null @@ -1,13 +0,0 @@ -const reportWebVitals = onPerfEntry => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/front/src/reportWebVitals.ts b/front/src/reportWebVitals.ts new file mode 100644 index 0000000..49a2a16 --- /dev/null +++ b/front/src/reportWebVitals.ts @@ -0,0 +1,15 @@ +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); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } +}; + +export default reportWebVitals; diff --git a/front/src/setupTests.js b/front/src/setupTests.js deleted file mode 100644 index 8f2609b..0000000 --- a/front/src/setupTests.js +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; diff --git a/front/src/setupTests.ts b/front/src/setupTests.ts new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/front/src/setupTests.ts @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom'; 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" + ] +} -- cgit v1.3