├── .gitignore ├── README.md ├── db.json ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── App.test.js ├── Components ├── CheckAuth.jsx ├── FilterSort.jsx └── Navbar.jsx ├── Pages ├── EditMusicRecord.jsx ├── Homepage.jsx ├── Login.jsx ├── MainRoutes.jsx ├── MusicRecords.jsx └── SingleMusicRecord.jsx ├── Redux ├── AppReducer │ ├── action.js │ ├── actionType.js │ └── reducer.js ├── AuthReducer │ ├── action.js │ ├── actionType.js │ └── reducer.js └── store.js ├── index.css ├── index.js ├── logo.svg ├── reportWebVitals.js └── setupTests.js /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | 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. 37 | 38 | 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. 39 | 40 | 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. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | 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) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | 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) 55 | 56 | ### Making a Progressive Web App 57 | 58 | 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) 59 | 60 | ### Advanced Configuration 61 | 62 | 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) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | 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) 71 | -------------------------------------------------------------------------------- /db.json: -------------------------------------------------------------------------------- 1 | { 2 | "albums": [ 3 | { 4 | "id": "1", 5 | "name": "POWER UP", 6 | "artist": "Vivek Goswami", 7 | "genre": " Hard Rock", 8 | "year": 2019, 9 | "no_of_songs": "2", 10 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/ba/07/bc/ba07bcdd-5129-1d5e-6267-8252f0e24829/20UMGIM69450.rgb.jpg/170x170bb.png", 11 | "songs": [ 12 | { 13 | "name": "abc" 14 | }, 15 | { 16 | "name": "def" 17 | } 18 | ] 19 | }, 20 | { 21 | "id": "2", 22 | "name": "POWER UP", 23 | "artist": "Vivek Goswami", 24 | "genre": " Hard Rock", 25 | "year": 2019, 26 | "no_of_songs": "2", 27 | "img": "https://is4-ssl.mzstatic.com/image/thumb/Music114/v4/b0/ec/cb/b0eccb83-3ea8-4404-1747-9080482e5e8a/886448802198.jpg/170x170bb.png", 28 | "songs": [ 29 | { 30 | "name": "abc" 31 | }, 32 | { 33 | "name": "def" 34 | } 35 | ] 36 | }, 37 | { 38 | "id": "3", 39 | "name": "POWER UP", 40 | "artist": "Vivek Goswami", 41 | "genre": " Hard Rock", 42 | "year": 2019, 43 | "no_of_songs": "2", 44 | "img": "https://is4-ssl.mzstatic.com/image/thumb/Music114/v4/b0/ec/cb/b0eccb83-3ea8-4404-1747-9080482e5e8a/886448802198.jpg/170x170bb.png", 45 | "songs": [ 46 | { 47 | "name": "abc" 48 | }, 49 | { 50 | "name": "def" 51 | } 52 | ] 53 | }, 54 | { 55 | "id": "4", 56 | "name": "POWER UP", 57 | "artist": "Vivek Goswami", 58 | "genre": " Hard Rock", 59 | "year": 2019, 60 | "no_of_songs": "2", 61 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music124/v4/0d/39/fb/0d39fbc2-98b1-4e9d-a8e9-159139834fa6/20UMGIM80226.rgb.jpg/170x170bb.png", 62 | "songs": [ 63 | { 64 | "name": "abc" 65 | }, 66 | { 67 | "name": "def" 68 | } 69 | ] 70 | }, 71 | { 72 | "id": "5", 73 | "name": "POWER UP", 74 | "artist": "Vivek Goswami", 75 | "genre": " Hard Rock", 76 | "year": 2019, 77 | "no_of_songs": "2", 78 | "img": "https://is4-ssl.mzstatic.com/image/thumb/Music114/v4/b0/ec/cb/b0eccb83-3ea8-4404-1747-9080482e5e8a/886448802198.jpg/170x170bb.png", 79 | "songs": [ 80 | { 81 | "name": "abc" 82 | }, 83 | { 84 | "name": "def" 85 | } 86 | ] 87 | }, 88 | { 89 | "id": "6", 90 | "name": "Starting Over", 91 | "artist": " Mat and Savanna Shaw", 92 | "genre": "Holiday", 93 | "year": 2020, 94 | "no_of_songs": "4", 95 | "img": "https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/2a/98/17/2a9817da-4d03-8517-c2e4-6b407d11b854/195269041267.png/170x170bb.png", 96 | "songs": [ 97 | { 98 | "name": "abc" 99 | }, 100 | { 101 | "name": "def" 102 | }, 103 | { 104 | "name": "abc" 105 | }, 106 | { 107 | "name": "def" 108 | } 109 | ] 110 | }, 111 | { 112 | "id": "7", 113 | "name": "My Gift", 114 | "artist": "Carrie Underwood", 115 | "genre": "Holiday", 116 | "year": 2019, 117 | "no_of_songs": "2", 118 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/ba/07/bc/ba07bcdd-5129-1d5e-6267-8252f0e24829/20UMGIM69450.rgb.jpg/170x170bb.png", 119 | "songs": [ 120 | { 121 | "name": "abc" 122 | }, 123 | { 124 | "name": "def" 125 | } 126 | ] 127 | }, 128 | { 129 | "id": "8", 130 | "name": "Hey World", 131 | "artist": "Lee Brice", 132 | "genre": "Country", 133 | "year": 2020, 134 | "no_of_songs": "4", 135 | "img": "https://is4-ssl.mzstatic.com/image/thumb/Music124/v4/6d/30/9f/6d309fd1-6cdf-e50f-752c-3177bf24f0a7/715187954762.png/170x170bb.png", 136 | "songs": [ 137 | { 138 | "name": "abc" 139 | }, 140 | { 141 | "name": "def" 142 | }, 143 | { 144 | "name": "def" 145 | }, 146 | { 147 | "name": "def" 148 | } 149 | ] 150 | }, 151 | { 152 | "id": "9", 153 | "name": "A Holly Dolly Christmas", 154 | "artist": "Dolly Parton", 155 | "genre": "Holiday", 156 | "year": 2017, 157 | "no_of_songs": "3", 158 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/84/dc/bd/84dcbda7-c5bb-357b-7a5e-6d0304b9a90f/190296823428.jpg/170x170bb.png", 159 | "songs": [ 160 | { 161 | "name": "abc" 162 | }, 163 | { 164 | "name": "def" 165 | }, 166 | { 167 | "name": "def" 168 | } 169 | ] 170 | }, 171 | { 172 | "id": "10", 173 | "name": "Songs You Don't Know By Heart", 174 | "artist": "Jimmy Buffett", 175 | "genre": "K-Pop", 176 | "year": 2017, 177 | "no_of_songs": "3", 178 | "img": "https://is5-ssl.mzstatic.com/image/thumb/Music114/v4/99/ed/c0/99edc06d-9110-d9db-eae9-665dc77200b3/JimmyBuffett-SongsYouDontKnowByHeart-DigitalCover-3000x3000.jpg/170x170bb.png", 179 | "songs": [ 180 | { 181 | "name": "abc" 182 | }, 183 | { 184 | "name": "def" 185 | }, 186 | { 187 | "name": "def" 188 | } 189 | ] 190 | }, 191 | { 192 | "id": "11", 193 | "name": "Believe (Deluxe)", 194 | "artist": "Andrea Bocelli", 195 | "genre": "Classical Crossover", 196 | "year": 2020, 197 | "no_of_songs": "2", 198 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music124/v4/0d/39/fb/0d39fbc2-98b1-4e9d-a8e9-159139834fa6/20UMGIM80226.rgb.jpg/170x170bb.png", 199 | "songs": [ 200 | { 201 | "name": "abc" 202 | }, 203 | { 204 | "name": "def" 205 | } 206 | ] 207 | }, 208 | { 209 | "id": "12", 210 | "name": "Classic Diamonds With The London Symphony Orchestra", 211 | "artist": "Neil Diamond", 212 | "genre": "Singer/Songwriter", 213 | "year": 2020, 214 | "no_of_songs": "4", 215 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/84/dc/bd/84dcbda7-c5bb-357b-7a5e-6d0304b9a90f/190296823428.jpg/170x170bb.png", 216 | "songs": [ 217 | { 218 | "name": "abc" 219 | }, 220 | { 221 | "name": "def" 222 | }, 223 | { 224 | "name": "ghi" 225 | }, 226 | { 227 | "name": "def" 228 | } 229 | ] 230 | }, 231 | { 232 | "id": "13", 233 | "name": "10", 234 | "artist": "The Piano Guys", 235 | "genre": "Classical Crossover", 236 | "year": 2019, 237 | "no_of_songs": "2", 238 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music124/v4/74/31/b6/7431b62d-f80f-8297-9356-a5f6001bf798/886448635437.jpg/170x170bb.png", 239 | "songs": [ 240 | { 241 | "name": "abc" 242 | }, 243 | { 244 | "name": "def" 245 | } 246 | ] 247 | }, 248 | { 249 | "id": "14", 250 | "name": "Christmas", 251 | "artist": "Dolly Parton", 252 | "genre": "Holiday", 253 | "year": 2017, 254 | "no_of_songs": "3", 255 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/84/dc/bd/84dcbda7-c5bb-357b-7a5e-6d0304b9a90f/190296823428.jpg/170x170bb.png", 256 | "songs": [ 257 | { 258 | "name": "abc" 259 | }, 260 | { 261 | "name": "def" 262 | }, 263 | { 264 | "name": "def" 265 | } 266 | ] 267 | }, 268 | { 269 | "id": "15", 270 | "name": "Nights of the Dead, Legacy of the Beast: Live in Mexico City", 271 | "artist": "Iron Maiden", 272 | "genre": "Heavy Metal", 273 | "year": 2020, 274 | "no_of_songs": "4", 275 | "img": "https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/9a/96/ed/9a96ede3-1eac-d84a-b7b7-49ae7397ca2e/4050538647594.jpg/170x170bb.png", 276 | "songs": [ 277 | { 278 | "name": "abc" 279 | }, 280 | { 281 | "name": "def" 282 | }, 283 | { 284 | "name": "def" 285 | }, 286 | { 287 | "name": "def" 288 | } 289 | ] 290 | }, 291 | { 292 | "id": "16", 293 | "name": "Iron Maiden", 294 | "artist": "The Piano Guys....", 295 | "genre": "Heavy Metal", 296 | "year": 2017, 297 | "no_of_songs": "3", 298 | "img": "https://is1-ssl.mzstatic.com/image/thumb/Music124/v4/9a/96/ed/9a96ede3-1eac-d84a-b7b7-49ae7397ca2e/4050538647594.jpg/170x170bb.png", 299 | "songs": [ 300 | { 301 | "name": "abc" 302 | }, 303 | { 304 | "name": "def" 305 | }, 306 | { 307 | "name": "def" 308 | } 309 | ] 310 | }, 311 | { 312 | "id": "17", 313 | "name": "Kindred Spirits", 314 | "artist": "Larkin Poe", 315 | "genre": "Rock", 316 | "year": 2018, 317 | "no_of_songs": "4", 318 | "img": "https://is3-ssl.mzstatic.com/image/thumb/Music114/v4/41/87/8a/41878a01-621b-282c-fba2-07302f0a57f1/192641558757_Cover.jpg/170x170bb.png", 319 | "songs": [ 320 | { 321 | "name": "abc" 322 | }, 323 | { 324 | "name": "def" 325 | }, 326 | { 327 | "name": "def" 328 | }, 329 | { 330 | "name": "def" 331 | } 332 | ] 333 | }, 334 | { 335 | "id": "18", 336 | "name": "Pluto x Baby Pluto", 337 | "artist": "Future & Lil Uzi Vert", 338 | "genre": "Holiday", 339 | "year": 2017, 340 | "no_of_songs": "3", 341 | "img": "https://is2-ssl.mzstatic.com/image/thumb/Music114/v4/84/dc/bd/84dcbda7-c5bb-357b-7a5e-6d0304b9a90f/190296823428.jpg/170x170bb.png", 342 | "songs": [ 343 | { 344 | "name": "abc" 345 | }, 346 | { 347 | "name": "def" 348 | }, 349 | { 350 | "name": "def" 351 | } 352 | ] 353 | }, 354 | { 355 | "id": "19", 356 | "name": "What You See Ain't Always What You Get (Deluxe Edition)", 357 | "artist": "Luke Combs", 358 | "genre": "Country", 359 | "year": 2017, 360 | "no_of_songs": "4", 361 | "img": "https://is1-ssl.mzstatic.com/image/thumb/Music114/v4/13/4a/11/134a11e7-35f1-a9e4-3f8c-a70443ca2e0a/886448691341.jpg/170x170bb.png", 362 | "songs": [ 363 | { 364 | "name": "abc" 365 | }, 366 | { 367 | "name": "def" 368 | }, 369 | { 370 | "name": "def" 371 | }, 372 | { 373 | "name": "def" 374 | } 375 | ] 376 | }, 377 | { 378 | "id": "20", 379 | "name": "A Drummer Boy Christmas", 380 | "artist": "for KING & COUNTRY", 381 | "genre": "Christmas", 382 | "year": 2020, 383 | "no_of_songs": "4", 384 | "img": "https://is5-ssl.mzstatic.com/image/thumb/Music114/v4/ba/46/4c/ba464c84-225a-4ffd-30aa-cdaf1d5aca47/080688042363.png/170x170bb.png", 385 | "songs": [ 386 | { 387 | "name": "abc" 388 | }, 389 | { 390 | "name": "def" 391 | }, 392 | { 393 | "name": "def" 394 | }, 395 | { 396 | "name": "def" 397 | } 398 | ] 399 | } 400 | ] 401 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "musicapp", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@chakra-ui/icons": "^2.0.15", 7 | "@chakra-ui/react": "^2.4.6", 8 | "@emotion/react": "^11.10.5", 9 | "@emotion/styled": "^11.10.5", 10 | "@testing-library/jest-dom": "^5.16.4", 11 | "@testing-library/react": "^13.3.0", 12 | "@testing-library/user-event": "^13.5.0", 13 | "axios": "^0.27.2", 14 | "framer-motion": "^8.0.2", 15 | "json-server": "^0.17.0", 16 | "react": "^18.2.0", 17 | "react-dom": "^18.2.0", 18 | "react-redux": "^8.0.2", 19 | "react-router-dom": "^6.3.0", 20 | "react-scripts": "5.0.1", 21 | "redux": "^4.2.0", 22 | "redux-thunk": "^2.4.1", 23 | "styled-components": "^5.3.5", 24 | "web-vitals": "^2.1.4" 25 | }, 26 | "scripts": { 27 | "server": "json-server --watch db.json --port 8080", 28 | "start": "react-scripts start", 29 | "build": "react-scripts build", 30 | "test": "react-scripts test", 31 | "eject": "react-scripts eject" 32 | }, 33 | "eslintConfig": { 34 | "extends": [ 35 | "react-app", 36 | "react-app/jest" 37 | ] 38 | }, 39 | "browserslist": { 40 | "production": [ 41 | ">0.2%", 42 | "not dead", 43 | "not op_mini all" 44 | ], 45 | "development": [ 46 | "last 1 chrome version", 47 | "last 1 firefox version", 48 | "last 1 safari version" 49 | ] 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivekgoswami934/MusicAppFrontend/8d368dd5d58c03ed9f70339cc5092240511e4d92/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivekgoswami934/MusicAppFrontend/8d368dd5d58c03ed9f70339cc5092240511e4d92/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vivekgoswami934/MusicAppFrontend/8d368dd5d58c03ed9f70339cc5092240511e4d92/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | body{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | .App { 7 | text-align: center; 8 | font-family: Arial, Helvetica, sans-serif; 9 | } 10 | 11 | 12 | .App-header { 13 | background-color: #282c34; 14 | min-height: 100vh; 15 | display: flex; 16 | flex-direction: column; 17 | align-items: center; 18 | justify-content: center; 19 | font-size: calc(10px + 2vmin); 20 | color: white; 21 | } 22 | 23 | .App-link { 24 | color: #61dafb; 25 | } 26 | 27 | 28 | .navbar{ 29 | position: -webkit-sticky; /* Safari */ 30 | position: sticky; 31 | top: 0px; 32 | width: 95%; 33 | margin: auto; 34 | border-radius: 20px; 35 | } 36 | 37 | h4{ 38 | text-decoration: none; 39 | 40 | color: rgb(3, 69, 69); 41 | } 42 | 43 | p{ 44 | color: #282c34; 45 | } 46 | 47 | .linkbaaz{ 48 | text-decoration: none; 49 | } 50 | button{ 51 | color : black; 52 | background-color: tomato; 53 | padding: 5px 10px; 54 | border: none; 55 | border-radius: 4px ; 56 | } 57 | 58 | h1{ 59 | text-decoration: none; 60 | } -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import "./App.css"; 2 | import Navbar from "./Components/Navbar"; 3 | import MainRoutes from "./Pages/MainRoutes"; 4 | 5 | function App() { 6 | return ( 7 |
8 | 9 | 10 | 11 |
12 | ); 13 | } 14 | 15 | export default App; 16 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/Components/CheckAuth.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useSelector } from "react-redux/es/hooks/useSelector"; 3 | import { Navigate } from "react-router-dom"; 4 | import { useLocation ,useNavigate } from "react-router-dom"; 5 | // if user not login then render this page on the DOM 6 | //else allow to login singlePafe 7 | const CheckAuth = ({ children }) => { 8 | 9 | const { isAuth } = useSelector((store) => store.AuthReducer); 10 | const location = useLocation(); 11 | console.log("isAuthLocation",location); 12 | 13 | 14 | 15 | // isAuth -->true 16 | if (!isAuth) { 17 | //login Page 18 | return ; 19 | } 20 | 21 | return children; 22 | }; 23 | 24 | export default CheckAuth; 25 | -------------------------------------------------------------------------------- /src/Components/FilterSort.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { useSearchParams } from "react-router-dom"; 3 | 4 | const FilterSort = () => { 5 | const [searchParams, setSearchParams] = useSearchParams(); 6 | 7 | 8 | 9 | let initalGenreParams = searchParams.getAll("genre"); // [] 10 | 11 | 12 | 13 | const [category, setCategory] = useState(initalGenreParams || []); // initalGenreParams || 14 | 15 | let initialSortParams = searchParams.get("sortBy"); // a key or a string 16 | 17 | 18 | const [sortBy, setSortBy] = useState(initialSortParams || ""); 19 | console.log("rendering" , sortBy) 20 | 21 | 22 | const handleGenreChange = (e) => { 23 | const option = e.target.value; // k-pop 24 | 25 | let newCategory = [...category]; 26 | 27 | if (category.includes(option)) { 28 | newCategory.splice(newCategory.indexOf(option), 1); 29 | } else { 30 | newCategory.push(option); 31 | } 32 | setCategory(newCategory); 33 | }; 34 | 35 | const handleSortBy = (e) => { 36 | console.log("vivek") 37 | let value = e.target.value; 38 | console.log(value,sortBy) 39 | 40 | 41 | value === sortBy ? setSortBy(null) : setSortBy(e.target.value); 42 | 43 | 44 | 45 | }; 46 | 47 | 48 | useEffect(() => { 49 | if (category || sortBy) { 50 | const params = {}; 51 | category && (params.genre = category); // genre --> key 52 | sortBy && (params.sortBy = sortBy); 53 | 54 | 55 | setSearchParams(params); 56 | } 57 | }, [category, setSearchParams, sortBy]); // dependency 58 | 59 | 60 | return ( 61 |
62 |

Filter...

63 |
64 | 70 | 71 |
72 |
73 | 79 | 80 |
81 |
82 | 88 | 89 |
90 |
91 | 97 | 98 |
99 |
100 | 106 | 107 |
108 |

Sort

109 |
110 |
111 | 118 | 119 |
120 |
121 | 128 | 129 |
130 |
131 |
132 | ); 133 | }; 134 | 135 | export default FilterSort; 136 | -------------------------------------------------------------------------------- /src/Components/Navbar.jsx: -------------------------------------------------------------------------------- 1 | import { 2 | Box, 3 | Flex, 4 | Avatar, 5 | Button, 6 | Menu, 7 | MenuButton, 8 | MenuList, 9 | 10 | useColorModeValue, 11 | Stack, 12 | useColorMode, 13 | Center, 14 | Text, 15 | } from '@chakra-ui/react'; 16 | import { MoonIcon, SunIcon } from '@chakra-ui/icons'; 17 | import { useNavigate , Link } from 'react-router-dom'; 18 | 19 | 20 | const shadow = "rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px"; 21 | 22 | export default function Navbar() { 23 | const navigate = useNavigate() 24 | const { colorMode, toggleColorMode } = useColorMode(); 25 | 26 | 27 | const handleClick = () =>{ 28 | // navigate("/") 29 | } 30 | 31 | return ( 32 | <> 33 | 34 | 35 | 36 |

MusicApp

37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 52 | 56 | 57 | 58 |
59 |
60 | 64 |
65 |
66 |
67 |

Vivek Goswmai

68 |
69 |
70 | 71 |
72 |
73 |
74 |
75 |
76 |
77 | 78 | ); 79 | } -------------------------------------------------------------------------------- /src/Pages/EditMusicRecord.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from "react"; 2 | import { Navigate, useNavigate, useParams } from "react-router-dom"; 3 | import { useSelector } from "react-redux/es/hooks/useSelector"; 4 | import { getMusicRecords, updateMusicRecords } from "../Redux/AppReducer/action"; 5 | import { useDispatch } from "react-redux"; 6 | import { 7 | Flex, 8 | Box, 9 | FormControl, 10 | FormLabel, 11 | Input, 12 | Checkbox, 13 | Stack, 14 | Link, 15 | Button, 16 | Heading, 17 | useColorModeValue, 18 | } from "@chakra-ui/react"; 19 | 20 | const EditMusicRecord = () => { 21 | const dispatch = useDispatch() 22 | const navigate = useNavigate() 23 | 24 | 25 | const { id } = useParams(); 26 | 27 | 28 | const { musicRecords } = useSelector((store) => store.AppReducer); 29 | console.log(musicRecords); 30 | const [musicName, setMusicName] = useState(""); 31 | const [artistName, setArtistName] = useState(""); 32 | 33 | const handleSubmit = (e) => { 34 | e.preventDefault() 35 | if (musicName && artistName) { 36 | const payload = { 37 | name: musicName, 38 | artist: artistName, 39 | }; 40 | 41 | dispatch(updateMusicRecords(id, payload)).then((r) => 42 | dispatch(getMusicRecords()) 43 | ).then(()=> navigate(`/music/${id}`)) 44 | } 45 | }; 46 | 47 | useEffect(()=>{ 48 | if(musicRecords.length === 0){ 49 | dispatch(getMusicRecords()) 50 | } 51 | },[dispatch,musicRecords.length]) 52 | 53 | 54 | // console.log(musicName); 55 | useEffect(() => { 56 | if (id) { 57 | const currentMusic = musicRecords.find((album) => album.id === id); 58 | 59 | if (currentMusic) { 60 | setMusicName(currentMusic.name); 61 | setArtistName(currentMusic.artist); 62 | } 63 | } 64 | }, [id, musicRecords]); 65 | 66 | return 72 | 73 | 74 | Edit your data.... 75 | 76 | 77 | 83 | 84 | 85 | Edit Music Name... 86 | setMusicName(e.target.value)} value={musicName} /> 87 | 88 | 89 | Edit Artist Name... 90 | setArtistName(e.target.value)} value={artistName} /> 91 | 92 | 93 | 98 | 99 | 100 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | }; 119 | 120 | export default EditMusicRecord; 121 | 122 | // return ( 123 | //
124 | //

EditMusicRecord : {id}

125 | //
126 | //
127 | // 128 | // { 132 | // setMusicName(e.target.value); 133 | // }} 134 | // /> 135 | //
136 | //
137 | // 138 | // { 142 | // setArtistName(e.target.value); 143 | // }} 144 | // /> 145 | //
146 | // 147 | //
148 | //
-------------------------------------------------------------------------------- /src/Pages/Homepage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import FilterSort from "../Components/FilterSort"; 3 | import MusicRecords from "./MusicRecords"; 4 | import styled from "styled-components"; 5 | 6 | const Homepage = () => { 7 | return ( 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | ); 23 | }; 24 | 25 | export default Homepage; 26 | 27 | const HomePageWrapper = styled.div` 28 | display: flex; 29 | height: 100vh; 30 | 31 | 32 | `; 33 | const FilterSortWrapper = styled.div` 34 | position: fixed; 35 | box-shadow: rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(31, 30, 30, 0.3) 0px 18px 36px -18px inset; 36 | height: 100vh; 37 | width: 200px; 38 | margin-left: 5px; 39 | border-radius: 20px; 40 | border: 5px solid whitesmoke; 41 | `; 42 | 43 | const MusicRecorderWrapper = styled.div` 44 | width: 80%; 45 | margin-left: 250px; 46 | overflow: scroll; 47 | overflow-x: hidden; 48 | overflow-y: auto; 49 | 50 | /* border: 4px solid black; */ 51 | display:grid; 52 | grid-template-columns : repeat(auto-fit,minmax(300px,max-content)); 53 | justify-content : center; 54 | gap : 10px; 55 | box-shadow: rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset; 56 | border-radius: 20px; 57 | `; 58 | -------------------------------------------------------------------------------- /src/Pages/Login.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { useDispatch, useSelector } from "react-redux/es/exports"; 3 | import { login } from "../Redux/AuthReducer/action"; 4 | import { USER_LOGIN_SUCCESS } from "../Redux/AuthReducer/actionType"; 5 | import { 6 | Flex, 7 | Box, 8 | FormControl, 9 | FormLabel, 10 | Input, 11 | Checkbox, 12 | Stack, 13 | Link, 14 | Button, 15 | Heading, 16 | useColorModeValue, 17 | } from "@chakra-ui/react"; 18 | 19 | import { useNavigate, useLocation } from "react-router-dom"; 20 | 21 | const Login = () => { 22 | const location = useLocation(); 23 | const navigate = useNavigate(); 24 | const [email, setEmail] = useState("eve.holt@reqres.in"); 25 | const [password, setPassword] = useState(""); 26 | 27 | console.log("loginLocation", location); 28 | 29 | const { isAuth } = useSelector((state) => state.AuthReducer); 30 | console.log("isAuth", isAuth); 31 | const pathComingFrom = location.state?.from?.pathname || "/"; 32 | console.log(pathComingFrom); 33 | const dispatch = useDispatch(); 34 | 35 | const handleSubmit = (e) => { 36 | e.preventDefault(); 37 | console.log("email", email , password) 38 | if (email && password) { 39 | dispatch(login({ email, password })) 40 | .then((r) => { 41 | if (r.type === USER_LOGIN_SUCCESS) { 42 | navigate(pathComingFrom, { replace: true }); 43 | } 44 | }) 45 | .catch((error) => console.log(error)); 46 | } 47 | }; 48 | 49 | return ( 50 | 56 | 57 | 58 | Sign in to your account 59 | 60 | 61 | 67 | 68 | 69 | Email address 70 | setEmail(e.target.value)} type="email" value="eve.holt@reqres.in" /> 71 | 72 | 73 | Password 74 | setPassword(e.target.value)} /> 75 | 76 | 77 | 82 | Remember me 83 | Forgot password? 84 | 85 | 97 | 98 | 99 | 100 | 101 | 102 | ); 103 | }; 104 | 105 | export default Login; 106 | 107 | //
108 | //

LOGIN PAGE

109 | 110 | //
111 | //
112 | // 113 | // setEmail(e.target.value)} 118 | // /> 119 | //
120 | //
121 | // 122 | // setPassword(e.target.value)} 127 | // /> 128 | //
129 | 130 | // 131 | //
132 | //
133 | -------------------------------------------------------------------------------- /src/Pages/MainRoutes.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Route, Routes } from "react-router-dom"; 3 | import EditMusicRecord from "./EditMusicRecord"; 4 | import Homepage from "./Homepage"; 5 | import Login from "./Login"; 6 | import CheckAuth from "../Components/CheckAuth"; 7 | import SingleMusicRecord from "./SingleMusicRecord"; 8 | // protected route ==> checkauth 9 | const MainRoutes = () => { 10 | return ( 11 | <> 12 | 13 | } /> 14 | 18 | 19 | 20 | } 21 | /> 22 | } /> 23 | 27 | } 28 | /> 29 | Page Not Found...} /> 30 | 31 | 32 | ); 33 | }; 34 | 35 | export default MainRoutes; 36 | -------------------------------------------------------------------------------- /src/Pages/MusicRecords.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import { useDispatch, useSelector } from "react-redux"; 3 | import styled from "styled-components"; 4 | import { deleteFunc, getMusicRecords } from "../Redux/AppReducer/action"; 5 | import { useSearchParams, useLocation ,Link } from "react-router-dom"; 6 | import { Button, Center } from "@chakra-ui/react"; 7 | 8 | const MusicRecords = () => { 9 | 10 | const dispatch = useDispatch(); 11 | 12 | 13 | const { musicRecords , isLoading , isError } = useSelector((store) => store.AppReducer); 14 | 15 | const [searchParams] = useSearchParams(); 16 | 17 | const location = useLocation(); // detecting url 18 | // console.log("location",location) 19 | 20 | const handleDelete = (id) =>{ 21 | 22 | dispatch(deleteFunc(id)).then(()=>{ 23 | dispatch(getMusicRecords()) 24 | }) 25 | 26 | } 27 | 28 | useEffect(() => { 29 | 30 | if (location || musicRecords.length === 0) { 31 | 32 | const sortBy = searchParams.get("sortBy"); 33 | 34 | const queryParams = { 35 | params: { 36 | genre: searchParams.getAll("genre"), 37 | _sort: sortBy && "year", 38 | _order: sortBy, 39 | }, 40 | }; 41 | dispatch(getMusicRecords(queryParams)); 42 | } 43 | 44 | }, [location.search]); 45 | 46 | return ( 47 | <> 48 |
57 | {musicRecords?.map((album) => ( //optional chaining 58 | 59 |

{album.name}

60 | 61 |
62 | img not found 63 |
64 | 65 |
66 | 67 |
68 |

{album.genre}

69 |

{album.year}

70 |
71 | ))} 72 |
73 | 74 | ); 75 | }; 76 | 77 | export default MusicRecords; 78 | 79 | const MusicRecordssWrapper = styled.div` 80 | width: 300px; 81 | box-shadow: rgba(0, 0, 0, 0.17) 0px -23px 25px 0px inset, rgba(0, 0, 0, 0.15) 0px -36px 30px 0px inset, rgba(0, 0, 0, 0.1) 0px -79px 40px 0px inset, rgba(0, 0, 0, 0.06) 0px 2px 1px, rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px; 82 | height: 330px; 83 | border: 5px solid whitesmoke; 84 | border-radius: 15px; 85 | margin-top: 7px; 86 | margin-right : 10px; 87 | `; 88 | -------------------------------------------------------------------------------- /src/Pages/SingleMusicRecord.jsx: -------------------------------------------------------------------------------- 1 | import { Button, Center, Flex } from "@chakra-ui/react"; 2 | import React, { useEffect, useState } from "react"; 3 | import { useSelector, useDispatch } from "react-redux"; 4 | import { useParams, Link } from "react-router-dom"; 5 | import { getMusicRecords } from "../Redux/AppReducer/action"; 6 | 7 | const SingleMusicRecord = () => { 8 | //some data in the params 9 | // get the id from the params 10 | //filter the music albums based on the id 11 | // get the album pertaining to that particular id 12 | 13 | const dispatch = useDispatch(); 14 | const [currentMusicAlbum, setCurrentMusicAlbum] = useState({}); 15 | const { id } = useParams(); 16 | const { musicRecords } = useSelector((state) => state.AppReducer); 17 | 18 | // console.log(musicRecords) 19 | // console.log(id) 20 | 21 | useEffect(() => { 22 | if (!musicRecords.length) { 23 | dispatch(getMusicRecords()); 24 | } 25 | }, [dispatch, musicRecords.length]); 26 | useEffect(() => { 27 | if (id) { 28 | // console.log(musicRecords) 29 | //filter the album based on the id 30 | const currentMusic = musicRecords.find((album) => album.id === id); 31 | currentMusic && setCurrentMusicAlbum(currentMusic); 32 | } 33 | }, [id, musicRecords]); 34 | 35 | // console.log(currentMusicAlbum) 36 | 37 | return ( 38 |
39 | 40 | 41 |

SingleMusicRecord

42 | 43 |



44 | 45 | 46 | 47 |

{currentMusicAlbum.id}

48 |

{currentMusicAlbum.name}

49 |

{currentMusicAlbum.genre}

50 | pic 51 |

{currentMusicAlbum.artist}

52 |
53 | 54 | 55 |
56 |
57 | ); 58 | }; 59 | 60 | export default SingleMusicRecord; 61 | -------------------------------------------------------------------------------- /src/Redux/AppReducer/action.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import { 3 | GET_MUSIC_RECORD_FAILURE, 4 | GET_MUSIC_RECORD_REQUEST, 5 | GET_MUSIC_RECORD_SUCCESS, 6 | UPDATE_FAILURE, 7 | UPDATE_REQUEST, 8 | UPDATE_SUCCESS, 9 | } from "./actionType"; 10 | 11 | const url = "https://good-puce-caterpillar-boot.cyclic.app/albums" 12 | 13 | export const getMusicRecords = (params) => (dispatch) => { 14 | dispatch({ type: GET_MUSIC_RECORD_REQUEST }); 15 | console.log("param in actionnnnnnn", params); 16 | 17 | return axios 18 | .get(url, params) 19 | .then((res) => { 20 | return dispatch({ type: GET_MUSIC_RECORD_SUCCESS, payload: res.data }); 21 | }) 22 | .catch((e) => dispatch({ type: GET_MUSIC_RECORD_FAILURE })); 23 | }; 24 | 25 | export const updateMusicRecords = (id, payload) => (dispatch) => { 26 | dispatch({ type: UPDATE_REQUEST }); 27 | 28 | return axios 29 | .patch(`${url}/${id}`, payload) 30 | .then((r) => dispatch({ type: UPDATE_SUCCESS })) 31 | .catch((e) => dispatch({ type: UPDATE_FAILURE })); 32 | }; 33 | 34 | export const deleteFunc = (id) => async (dispatch) => { 35 | // database 36 | try{ 37 | await axios.delete(`${url}/${id}`) 38 | }catch(err){ 39 | console.log(err) 40 | } 41 | 42 | }; 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/Redux/AppReducer/actionType.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | export const GET_MUSIC_RECORD_REQUEST = "GET_MUSIC_RECORD_REQUEST"; 5 | export const GET_MUSIC_RECORD_SUCCESS = "GET_MUSIC_RECORD_SUCCESS"; 6 | export const GET_MUSIC_RECORD_FAILURE = "GET_MUSIC_RECORD_FAILURE"; 7 | 8 | 9 | export const UPDATE_REQUEST = "UPDATE_REQUEST" 10 | export const UPDATE_SUCCESS = "UPDATE_SUCCESS" 11 | export const UPDATE_FAILURE = "UPDATE_FAILURE" -------------------------------------------------------------------------------- /src/Redux/AppReducer/reducer.js: -------------------------------------------------------------------------------- 1 | import { 2 | GET_MUSIC_RECORD_FAILURE, 3 | GET_MUSIC_RECORD_REQUEST, 4 | GET_MUSIC_RECORD_SUCCESS, 5 | } from "./actionType"; 6 | 7 | // store.AppReducer.musicRecotds 8 | const initialState = { 9 | musicRecords: [], 10 | isLoading: false, 11 | isError: false, 12 | }; 13 | 14 | 15 | const reducer = (oldState = initialState, action) => { // {state,action -> type , payload} 16 | const { type, payload } = action; 17 | 18 | switch (type) { 19 | case GET_MUSIC_RECORD_REQUEST: 20 | return { 21 | ...oldState, 22 | isLoading: true, 23 | isErrr: false, 24 | }; 25 | case GET_MUSIC_RECORD_SUCCESS: 26 | return { 27 | ...oldState, 28 | isLoading: false, 29 | isErrr: false, 30 | musicRecords: payload, 31 | }; 32 | case GET_MUSIC_RECORD_FAILURE: 33 | return { 34 | ...oldState, 35 | isLoading: false, 36 | isErrr: true, 37 | }; 38 | 39 | default: 40 | return oldState; 41 | } 42 | }; 43 | 44 | export { reducer }; 45 | -------------------------------------------------------------------------------- /src/Redux/AuthReducer/action.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import { 3 | USER_LOGIN_FAILURE, 4 | USER_LOGIN_REQUEST, 5 | USER_LOGIN_SUCCESS, 6 | } from "./actionType"; 7 | 8 | export const login = (payload) => (dispatch) => { 9 | dispatch({ type: USER_LOGIN_REQUEST }); 10 | 11 | return axios({ 12 | method: "post", 13 | url: "/api/login", 14 | baseURL: "https://reqres.in", 15 | data: payload, 16 | }) 17 | .then((r) => dispatch({ type: USER_LOGIN_SUCCESS, payload: r.data })) 18 | .catch((error) => dispatch(USER_LOGIN_FAILURE)); 19 | }; 20 | -------------------------------------------------------------------------------- /src/Redux/AuthReducer/actionType.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | export const USER_LOGIN_REQUEST = "USER_LOGIN_REQUEST" 5 | export const USER_LOGIN_SUCCESS = "USER_LOGIN_SUCCESS" 6 | export const USER_LOGIN_FAILURE = "USER_LOGIN_FAILURE" -------------------------------------------------------------------------------- /src/Redux/AuthReducer/reducer.js: -------------------------------------------------------------------------------- 1 | import { 2 | USER_LOGIN_FAILURE, 3 | USER_LOGIN_REQUEST, 4 | USER_LOGIN_SUCCESS, 5 | } from "./actionType"; 6 | 7 | let initialState = { 8 | isAuth: false, 9 | token: "", 10 | isLoading: false, 11 | isError: false, 12 | }; 13 | 14 | export const reducer = (state = initialState, action) => { 15 | const { type, payload } = action; 16 | 17 | switch (type) { 18 | case USER_LOGIN_REQUEST: 19 | return { 20 | ...state, 21 | isLoading: true, 22 | }; 23 | case USER_LOGIN_SUCCESS: 24 | return { 25 | ...state, 26 | isAuth: true, 27 | isLoading: false, 28 | token: payload, 29 | }; 30 | case USER_LOGIN_FAILURE: 31 | return { 32 | ...state, 33 | isLoading: false, 34 | isError: true, 35 | }; 36 | default: 37 | return state; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /src/Redux/store.js: -------------------------------------------------------------------------------- 1 | import { applyMiddleware, legacy_createStore, combineReducers } from "redux"; 2 | import { reducer as AppReducer } from "./AppReducer/reducer"; 3 | import { reducer as AuthReducer } from "./AuthReducer/reducer"; 4 | 5 | import thunk from "redux-thunk"; 6 | 7 | // thunk --> action is it function ? if yes then what i do 8 | // simply attach the dispactch 9 | 10 | const rootReducer = combineReducers({ AppReducer, AuthReducer }); 11 | 12 | let middleware = [thunk] 13 | 14 | const store = legacy_createStore(rootReducer, applyMiddleware(...middleware)); 15 | 16 | export { store }; 17 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | import reportWebVitals from "./reportWebVitals"; 6 | import { Provider } from "react-redux"; 7 | import { store } from "./Redux/store"; 8 | import { BrowserRouter } from "react-router-dom"; 9 | import { ChakraProvider } from "@chakra-ui/react"; 10 | const root = ReactDOM.createRoot(document.getElementById("root")); 11 | root.render( 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | ); 20 | 21 | // If you want to start measuring performance in your app, pass a function 22 | // to log results (for example: reportWebVitals(console.log)) 23 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 24 | reportWebVitals(); 25 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------