├── .babelrc ├── .editorconfig ├── .env ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .huskyrc.json ├── .nvmrc ├── .prettierignore ├── .prettierrc ├── .storybook ├── addons.js ├── config.js └── preview-head.html ├── .travis.yml ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── LICENSE ├── README.md ├── docs └── images │ └── drum-root.svg ├── e2e └── signin │ └── signin.js ├── jest-e2e.config.js ├── jest-puppeteer.config.js ├── jsconfig.json ├── next.config.js ├── package-lock.json ├── package.json ├── project.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── Components │ ├── Custom-Button │ │ ├── index.js │ │ └── story.js │ ├── DrumLoopTile │ │ ├── DrumLoopTile.story.js │ │ ├── index.js │ │ └── index.test.js │ ├── DrumPad │ │ ├── index.js │ │ ├── index.test.js │ │ └── story.js │ ├── Error │ │ ├── index.js │ │ └── index.test.js │ ├── ErrorBoundary │ │ ├── index.js │ │ └── index.test.js │ ├── FormWrapper │ │ ├── index.js │ │ └── index.test.js │ ├── Input │ │ ├── Input.story.js │ │ ├── index.js │ │ └── index.test.js │ ├── Loader │ │ ├── Loader.story.js │ │ └── index.js │ ├── Logo │ │ └── Logo.js │ ├── PlayPauseButton │ │ ├── PlayPauseButton.story.js │ │ └── index.js │ ├── SoundUploader │ │ ├── index.js │ │ └── story.js │ ├── SoundWave │ │ ├── SoundWave.story.js │ │ └── index.js │ ├── SplashScreen │ │ ├── SplashScreen.styles.js │ │ └── index.js │ └── TimeSignature │ │ └── timeSignature.js ├── constants │ └── constants.js ├── mockData │ └── mockLayout.js ├── pages │ ├── _app.js │ ├── _document.js │ ├── index.js │ └── signin.js ├── resources │ ├── audio │ │ └── testSound.mp3 │ ├── icons │ │ ├── bass-drum.svg │ │ ├── bongos.svg │ │ ├── cowbell.svg │ │ ├── crashSplashRideChinaCymbal.svg │ │ ├── drum-root-alternative.svg │ │ ├── floorTom.svg │ │ ├── gong.svg │ │ ├── guiro.svg │ │ ├── hi-hat.svg │ │ ├── rackToms.svg │ │ ├── shakers.svg │ │ ├── snare-drum.svg │ │ ├── tambourine.svg │ │ ├── triangle.svg │ │ ├── wood-block.svg │ │ └── xylophone.svg │ └── logos │ │ ├── large.svg │ │ ├── largest.svg │ │ ├── logo_image.jpg │ │ ├── medium.svg │ │ └── small.svg ├── serviceWorker.js ├── setupTests.js └── utils │ ├── common-functions.js │ ├── sounds.js │ └── test-utils.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel"], 3 | "plugins": [ 4 | [ 5 | "styled-components", 6 | { 7 | "ssr": true, 8 | "displayName": true, 9 | "preprocess": false 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_style = space 3 | indent_size = 2 -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | REACT_APP_SIGNIN_URL=http://localhost:3000/signin 2 | REACT_APP_DRUM_LAYOUT=http://localhost:3000/drumlayout 3 | REACT_APP_TOKEN_TYPE=Bearer 4 | NODE_PATH=src/utils -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .next/ 3 | out/ 4 | src/serviceWorker.js 5 | .storybook/* -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["airbnb", "prettier"], 3 | "plugins": ["prettier", "react"], 4 | "env": { 5 | "browser": true, 6 | "es6": true, 7 | "jest": true, 8 | "node": true 9 | }, 10 | "rules": { 11 | "no-console": "off", 12 | "no-plusplus": "off", 13 | "no-shadow": "off", 14 | "no-use-before-define": "off", 15 | "react/jsx-filename-extension": "off", 16 | "react/jsx-props-no-spreading": "off", 17 | "react/no-array-index-key": "off", 18 | "react/require-default-props": "off", 19 | "react/button-has-type": "off", 20 | "import/no-extraneous-dependencies": [ 21 | "error", 22 | { 23 | "devDependencies": true 24 | } 25 | ], 26 | "jsx-a11y/label-has-associated-control": [ 27 | "error", 28 | { 29 | "required": { 30 | "some": ["nesting", "id"] 31 | } 32 | } 33 | ], 34 | "jsx-a11y/label-has-for": [ 35 | "error", 36 | { 37 | "required": { 38 | "some": ["nesting", "id"] 39 | } 40 | } 41 | ], 42 | "jsx-a11y/no-noninteractive-element-interactions": "off", 43 | "jsx-a11y/click-events-have-key-events": "off" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.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 | .next 8 | .idea 9 | 10 | # testing 11 | /coverage 12 | 13 | # production 14 | /build 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* -------------------------------------------------------------------------------- /.huskyrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-commit": "lint-staged" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 10.16.3 -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .next/ 3 | out/ 4 | package.json 5 | package-lock.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '@storybook/addon-knobs/register'; 2 | import '@storybook/addon-actions/register'; 3 | import '@storybook/addon-links/register'; 4 | -------------------------------------------------------------------------------- /.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure } from '@storybook/react'; 2 | 3 | // automatically import all files ending in *.stories.js 4 | const loadStories = () => { 5 | const req = require.context('../src/Components', true, /.story.js$/); 6 | req.keys().forEach(filename => req(filename)); 7 | }; 8 | 9 | configure(loadStories, module); 10 | -------------------------------------------------------------------------------- /.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | dist: trusty 5 | addons: 6 | apt: 7 | packages: 8 | - libnss3 9 | sudo: required 10 | notifications: 11 | email: false 12 | cache: 13 | directories: 14 | - node_modules 15 | before_install: 16 | # Enable user namespace cloning 17 | - "sysctl kernel.unprivileged_userns_clone=1" 18 | # Launch XVFB 19 | - "export DISPLAY=:99.0" 20 | - "sh -e /etc/init.d/xvfb start" 21 | jobs: 22 | include: 23 | - stage: "Tests" 24 | name: "Linting Tests" 25 | script: npm run lint 26 | - script: npm run test 27 | name: "Unit Tests" 28 | - script: npm run test:e2e 29 | name: "Integration Tests" 30 | - stage: "Build" 31 | script: npm run build 32 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Drum Root 2 | 3 | **[Back to Drum Root](./README.md)** 4 | 5 | ## Table of content 6 | 7 | - [First steps](#First-steps) 8 | - [Trello Columns](#Trello-Columns) 9 | - [Additional Questions](#Additional-Questions) 10 | - [Extra Notes](#Extra-Notes) 11 | 12 | ## First steps 13 | 14 | - Fork [drum-root](https://github.com/zero-to-mastery/drum-root) (and [drum-root-api](https://github.com/zero-to-mastery/drum-root-api)) 15 | - Add your name to the [CONTRIBUTORS.md](https://github.com/zero-to-mastery/drum-root/blob/master/CONTRIBUTORS.md) file 16 | - Commit your changes and create a pull request (through your forked repository) 17 | - Once your PR is approved and merged you are officially a contributor! You can then begin to look for tasks to do in our Trello boards. To gain access to these boards, request an invitation in our Discord channel. 18 | - Note: Just like your first contribution, you will continue to create new pull requests through your forked repository. 19 | 20 | ### When contributing to this repository, check the Trello board for available tasks. 21 | 22 | `To gain access to the Trello boards please request access through our dedicated Discord channel` 23 | 24 | ### If the task is: 25 | 26 | - **Available**: Go ahead and _claim the task_. You can assign it to yourself by editing your name into the card and moving it into the `Doing` column. 27 | - **Claimed**: If someone else has claimed the task, speak with them or one of the project admin. 28 | - **In Code Review**: You should move your task into the `Code Review` column after you have created a Pull Request for the task. Keep checking your Pull Request in case a team member asks for some changes to be made. 29 | - **Non-Existant**: If the feature does not appear on trello, _discuss it on Discord or speak with a project admin_. This is to ensure, everyone has the chance to get involved without wasting their time or rushing to add the feature. 30 | 31 | ## Trello Columns 32 | 33 | ### To Do 34 | 35 | Current things that are approved to work on and can be assigned or claimed. 36 | 37 | ### Doing 38 | 39 | Drag your task into this section and add yourself as a member when you start working on it. 40 | 41 | ### Code Review 42 | 43 | This is where tasks are placed whilst the PR has been submitted and is awaiting approval. Once the code has been reviewed, it will be merged and the card can be move to Done. 44 | 45 | ### Done 46 | 47 | All of the tasks that have been merged into the master branch. 48 | 49 | ## Additional Questions 50 | 51 | If you have questions about how to contribute, contact a project admin through Discord (we have a dedicated channel for the project **#drum-root**). 52 | 53 | ## Extra Notes 54 | 55 | **We recognize all contributors** 56 | Contributions can be: 57 | Answering questions, bug reports, code, documentation, content, design, PR reviews, ideas & planning, translation, tests, tutorials, etc. 58 | 59 | **[Back to Drum Root](./README.md)** 60 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | # Drum Root Contributors 2 | 3 | **[Back to Drum Root](./README.md)** 4 | 5 | ## Instructions on adding your name 6 | 7 | Add your name/nickname, github accont, and discord name. 8 | 9 | Please follow this template: 10 | 11 | ``` 12 | - {your name/nickname} | {https://github.com/your-account} | {your discord name} 13 | ``` 14 | 15 | --- 16 | 17 | ## List of Contributors 18 | 19 | - Ocean | https://github.com/oceansf | lotion#7670 20 | - Gavin | https://github.com/rgavinc | Gavin#6391 21 | - Amirdlz | https://github.com/aynorica | Amirdlz#6941 22 | - Yash | https://github.com/yashShelatkar | yaashShelatkar 23 | - Katuka | https://github.com/Katuka | katebe#5347 24 | - Josh | https://github.com/joshtru | Josh#1595 25 | - Enny | https://github.com/maxcutex | Enny#5667 26 | - Guillaume | https://github.com/Agilulfe | Agilulfe_Edme#2996 27 | - Ryan | https://github.com/rvvergara | rvvergara#8575 28 | - Adewoyin | https://github.com/nucternal18 | aolausoro 29 | - Juho | https://github.com/leejooho77 | Juho Lee#2770 30 | - Diemention | https://github.com/guitarhub786 | Diemention#1534 31 | - Felipe Vidal | https://github.com/FelipeSVidal | Felipe_Vidal#3388 32 | - Devon | https://github.com/ayodlo | ayodlo#4418 33 | - Diane | https://github.com/leighd2008 | Diane#3610 34 | - Coded | https://github.com/talk2coded | Talk2coded 35 | - Abhinav | https://github.com/AbsMechanik | AbsMechanik#5535 36 | - Valentin | https://github.com/StanciuV | stanval#0433 37 | - Aneesh | https://github.com/aneesh4995 | Aneesh#9599 38 | - Giuliano | https://github.com/giulianocernada | giulianomax#9459 39 | - Bo | https://github.com/zbc | Bo#3729 40 | - BiswaViraj | https://github.com/BiswaViraj | BiswaViraj#1405 41 | - Kiran Nyayapati | https://github.com/kiran-nyayapati | Kiran_Nyayapati#9952 42 | - Lincon Kusunoki | https://github.com/linconkusunoki | Lincon Kusunoki#1682 43 | - Aebbie Rontos | https://github.com/aevi1103 | aevi1103#6718 44 | - Mattia | https://github.com/metius | mattiaV.#2506 45 | - Xhawk | https://github.com/sameerrM | hawk#1682 46 | - yitzhak bloy | https://github.com/yitzhak-bloy | ytzhak#5668 47 | - Ayush Singh Kushwaha| https://github.com/Ayush909 | TheAyushThing#0552 48 | - Adenekan Wonderful | https://github.com/adenekan41 | codewonders#8148 49 | - Hankles | https://github.com/hankles | hankles\_#4107 50 | - Pramod Singh | https://github.com/prmdsngh | pramod Singh#1495 51 | - Ronnen Nagal | https://github.com/nagalr | nagalr 52 | - Kervin Vasquez | https://github.com/kervin5 | Kervin5#3175 53 | - Parveen Kumar | https://github.com/parveenmittal1 | mysterious_code 54 | - Cliff | https://github.com/cliftontc | cliftontc#8746 55 | - Marco Seoane | https://github.com/marcoseoane | dustyfrxsh#1226 56 | - Aman Saharan | https://github.com/amansaharan | amansaharan#0888 57 | - Vishnu Prasad P S | https://github.com/vishnup95 | vishnup95 58 | - Shiva Reddy |https://github.com/shivareddy |Shiva Reddy 59 | - Ahamisi Godsfavour | https://github.com/ahamisi | aceman 60 | - Tisha | https://github.com/tmurvv/drum-root | tmurv 61 | - Sander | https://github.com/Sandermoen | Snader#9933 62 | - Francisco Silva | https://github.com/francisco-f-silva | Cisco123#3822 63 | - Kenneth | https://github.com/kencode7 | kencode#2025 64 | - Emmanuel | https://github.com/SkyC0der | Emmanuell#9392 65 | - Chris |https://github.com/christocarr | ChrisC#3242 66 | - Justin | https://github.com/CatsOnFilm | JustinBB#1681 67 | - Allison | https://github.com/allisonnnnnn | Allison#1565 68 | - Timo Köhler / bukto | https://github.com/koehlertimo | bukto\_#6269 69 | - Neaj | https://github.com/rovinox | rovinox#5244 70 | - Aditya | https://github.com/adimohankv | adi#4829 71 | - Adrian | https://github.com/adrianmonteil1983 | frenchie#0857 72 | - Odira | https://github.com/odira1 | Odira#6234 73 | - Arseniy | https://github.com/ArseniyX | Arseniy#4912 74 | - Klaven | https://github.com/klavenjones | klavenjones#2869 75 | - Nacho | https://github.com/ignaciocieza | nacholf 76 | - Aryansh Mahato | https://github.com/AryanshMahato | Aryansh#4325 77 | - Edwin Boon | https://github.com/edwinboon| Edwin#0147 78 | - Agnieszka Wozniak | https://github.com/woziu17 | WOZIU#4233 79 | - Will | https://github.com/arkiis | Arkiis#0778 80 | - Mobasergio | https://github.com/mobasergio | Nytz#7425 81 | - Domantas Bazys | https://github.com/DomantasBazys | Domantuxazz#4934 82 | - Lukas Hirt | https://github.com/LukasHirt | Lukas Hirt#1524 83 | - Brandon Tripp | https://github.com/Brandon-G-Tripp | BGTripp3 #0636 84 | - Yassine | https://github.com/Yassineab27 | Yass#0186 85 | - Anurag Yadav | https://github.com/yadavanurag | yadavanurag#0362 86 | - Daewon Kim | https://github.com/xoxwgys56 | xoxwgys56 87 | - Mike | https://github.com/MikePassetti | MikeP 88 | - Natalie | https://github.com/NataliePina | nataliepina 89 | - Sushant | https://github.com/frozenparadox99 | sushant#7722 90 | - Ash | https://github.com/ashcyber | ashcyber 91 | - Luc | https://github.com/lucvankerkvoort | lucvankerkvoort#5222 92 | - RedJanvier | https://github.com/RedJanvier | RedJanvier#4486 93 | - Sebastian | https://github.com/sebo94 | Hikikomori 94 | - NelsonPunch | https://github.com/tomneo2004 | NelsonPunch#2092 95 | - Raul | https://github.com/Murciegalo | Murciegalo 96 | - Sana Shaik | https://github.com/sanashaik123 | s2code#0842 97 | - NikhathFirdose |https://github.com/nikhathfirdose|nikhath_firdose#1318 98 | - AlbertP | https://github.com/acpucio | digdog3000 99 | - Tumo Masire | https://github.com/TumoM | SwagTM#1242 100 | - Deepak | https://github.com/deepakhb2 | Deepak#6171 101 | - Freyr Helgason | https://github.com/frhel | Freysi#1354 102 | - Bogdan Barjaktarevic | https://github.com/BogdanBarjaktarevic | Bogi#0305 103 | - Nedeljko | https://github.com/berisavac | Nedeljko#1527 104 | - Jordan | https://github.com/jpstanway | mtninja#0126 105 | - Kelvin | https://github.com/kelvinabella | kelvs#7175 106 | - Tony Hoss | https://github.com/BigT1305 | BT32#2337 107 | - Shuntaro | https://github.com/maegatro | Mae28#0093 108 | - Manivel Nagarajan | https://github.com/manivelnagarajan | Manivel#9590 109 | - Aniket | https://github.com/arkeo01 | AniketParate#7911 110 | - Vincent | https://github.com/Vincent-Vais | Vince_Vais#0504 111 | - Achiya | https://github.com/achiyahb | achiyahb#2225 112 | - Ayush kakkar | https://github.com/Ayushkakkar24 | ayush#swag 113 | - Mike Coleman | https://github.com/mcflav | Mike Coleman 114 | - GAurav Deshwal| https://github.com/grvdshwl | Gaurav Deshwal#2512 115 | 116 | **[Back to Drum Root](./README.md)** 117 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Drum Root (c) 2019 Gavin Robertson 2 | 3 | Drum Root is licensed under a 4 | Creative Commons Attribution 4.0 International License. 5 | 6 | You should have received a copy of the license along with this 7 | work. If not, see . 8 | 9 | Attribution 4.0 International 10 | 11 | ======================================================================= 12 | 13 | Creative Commons Corporation ("Creative Commons") is not a law firm and 14 | does not provide legal services or legal advice. Distribution of 15 | Creative Commons public licenses does not create a lawyer-client or 16 | other relationship. Creative Commons makes its licenses and related 17 | information available on an "as-is" basis. Creative Commons gives no 18 | warranties regarding its licenses, any material licensed under their 19 | terms and conditions, or any related information. Creative Commons 20 | disclaims all liability for damages resulting from their use to the 21 | fullest extent possible. 22 | 23 | Using Creative Commons Public Licenses 24 | 25 | Creative Commons public licenses provide a standard set of terms and 26 | conditions that creators and other rights holders may use to share 27 | original works of authorship and other material subject to copyright 28 | and certain other rights specified in the public license below. The 29 | following considerations are for informational purposes only, are not 30 | exhaustive, and do not form part of our licenses. 31 | 32 | Considerations for licensors: Our public licenses are 33 | intended for use by those authorized to give the public 34 | permission to use material in ways otherwise restricted by 35 | copyright and certain other rights. Our licenses are 36 | irrevocable. Licensors should read and understand the terms 37 | and conditions of the license they choose before applying it. 38 | Licensors should also secure all rights necessary before 39 | applying our licenses so that the public can reuse the 40 | material as expected. Licensors should clearly mark any 41 | material not subject to the license. This includes other CC- 42 | licensed material, or material used under an exception or 43 | limitation to copyright. More considerations for licensors: 44 | wiki.creativecommons.org/Considerations_for_licensors 45 | 46 | Considerations for the public: By using one of our public 47 | licenses, a licensor grants the public permission to use the 48 | licensed material under specified terms and conditions. If 49 | the licensor's permission is not necessary for any reason--for 50 | example, because of any applicable exception or limitation to 51 | copyright--then that use is not regulated by the license. Our 52 | licenses grant only permissions under copyright and certain 53 | other rights that a licensor has authority to grant. Use of 54 | the licensed material may still be restricted for other 55 | reasons, including because others have copyright or other 56 | rights in the material. A licensor may make special requests, 57 | such as asking that all changes be marked or described. 58 | Although not required by our licenses, you are encouraged to 59 | respect those requests where reasonable. More_considerations 60 | for the public: 61 | wiki.creativecommons.org/Considerations_for_licensees 62 | 63 | ======================================================================= 64 | 65 | Creative Commons Attribution 4.0 International Public License 66 | 67 | By exercising the Licensed Rights (defined below), You accept and agree 68 | to be bound by the terms and conditions of this Creative Commons 69 | Attribution 4.0 International Public License ("Public License"). To the 70 | extent this Public License may be interpreted as a contract, You are 71 | granted the Licensed Rights in consideration of Your acceptance of 72 | these terms and conditions, and the Licensor grants You such rights in 73 | consideration of benefits the Licensor receives from making the 74 | Licensed Material available under these terms and conditions. 75 | 76 | 77 | Section 1 -- Definitions. 78 | 79 | a. Adapted Material means material subject to Copyright and Similar 80 | Rights that is derived from or based upon the Licensed Material 81 | and in which the Licensed Material is translated, altered, 82 | arranged, transformed, or otherwise modified in a manner requiring 83 | permission under the Copyright and Similar Rights held by the 84 | Licensor. For purposes of this Public License, where the Licensed 85 | Material is a musical work, performance, or sound recording, 86 | Adapted Material is always produced where the Licensed Material is 87 | synched in timed relation with a moving image. 88 | 89 | b. Adapter's License means the license You apply to Your Copyright 90 | and Similar Rights in Your contributions to Adapted Material in 91 | accordance with the terms and conditions of this Public License. 92 | 93 | c. Copyright and Similar Rights means copyright and/or similar rights 94 | closely related to copyright including, without limitation, 95 | performance, broadcast, sound recording, and Sui Generis Database 96 | Rights, without regard to how the rights are labeled or 97 | categorized. For purposes of this Public License, the rights 98 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 99 | Rights. 100 | 101 | d. Effective Technological Measures means those measures that, in the 102 | absence of proper authority, may not be circumvented under laws 103 | fulfilling obligations under Article 11 of the WIPO Copyright 104 | Treaty adopted on December 20, 1996, and/or similar international 105 | agreements. 106 | 107 | e. Exceptions and Limitations means fair use, fair dealing, and/or 108 | any other exception or limitation to Copyright and Similar Rights 109 | that applies to Your use of the Licensed Material. 110 | 111 | f. Licensed Material means the artistic or literary work, database, 112 | or other material to which the Licensor applied this Public 113 | License. 114 | 115 | g. Licensed Rights means the rights granted to You subject to the 116 | terms and conditions of this Public License, which are limited to 117 | all Copyright and Similar Rights that apply to Your use of the 118 | Licensed Material and that the Licensor has authority to license. 119 | 120 | h. Licensor means the individual(s) or entity(ies) granting rights 121 | under this Public License. 122 | 123 | i. Share means to provide material to the public by any means or 124 | process that requires permission under the Licensed Rights, such 125 | as reproduction, public display, public performance, distribution, 126 | dissemination, communication, or importation, and to make material 127 | available to the public including in ways that members of the 128 | public may access the material from a place and at a time 129 | individually chosen by them. 130 | 131 | j. Sui Generis Database Rights means rights other than copyright 132 | resulting from Directive 96/9/EC of the European Parliament and of 133 | the Council of 11 March 1996 on the legal protection of databases, 134 | as amended and/or succeeded, as well as other essentially 135 | equivalent rights anywhere in the world. 136 | 137 | k. You means the individual or entity exercising the Licensed Rights 138 | under this Public License. Your has a corresponding meaning. 139 | 140 | 141 | Section 2 -- Scope. 142 | 143 | a. License grant. 144 | 145 | 1. Subject to the terms and conditions of this Public License, 146 | the Licensor hereby grants You a worldwide, royalty-free, 147 | non-sublicensable, non-exclusive, irrevocable license to 148 | exercise the Licensed Rights in the Licensed Material to: 149 | 150 | a. reproduce and Share the Licensed Material, in whole or 151 | in part; and 152 | 153 | b. produce, reproduce, and Share Adapted Material. 154 | 155 | 2. Exceptions and Limitations. For the avoidance of doubt, where 156 | Exceptions and Limitations apply to Your use, this Public 157 | License does not apply, and You do not need to comply with 158 | its terms and conditions. 159 | 160 | 3. Term. The term of this Public License is specified in Section 161 | 6(a). 162 | 163 | 4. Media and formats; technical modifications allowed. The 164 | Licensor authorizes You to exercise the Licensed Rights in 165 | all media and formats whether now known or hereafter created, 166 | and to make technical modifications necessary to do so. The 167 | Licensor waives and/or agrees not to assert any right or 168 | authority to forbid You from making technical modifications 169 | necessary to exercise the Licensed Rights, including 170 | technical modifications necessary to circumvent Effective 171 | Technological Measures. For purposes of this Public License, 172 | simply making modifications authorized by this Section 2(a) 173 | (4) never produces Adapted Material. 174 | 175 | 5. Downstream recipients. 176 | 177 | a. Offer from the Licensor -- Licensed Material. Every 178 | recipient of the Licensed Material automatically 179 | receives an offer from the Licensor to exercise the 180 | Licensed Rights under the terms and conditions of this 181 | Public License. 182 | 183 | b. No downstream restrictions. You may not offer or impose 184 | any additional or different terms or conditions on, or 185 | apply any Effective Technological Measures to, the 186 | Licensed Material if doing so restricts exercise of the 187 | Licensed Rights by any recipient of the Licensed 188 | Material. 189 | 190 | 6. No endorsement. Nothing in this Public License constitutes or 191 | may be construed as permission to assert or imply that You 192 | are, or that Your use of the Licensed Material is, connected 193 | with, or sponsored, endorsed, or granted official status by, 194 | the Licensor or others designated to receive attribution as 195 | provided in Section 3(a)(1)(A)(i). 196 | 197 | b. Other rights. 198 | 199 | 1. Moral rights, such as the right of integrity, are not 200 | licensed under this Public License, nor are publicity, 201 | privacy, and/or other similar personality rights; however, to 202 | the extent possible, the Licensor waives and/or agrees not to 203 | assert any such rights held by the Licensor to the limited 204 | extent necessary to allow You to exercise the Licensed 205 | Rights, but not otherwise. 206 | 207 | 2. Patent and trademark rights are not licensed under this 208 | Public License. 209 | 210 | 3. To the extent possible, the Licensor waives any right to 211 | collect royalties from You for the exercise of the Licensed 212 | Rights, whether directly or through a collecting society 213 | under any voluntary or waivable statutory or compulsory 214 | licensing scheme. In all other cases the Licensor expressly 215 | reserves any right to collect such royalties. 216 | 217 | 218 | Section 3 -- License Conditions. 219 | 220 | Your exercise of the Licensed Rights is expressly made subject to the 221 | following conditions. 222 | 223 | a. Attribution. 224 | 225 | 1. If You Share the Licensed Material (including in modified 226 | form), You must: 227 | 228 | a. retain the following if it is supplied by the Licensor 229 | with the Licensed Material: 230 | 231 | i. identification of the creator(s) of the Licensed 232 | Material and any others designated to receive 233 | attribution, in any reasonable manner requested by 234 | the Licensor (including by pseudonym if 235 | designated); 236 | 237 | ii. a copyright notice; 238 | 239 | iii. a notice that refers to this Public License; 240 | 241 | iv. a notice that refers to the disclaimer of 242 | warranties; 243 | 244 | v. a URI or hyperlink to the Licensed Material to the 245 | extent reasonably practicable; 246 | 247 | b. indicate if You modified the Licensed Material and 248 | retain an indication of any previous modifications; and 249 | 250 | c. indicate the Licensed Material is licensed under this 251 | Public License, and include the text of, or the URI or 252 | hyperlink to, this Public License. 253 | 254 | 2. You may satisfy the conditions in Section 3(a)(1) in any 255 | reasonable manner based on the medium, means, and context in 256 | which You Share the Licensed Material. For example, it may be 257 | reasonable to satisfy the conditions by providing a URI or 258 | hyperlink to a resource that includes the required 259 | information. 260 | 261 | 3. If requested by the Licensor, You must remove any of the 262 | information required by Section 3(a)(1)(A) to the extent 263 | reasonably practicable. 264 | 265 | 4. If You Share Adapted Material You produce, the Adapter's 266 | License You apply must not prevent recipients of the Adapted 267 | Material from complying with this Public License. 268 | 269 | 270 | Section 4 -- Sui Generis Database Rights. 271 | 272 | Where the Licensed Rights include Sui Generis Database Rights that 273 | apply to Your use of the Licensed Material: 274 | 275 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 276 | to extract, reuse, reproduce, and Share all or a substantial 277 | portion of the contents of the database; 278 | 279 | b. if You include all or a substantial portion of the database 280 | contents in a database in which You have Sui Generis Database 281 | Rights, then the database in which You have Sui Generis Database 282 | Rights (but not its individual contents) is Adapted Material; and 283 | 284 | c. You must comply with the conditions in Section 3(a) if You Share 285 | all or a substantial portion of the contents of the database. 286 | 287 | For the avoidance of doubt, this Section 4 supplements and does not 288 | replace Your obligations under this Public License where the Licensed 289 | Rights include other Copyright and Similar Rights. 290 | 291 | 292 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 293 | 294 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 295 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 296 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 297 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 298 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 299 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 300 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 301 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 302 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 303 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 304 | 305 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 306 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 307 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 308 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 309 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 310 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 311 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 312 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 313 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 314 | 315 | c. The disclaimer of warranties and limitation of liability provided 316 | above shall be interpreted in a manner that, to the extent 317 | possible, most closely approximates an absolute disclaimer and 318 | waiver of all liability. 319 | 320 | 321 | Section 6 -- Term and Termination. 322 | 323 | a. This Public License applies for the term of the Copyright and 324 | Similar Rights licensed here. However, if You fail to comply with 325 | this Public License, then Your rights under this Public License 326 | terminate automatically. 327 | 328 | b. Where Your right to use the Licensed Material has terminated under 329 | Section 6(a), it reinstates: 330 | 331 | 1. automatically as of the date the violation is cured, provided 332 | it is cured within 30 days of Your discovery of the 333 | violation; or 334 | 335 | 2. upon express reinstatement by the Licensor. 336 | 337 | For the avoidance of doubt, this Section 6(b) does not affect any 338 | right the Licensor may have to seek remedies for Your violations 339 | of this Public License. 340 | 341 | c. For the avoidance of doubt, the Licensor may also offer the 342 | Licensed Material under separate terms or conditions or stop 343 | distributing the Licensed Material at any time; however, doing so 344 | will not terminate this Public License. 345 | 346 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 347 | License. 348 | 349 | 350 | Section 7 -- Other Terms and Conditions. 351 | 352 | a. The Licensor shall not be bound by any additional or different 353 | terms or conditions communicated by You unless expressly agreed. 354 | 355 | b. Any arrangements, understandings, or agreements regarding the 356 | Licensed Material not stated herein are separate from and 357 | independent of the terms and conditions of this Public License. 358 | 359 | 360 | Section 8 -- Interpretation. 361 | 362 | a. For the avoidance of doubt, this Public License does not, and 363 | shall not be interpreted to, reduce, limit, restrict, or impose 364 | conditions on any use of the Licensed Material that could lawfully 365 | be made without permission under this Public License. 366 | 367 | b. To the extent possible, if any provision of this Public License is 368 | deemed unenforceable, it shall be automatically reformed to the 369 | minimum extent necessary to make it enforceable. If the provision 370 | cannot be reformed, it shall be severed from this Public License 371 | without affecting the enforceability of the remaining terms and 372 | conditions. 373 | 374 | c. No term or condition of this Public License will be waived and no 375 | failure to comply consented to unless expressly agreed to by the 376 | Licensor. 377 | 378 | d. Nothing in this Public License constitutes or may be interpreted 379 | as a limitation upon, or waiver of, any privileges and immunities 380 | that apply to the Licensor or You, including from the legal 381 | processes of any jurisdiction or authority. 382 | 383 | 384 | ======================================================================= 385 | 386 | Creative Commons is not a party to its public 387 | licenses. Notwithstanding, Creative Commons may elect to apply one of 388 | its public licenses to material it publishes and in those instances 389 | will be considered the “Licensor.” The text of the Creative Commons 390 | public licenses is dedicated to the public domain under the CC0 Public 391 | Domain Dedication. Except for the limited purpose of indicating that 392 | material is shared under a Creative Commons public license or as 393 | otherwise permitted by the Creative Commons policies published at 394 | creativecommons.org/policies, Creative Commons does not authorize the 395 | use of the trademark "Creative Commons" or any other trademark or logo 396 | of Creative Commons without its prior written consent including, 397 | without limitation, in connection with any unauthorized modifications 398 | to any of its public licenses or any other arrangements, 399 | understandings, or agreements concerning use of licensed material. For 400 | the avoidance of doubt, this paragraph does not form part of the 401 | public licenses. 402 | 403 | Creative Commons may be contacted at creativecommons.org. 404 | 405 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | drum-root 4 | 5 |

6 | 7 | [![Build Status](https://travis-ci.com/zero-to-mastery/drum-root.svg?branch=master)](https://travis-ci.com/zero-to-mastery/drum-root) 8 | ![GitHub](https://img.shields.io/github/license/joshtru/drum-root) 9 | ![GitHub top language](https://img.shields.io/github/languages/top/zero-to-mastery/drum-root?color=gree&style=flat-square) 10 | ![GitHub forks](https://img.shields.io/github/forks/zero-to-mastery/drum-root) 11 | ![GitHub contributors](https://img.shields.io/github/contributors/zero-to-mastery/drum-root?color=blue) 12 | ![GitHub last commit](https://img.shields.io/github/last-commit/zero-to-mastery/drum-root) 13 | 14 | Drum root is a React Web App for Creating and Sharing Drum Loops. See [Drum Root API](https://github.com/rgavinc/drum-root-api) for Back End Service. 15 | 16 | ## Features 17 | 18 | - Create Drum Loops 19 | - Record Custom Sounds 20 | - Save and Share Drum Loops With Others 21 | 22 | --- 23 | 24 | ## Table of content 25 | 26 | - [Installation](#Installation) 27 | - [Running](#Running) 28 | - [Locally in Development Mode](#Locally-in-Development-Mode) 29 | - [Storybook](#Storybook) 30 | - [Testing](#Testing) 31 | - [in Development Mode](#in-Development-Mode) 32 | - [Building and Deploying](#Building-and-Deploying) 33 | - [For Production](#For-Production) 34 | - [Contributing](#Contributing) 35 | - [What To Know Before Contributing](#What-To-Know-Before-Contributing) 36 | - [Adding Name To Contributors List](#Adding-Name-To-Contributors-List) 37 | - [Style Guide](#Style-Guide) 38 | - [Technologies](#Technologies) 39 | - [Front End](#Front-End) 40 | - [Back End](#Back-End) 41 | - [Team Leaders](#Team-Leaders) 42 | - [Current Team Lead Members](#Past-Team-Lead-Members) 43 | - [Past Team Lead Members](#Past-Team-Lead-Members) 44 | - [License](#License) 45 | 46 | --- 47 | 48 | ## Installation 49 | 50 | To get it working, you need to install all the dependencies. And the best way to do this is through the [Command Line Interface (CLI)](https://en.wikipedia.org/wiki/Command-line_interface). 51 | 52 | To get started, make sure you have either of the package manager, [NPM](https://docs.npmjs.com/about-npm/) or [Yarn](https://yarnpkg.com/getting-started) installed and working on your machine. 53 | 54 | > To install the packages through npm, run the command 55 | 56 | npm install 57 | 58 | > To install the packages through yarn, run the command 59 | 60 | yarn add 61 | 62 | **_NOTE_**: In the rest of the documentation, you will come across npm being used for running commands. To use **_yarn_** in place of **_npm_** for the commands, simply substitute npm for yarn. Example, `npm start` as `yarn start`. For more help, checkout [migrating from npm](https://classic.yarnpkg.com/en/docs/migrating-from-npm/) 63 | 64 | --- 65 | 66 | **[⬆ Back to Top](#Table-of-content)** 67 | 68 | ## Running 69 | 70 | ### Locally in Development Mode 71 | 72 | The backend code should be running in order for the front end to behave correctly. See [Drum Root API](https://github.com/rgavinc/drum-root-api). 73 | 74 | To get started with the front end, fork the repository and run the following command on your local machine: 75 | 76 | npm run dev 77 | 78 | ### Storybook 79 | 80 | Storybook is a way to view the components in isolation. To view Drum Root's storybook, run the following command: 81 | 82 | npm run storybook 83 | 84 | --- 85 | 86 | ## Testing 87 | 88 | ### in Development Mode 89 | 90 | If this is your first time running tests, begin by ensuring that the required packages are installed. [install packages](#Installation). 91 | 92 | To get started with Unit Test, run the following command: 93 | 94 | npm run test 95 | 96 | To get started with Integration/End to End Test, run the following command: 97 | 98 | npm run test:e2e 99 | 100 | --- 101 | 102 | **[⬆ Back to Top](#Table-of-content)** 103 | 104 | ## Building and Deploying 105 | 106 | ### For Production 107 | 108 | If you wanted to run this site in production, you should have installed packages. If not, [install packages](#Installation), then build the site with `npm run build` and run it with `npm start`: 109 | 110 | npm run build 111 | npm start 112 | 113 | You should run `npm run build` again any time you make changes to the site. 114 | 115 | --- 116 | 117 | **[⬆ Back to Top](#Table-of-content)** 118 | 119 | ## Contributing 120 | 121 | Drum Root happily accepts contributions. 122 | 123 | ## What To Know Before Contributing 124 | 125 | To begin contribution, there are some things you need to know, like what to do first, where to find tasks, any additional questions, and notes provided for contributors. You can begin at [**_Contributing to Drum Root_**](./CONTRIBUTING.md#Contributing-to-Drum-Root) 126 | 127 | ## Adding Name To Contributors List 128 | 129 | We recommend every contributor to add their name to the contributors list. A detailed intructions on how to get this done be found at [**_DRUM ROOT CONTRIBUTORS_**](./CONTRIBUTORS.md#Drum-Root-Contributors) 130 | 131 | --- 132 | 133 | **[⬆ Back to Top](#Table-of-content)** 134 | 135 | ## Style Guide 136 | 137 | The style guide is a set of standard outlined on how code should be written. We currently follow the [AirBnB style guide](https://github.com/airbnb/javascript), but you can checkout [Drum Root style guide](https://github.com/zero-to-mastery/drum-root/wiki/Drum-Root-Style-Guide) for any additional information. 138 | 139 | --- 140 | 141 | **[⬆ Back to Top](#Table-of-content)** 142 | 143 | ## Technologies 144 | 145 | ### Front End 146 | 147 | - [React](https://reactjs.org/) - JavaScript UI Library 148 | - [Next.js](https://nextjs.org/) - Server Side Rendering 149 | - [Styled Components](https://www.styled-components.com/) - Styling 150 | - [Jest](https://jestjs.io/) - JavaScript Testing Framework 151 | - [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) - A library to test React UI components 152 | - [Puppeteer](https://developers.google.com/web/tools/puppeteer) - A Node Library for Controlling Headless Chrome or Chromium. Used for end to end Testing 153 | - [Storybook](https://storybook.js.org/) - Tool for Developing UI Components in Isolation 154 | 155 | ### Back End 156 | 157 | - [Express](https://expressjs.com/) - Web Framework for Node.js 158 | - [PostgreSql](https://www.postgresql.org/) - Relational Database(Coming Soon) 159 | - [Redis](https://redis.io/) - In-Memory Data Structure Store used for Authorization(Coming Soon) 160 | 161 | --- 162 | 163 | **[⬆ Back to Top](#Table-of-content)** 164 | 165 | ## Team Leaders 166 | 167 | ### Current Team Lead Members 168 | 169 | - Project Lead - [joshtru](https://github.com/joshtru) 170 | - Front End Lead - needed 171 | - Back End Lead - [yashShelatkar](https://github.com/yashShelatkar) 172 | - QA Lead - [zbc](https://github.com/zbc) 173 | - Database Lead - [Aneesh](https://github.com/aneesh4995) 174 | - Designer/ Styling Lead - [LukasHirt](https://github.com/LukasHirt) 175 | 176 | ### Past Team Lead Members 177 | 178 | - [rgavinc](https://github.com/rgavinc) - Project Lead _Oct 2019 - Jan 2020_ 179 | - [Dhaval](https://github.com/Dhaval1403) - Front End Lead _Oct 2019 - Nov 2019_ 180 | - [rvvergara](https://github.com/rvvergara) - QA Lead _Oct 2019 - Dec 2019_ 181 | - [marcoseoane](https://github.com/marcoseoane) - Front End Lead _Nov 2019 - Dec 2019_ 182 | - [linconkusunoki](https://github.com/linconkusunoki) - Designer/ Styling Lead _Oct 2019 - Jan 2020_ 183 | 184 | --- 185 | 186 | **[⬆ Back to Top](#Table-of-content)** 187 | 188 | ## License 189 | 190 | This project is licensed under the MIT License - see the [License](./LICENSE) file for details 191 | 192 | **[⬆ Back to Top](#Table-of-content)** 193 | -------------------------------------------------------------------------------- /docs/images/drum-root.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /e2e/signin/signin.js: -------------------------------------------------------------------------------- 1 | describe('Go to sign in page', () => { 2 | beforeEach(async () => { 3 | await page.goto('http://localhost:3001'); 4 | }); 5 | it("should be titled 'Sign In'", async () => { 6 | await expect(page.title()).resolves.toMatch('Sign In'); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /jest-e2e.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'jest-puppeteer', 3 | testRegex: './e2e/.*.js$' 4 | }; 5 | -------------------------------------------------------------------------------- /jest-puppeteer.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | server: { 3 | command: 'npm run dev', 4 | port: 3001, 5 | launchTimeout: 10000, 6 | debug: true 7 | }, 8 | launch: { 9 | headless: false, 10 | slowMo: 500, 11 | devtools: false 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "Components/*": ["./src/Components/*"], 6 | "utils/*": ["./src/utils"] 7 | } 8 | }, 9 | "typeAcquisition": { "include": ["jest"] } 10 | } 11 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const { parsed: localEnv } = require('dotenv').config(); 2 | const webpack = require('webpack'); 3 | const withAssetsImport = require('next-assets-import'); 4 | 5 | module.exports = withAssetsImport({ 6 | webpack(config) { 7 | config.plugins.push(new webpack.EnvironmentPlugin(localEnv)); 8 | config.module.rules.push({ 9 | test: /\.svg$/, 10 | use: ['@svgr/webpack'] 11 | }); 12 | 13 | return config; 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "drum-root", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@storybook/addon-knobs": "^5.2.5", 7 | "@svgr/webpack": "^4.3.3", 8 | "@testing-library/jest-dom": "^4.2.4", 9 | "@testing-library/react": "^9.4.0", 10 | "bootstrap": "^4.3.1", 11 | "dotenv": "^8.1.0", 12 | "is-node": "^1.0.2", 13 | "isomorphic-unfetch": "^3.0.0", 14 | "js-cookie": "^2.2.1", 15 | "next": "^9.1.1", 16 | "next-assets-import": "0.0.2", 17 | "next-cookies": "^1.1.3", 18 | "prop-types": "^15.7.2", 19 | "react": "^16.10.2", 20 | "react-dom": "^16.10.2", 21 | "react-helmet": "^5.2.1", 22 | "react-input-slider": "^5.1.3", 23 | "react-scripts": "^3.4.0", 24 | "styled-components": "^4.4.0", 25 | "styled-icons": "^9.0.1", 26 | "tone": "^13.8.25" 27 | }, 28 | "scripts": { 29 | "dev": "next -- -p 3001", 30 | "build": "next build", 31 | "start": "next start", 32 | "test": "react-scripts test", 33 | "eject": "react-scripts eject", 34 | "test:e2e": "jest -c jest-e2e.config.js", 35 | "storybook": "start-storybook -p 6006", 36 | "build-storybook": "build-storybook", 37 | "lint": "eslint src", 38 | "lint:fix": "eslint --fix src", 39 | "test:staged": "cross-env CI=true react-scripts test --findRelatedTests", 40 | "ci": "npm run lint && cross-env CI=true npm run test && npm run test:e2e" 41 | }, 42 | "eslintConfig": { 43 | "extends": "react-app" 44 | }, 45 | "browserslist": { 46 | "production": [ 47 | ">0.2%", 48 | "not dead", 49 | "not op_mini all" 50 | ], 51 | "development": [ 52 | "last 1 chrome version", 53 | "last 1 firefox version", 54 | "last 1 safari version" 55 | ] 56 | }, 57 | "devDependencies": { 58 | "@babel/core": "^7.7.0", 59 | "@storybook/addon-actions": "^5.2.5", 60 | "@storybook/addon-links": "^5.2.5", 61 | "@storybook/addons": "^5.2.5", 62 | "@storybook/react": "^5.2.5", 63 | "babel-eslint": "^10.0.3", 64 | "babel-loader": "^8.0.6", 65 | "babel-plugin-styled-components": "^1.10.6", 66 | "cross-env": "^6.0.3", 67 | "eslint": "^6.8.0", 68 | "eslint-config-airbnb": "^18.0.1", 69 | "eslint-config-prettier": "^6.10.0", 70 | "eslint-plugin-import": "^2.20.1", 71 | "eslint-plugin-jsx-a11y": "^6.2.3", 72 | "eslint-plugin-prettier": "^3.1.2", 73 | "eslint-plugin-react": "^7.18.3", 74 | "eslint-plugin-react-hooks": "^1.7.0", 75 | "husky": "^3.0.9", 76 | "jest-puppeteer": "^4.3.0", 77 | "lint-staged": "^9.4.2", 78 | "nodemon": "^1.19.4", 79 | "prettier": "^1.19.1", 80 | "puppeteer": "^2.0.0" 81 | }, 82 | "lint-staged": { 83 | "./src/*.js": [ 84 | "eslint --fix src", 85 | "prettier --write", 86 | "npm run test:staged", 87 | "git add" 88 | ], 89 | "*.{json,md}": [ 90 | "prettier --write", 91 | "git add" 92 | ] 93 | }, 94 | "husky": { 95 | "hooks": { 96 | "pre-commit": "lint-staged" 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "repoName": "drum-root", 3 | "tagline": "A React Web App for Creating and Sharing Drum Loops.", 4 | "color": "#8244BC", 5 | "logo": "https://raw.githubusercontent.com/zero-to-mastery/drum-root/master/src/resources/logos/logo_image.jpg", 6 | "channelName": "drum-root", 7 | "desc": [ 8 | "A React Web App for Creating and Sharing Drum Loops.", 9 | "__**Features:**__ \n• Create Drum Loops \n• Record Custom Sounds \n• Save and Share Drum Loops With Others", 10 | "__**Front End Tech:**__ \n• [React](https://reactjs.org/) - JavaScript UI Library \n• [Next.js](https://nextjs.org/) - Server Side Rendering\n• [Styled Components](https://www.styled-components.com/) - Styling\n• [Jest](https://jestjs.io/) - JavaScript Testing Framework\n• [Puppeteer](https://developers.google.com/web/tools/puppeteer) - A Node Library for Controlling Headless Chrome or Chromium. Used for end to end Testing\n• [Storybook](https://storybook.js.org/) - Tool for Developing UI Components in Isolation", 11 | "__**Back End Tech:**__ \n• [Express](https://expressjs.com/) - Web Framework for Node.js\n• [PostgreSql](https://www.postgresql.org/) - Relational Database\n• [Redis](https://redis.io/) - In-Memory Data Structure Store used for Authorization" 12 | ], 13 | "team": [ 14 | ["Josh", "Project Lead"], 15 | ["needed", "Front End Lead"], 16 | ["yaashShelatkar", "Back End Lead"], 17 | ["Bo", "QA Lead"], 18 | ["Aneesh", "Database Lead"], 19 | ["needed", "Designer/ Styling Lead"] 20 | ], 21 | "links": [ 22 | [ 23 | "README.md", 24 | "https://github.com/zero-to-mastery/drum-root/blob/master/README.md" 25 | ], 26 | [ 27 | "CONTRIBUTING.md", 28 | "https://github.com/zero-to-mastery/drum-root/blob/master/CONTRIBUTING.md" 29 | ], 30 | ["Wiki", "https://github.com/zero-to-mastery/drum-root/wiki"] 31 | ], 32 | "poi": [ 33 | [ 34 | "README.md", 35 | "https://github.com/zero-to-mastery/drum-root/blob/master/README.md" 36 | ], 37 | [ 38 | "CONTRIBUTING.md", 39 | "https://github.com/zero-to-mastery/drum-root/blob/master/CONTRIBUTING.md" 40 | ], 41 | ["Wiki", "https://github.com/zero-to-mastery/drum-root/wiki"] 42 | ], 43 | "tasks": { 44 | "title": "Trello Tasks", 45 | "desc": "We use Trello to manage the tasks within this project. Further information on how to use Trello and claim a task can be found in the [CONTRIBUTING.md](https://github.com/zero-to-mastery/drum-root/blob/master/CONTRIBUTING.md) file on Github." 46 | }, 47 | "welcomeMsg":"Please take a moment to read through the pinned messages. Here you will find important notes and how to get stated with the project!" 48 | } 49 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zero-to-mastery/drum-root/49aad9d31e9be1d0335ef308a7143b79b4ac42aa/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/zero-to-mastery/drum-root/49aad9d31e9be1d0335ef308a7143b79b4ac42aa/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zero-to-mastery/drum-root/49aad9d31e9be1d0335ef308a7143b79b4ac42aa/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 | -------------------------------------------------------------------------------- /src/Components/Custom-Button/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const Button = styled.button` 6 | color: ${props => (props.color ? props.color : '#000')}; 7 | font-size: 1rem; 8 | margin: 0.5rem; 9 | padding: 0.25rem 1rem; 10 | border: 0.2rem solid ${props => (props.color ? props.color : '#000')}; 11 | border-radius: 0.2rem; 12 | background-color: ${props => (props.bgColor ? props.bgColor : '#000')}; 13 | `; 14 | 15 | const CustomButton = ({ title, className, color, bgColor }) => ( 16 | 19 | ); 20 | 21 | CustomButton.propTypes = { 22 | title: PropTypes.string.isRequired, 23 | className: PropTypes.string, 24 | color: PropTypes.string, 25 | bgColor: PropTypes.string 26 | }; 27 | 28 | export default CustomButton; 29 | -------------------------------------------------------------------------------- /src/Components/Custom-Button/story.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { storiesOf } from '@storybook/react'; 3 | import { withKnobs, color, text } from '@storybook/addon-knobs'; 4 | import CustomButton from './index'; 5 | 6 | const returnKnobs = () => ({ 7 | color: color('Color', '#BADA55'), 8 | className: text('Class', 'Assigned class'), 9 | title: text('Button text', 'Default button text'), 10 | bgColor: color('Fill Color', 'transparent') 11 | }); 12 | 13 | storiesOf('CustomButton', module) 14 | .addDecorator(withKnobs) 15 | .add('Default', () => { 16 | const knobs = returnKnobs(); 17 | return ; 18 | }); 19 | -------------------------------------------------------------------------------- /src/Components/DrumLoopTile/DrumLoopTile.story.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { storiesOf } from '@storybook/react'; 3 | import { withKnobs, text } from '@storybook/addon-knobs'; 4 | import LoopTile from './index'; 5 | 6 | const returnKnobs = () => ({ 7 | href: text('href', '#'), 8 | title: text('title', 'title') 9 | }); 10 | 11 | storiesOf('DrumLoopTile', module) 12 | .addDecorator(withKnobs) 13 | .add('with default', () => { 14 | return ; 15 | }) 16 | .add('with different props', () => { 17 | const knobs = returnKnobs(); 18 | return ; 19 | }); 20 | -------------------------------------------------------------------------------- /src/Components/DrumLoopTile/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const TitleContainer = styled.div` 6 | border: 0.063rem solid black; 7 | width: 12.5rem; 8 | text-align: center; 9 | height: 6.25rem; 10 | padding: 0.625rem; 11 | `; 12 | 13 | const TitleLink = styled.a` 14 | border: 0.063rem solid black; 15 | padding: 0.313rem; 16 | `; 17 | 18 | const LoopTile = ({ title, href }) => ( 19 | 20 | {title} 21 | 22 | ); 23 | 24 | LoopTile.propTypes = { 25 | title: PropTypes.string, 26 | href: PropTypes.string 27 | }; 28 | 29 | export default LoopTile; 30 | -------------------------------------------------------------------------------- /src/Components/DrumLoopTile/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import LoopTile from './index'; 4 | 5 | test('renders DrumLoopTile with title and link correctly', () => { 6 | const props = { title: 'Test Title', href: 'Test href' }; 7 | const { getByText } = render(); 8 | const title = getByText(/test title/i); 9 | expect(title).toHaveTextContent(props.title); 10 | expect(title).toHaveAttribute('href', props.href); 11 | }); 12 | -------------------------------------------------------------------------------- /src/Components/DrumPad/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const Table = styled.table` 6 | border-collapse: collapse; 7 | border-spacing: 0; 8 | &, 9 | th, 10 | git td { 11 | padding: 0.3125rem; 12 | border: 0.125rem solid black; 13 | } 14 | td { 15 | width: 2rem; 16 | height: 2rem; 17 | & span { 18 | display: flex; 19 | justify-content: center; 20 | align-items: center; 21 | } 22 | } 23 | td:nth-of-type(${({ count }) => count}) { 24 | background-color: yellow; 25 | } 26 | td:nth-of-type(${({ beatsMeasure }) => beatsMeasure}n) { 27 | border-right: 0.125rem solid black; 28 | } 29 | `; 30 | 31 | const DrumPad = ({ count, layout, swapBeat, beatsMeasure }) => { 32 | return ( 33 | 34 | 35 | {layout.map(({ name, icon, beats }, rowNum) => ( 36 | 37 | {beats.map((hasBeat, beatNum) => ( 38 | 50 | ))} 51 | 52 | ))} 53 | 54 |
{ 41 | swapBeat(rowNum, beatNum); 42 | }} 43 | > 44 | {hasBeat ? ( 45 | 46 | {icon} 47 | 48 | ) : null} 49 |
55 | ); 56 | }; 57 | 58 | DrumPad.propTypes = { 59 | count: PropTypes.number.isRequired, 60 | layout: PropTypes.arrayOf( 61 | PropTypes.shape({ 62 | name: PropTypes.string.isRequired, 63 | icon: PropTypes.string.isRequired, 64 | beats: PropTypes.arrayOf(PropTypes.bool) 65 | }) 66 | ), 67 | swapBeat: PropTypes.func, 68 | beatsMeasure: PropTypes.number 69 | }; 70 | 71 | export default DrumPad; 72 | -------------------------------------------------------------------------------- /src/Components/DrumPad/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import Drumpad from './index'; 4 | import mockLayout1 from '../../mockData/mockLayout'; 5 | 6 | describe('Drumpad component', () => { 7 | describe('component rendering', () => { 8 | test('renders properly with required props', () => { 9 | const { getAllByLabelText } = render( 10 | 11 | ); 12 | for (let i = 0; i < mockLayout1.length; i++) { 13 | expect(getAllByLabelText(mockLayout1[i].name).length).toBe( 14 | mockLayout1[i].beats.filter(b => b === true).length 15 | ); 16 | } 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /src/Components/DrumPad/story.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { storiesOf } from '@storybook/react'; 3 | import { withKnobs, object, select } from '@storybook/addon-knobs'; 4 | import { action } from '@storybook/addon-actions'; 5 | import DrumPad from './index'; 6 | 7 | const returnKnobs = () => ({ 8 | count: select('Count', [1, 2, 3, 4], 1), 9 | layout: object('Layout', [ 10 | { 11 | name: 'hiHat', 12 | icon: '🇹🇼', 13 | beats: [true, true, true, true] 14 | }, 15 | { 16 | name: 'bass', 17 | icon: '🛢️', 18 | beats: [true, false, false, false] 19 | }, 20 | { 21 | name: 'snare', 22 | icon: '🥁', 23 | beats: [false, false, true, false] 24 | } 25 | ]) 26 | }); 27 | 28 | storiesOf('Form/Button', module) 29 | .addDecorator(withKnobs) 30 | .add('Drum pad style', () => { 31 | const knobs = returnKnobs(); 32 | return ; 33 | }); 34 | -------------------------------------------------------------------------------- /src/Components/Error/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Helmet } from 'react-helmet'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const Error = ({ error: { statusCode } }) => { 6 | const errStrings = { 7 | default: { 8 | title: 'An error occured.', 9 | content: 'Try refreshing the page.' 10 | }, 11 | 101: { title: 'Switching Protocols' }, 12 | 100: { title: 'Continue' }, 13 | 200: { title: 'OK', content: 'Action completed successfully' }, 14 | 201: { 15 | title: 'Created', 16 | content: 17 | 'Success following a POST command Request has been accepted for processing,but processing has not completed' 18 | }, 19 | 202: { 20 | title: 'Accepted', 21 | content: 22 | 'Response to a GET command; indicates that the returned meta information is from a private overlaid web' 23 | }, 24 | 203: { 25 | title: 'Partial Information', 26 | content: 27 | 'Server received the request, but there is no information to send back' 28 | }, 29 | 204: { title: 'No Content' }, 30 | 206: { title: 'Partial Content' }, 31 | 205: { 32 | title: 'Reset Content', 33 | content: 34 | 'Requested file was partially sent; usually caused by stopping or refreshing a web page' 35 | }, 36 | 301: { title: 'Moved Permanently' }, 37 | 300: { 38 | title: 'Multiple Choices', 39 | content: 40 | 'Requested a directory instead of a specific file; the web server added the file name index.html, index.htm, home.html, or home.htm to the URL' 41 | }, 42 | 303: { title: 'See Other' }, 43 | 302: { title: 'Moved Temporarily' }, 44 | 304: { 45 | title: 'Not Modified', 46 | content: 47 | 'Cached version of the requested file is the same as the file to be sent' 48 | }, 49 | 400: { title: 'Bad Request' }, 50 | 305: { 51 | title: 'Use Proxy', 52 | content: 53 | 'Request had bad syntax or was impossible to fulfill User failed to provide a valid user name/password required for access to a file/directory' 54 | }, 55 | 401: { title: 'Unauthorized' }, 56 | 403: { title: 'Forbidden' }, 57 | 402: { 58 | title: 'Payment Required', 59 | content: 60 | 'Request does not specify the file name, or the directory or the file does not have the permission that allows the pages to be viewed from the web' 61 | }, 62 | 405: { title: 'Method Not Allowed' }, 63 | 404: { title: 'Not Found', content: 'Requested file was not found' }, 64 | 406: { title: 'Not Acceptable' }, 65 | 407: { title: 'Proxy Authentication Required' }, 66 | 408: { title: 'Request Time-Out' }, 67 | 409: { title: 'Conflict' }, 68 | 410: { title: 'Gone' }, 69 | 411: { title: 'Length Required' }, 70 | 412: { title: 'Precondition Failed' }, 71 | 413: { title: 'Request Entity Too Large' }, 72 | 414: { title: 'Request-URL Too Large' }, 73 | 415: { title: 'Unsupported Media Type' }, 74 | 500: { 75 | title: 'Server Error', 76 | content: 77 | 'In most cases, this error results from a problem with the code or program you are calling rather than with the web server itself.' 78 | }, 79 | 501: { 80 | title: 'Not Implemented', 81 | content: 'Server does not support the facility required' 82 | }, 83 | 502: { title: 'Bad Gateway' }, 84 | 503: { 85 | title: 'Out of Resources', 86 | content: 87 | 'Server cannot process the request due to a system overload; should be a temporary condition' 88 | }, 89 | 504: { 90 | title: 'Gateway Time-Out', 91 | content: 92 | 'Service did not respond within the time frame that the gateway was willing to wait' 93 | }, 94 | 505: { title: 'HTTP Version Not Supported' } 95 | }; 96 | 97 | return ( 98 | <> 99 | 100 | 101 | {errStrings[statusCode] 102 | ? errStrings[statusCode].title 103 | : errStrings.default.title} 104 | 105 | 106 |

107 | {errStrings[statusCode] 108 | ? errStrings[statusCode].title 109 | : errStrings.default.title} 110 |

111 |

112 | {errStrings[statusCode] 113 | ? errStrings[statusCode].content 114 | : errStrings.default.content} 115 |

116 | 117 | ); 118 | }; 119 | 120 | Error.propTypes = { 121 | error: PropTypes.shape({ 122 | statusCode: PropTypes.number.isRequired 123 | }) 124 | }; 125 | 126 | export default Error; 127 | -------------------------------------------------------------------------------- /src/Components/Error/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import Error from './index'; 4 | 5 | beforeAll(() => { 6 | jest.spyOn(console, 'warn').mockImplementation(() => {}); 7 | }); 8 | 9 | afterAll(() => { 10 | console.warn.mockRestore(); 11 | }); 12 | 13 | describe('Error component', () => { 14 | test('should render properly with specific props', () => { 15 | const { getByText } = render(); 16 | expect(getByText(/not found/i, { selector: 'h2' })).toBeInTheDocument(); 17 | expect( 18 | getByText(/requested file was not found/i, { selector: 'h3' }) 19 | ).toBeInTheDocument(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/Components/ErrorBoundary/index.js: -------------------------------------------------------------------------------- 1 | // See https://reactjs.org/docs/error-boundaries.html 2 | import React, { Component } from 'react'; 3 | import PropTypes from 'prop-types'; 4 | import { logError } from '../../utils/common-functions'; 5 | import Error from '../Error'; 6 | 7 | class ErrorBoundary extends Component { 8 | constructor(props) { 9 | super(props); 10 | this.state = { error: null }; 11 | } 12 | 13 | static getDerivedStateFromError(error) { 14 | return { error }; 15 | } 16 | 17 | componentDidCatch(error, errorInfo) { 18 | logError(error, errorInfo); 19 | } 20 | 21 | render() { 22 | const { error } = this.state; 23 | const { children } = this.props; 24 | 25 | return error ? : children; 26 | } 27 | } 28 | 29 | ErrorBoundary.propTypes = { 30 | children: PropTypes.oneOfType([ 31 | PropTypes.arrayOf(PropTypes.node), 32 | PropTypes.node 33 | ]).isRequired 34 | }; 35 | 36 | export default ErrorBoundary; 37 | -------------------------------------------------------------------------------- /src/Components/ErrorBoundary/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from '@testing-library/react'; 3 | import ErrorBoundary from './index'; 4 | import { logError as mockLogError } from '../../utils/common-functions'; 5 | 6 | jest.mock('../../utils/common-functions'); 7 | 8 | beforeAll(() => { 9 | jest.spyOn(console, 'error').mockImplementation(() => {}); 10 | jest.spyOn(console, 'warn').mockImplementation(() => {}); 11 | }); 12 | 13 | afterAll(() => { 14 | console.error.mockRestore(); 15 | console.warn.mockRestore(); 16 | }); 17 | 18 | afterEach(() => { 19 | jest.clearAllMocks(); 20 | }); 21 | 22 | const Bomb = ({ shouldThrow }) => { 23 | if (shouldThrow) { 24 | // eslint-disable-next-line no-throw-literal 25 | throw { statusCode: 404 }; 26 | } else { 27 | return null; 28 | } 29 | }; 30 | 31 | describe('ErrorBoundary component', () => { 32 | test('should render correctly when there is an error', () => { 33 | mockLogError.mockResolvedValueOnce(); 34 | const { rerender, getByText, queryByText } = render( 35 | 36 | 37 | 38 | ); 39 | 40 | expect(mockLogError).not.toHaveBeenCalled(); 41 | expect(console.error).not.toHaveBeenCalled(); 42 | expect( 43 | queryByText(/not found/i, { selector: 'h2' }) 44 | ).not.toBeInTheDocument(); 45 | expect( 46 | queryByText(/Requested file was not found/i, { selector: 'h3' }) 47 | ).not.toBeInTheDocument(); 48 | 49 | rerender( 50 | 51 | 52 | 53 | ); 54 | const error = { statusCode: expect.any(Number) }; 55 | const info = { componentStack: expect.stringContaining('Bomb') }; 56 | expect(mockLogError).toHaveBeenCalledWith(error, info); 57 | expect(mockLogError).toHaveBeenCalledTimes(1); 58 | expect(console.error).toHaveBeenCalledTimes(2); 59 | 60 | expect(getByText(/not found/i, { selector: 'h2' })).toBeInTheDocument(); 61 | expect( 62 | getByText(/Requested file was not found/i, { selector: 'h3' }) 63 | ).toBeInTheDocument(); 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /src/Components/FormWrapper/index.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | const FormWrapper = ({ children, onSubmit }) => { 5 | const [error, setError] = useState(false); 6 | const [success, setSuccess] = useState(false); 7 | const handleSubmit = async e => { 8 | try { 9 | e.preventDefault(); 10 | await onSubmit(); 11 | setSuccess(true); 12 | } catch (err) { 13 | setError(err && err.message); 14 | } 15 | }; 16 | 17 | return ( 18 |
19 | {error &&

{error}

} 20 | {success &&

Success!

} 21 | {children} 22 |
23 | ); 24 | }; 25 | 26 | FormWrapper.propTypes = { 27 | children: PropTypes.oneOfType([ 28 | PropTypes.arrayOf(PropTypes.node), 29 | PropTypes.node 30 | ]), 31 | onSubmit: PropTypes.func 32 | }; 33 | 34 | export default FormWrapper; 35 | -------------------------------------------------------------------------------- /src/Components/FormWrapper/index.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, fireEvent, wait } from '@testing-library/react'; 3 | import FormWrapper from './index'; 4 | 5 | const mockSubmitFn = jest.fn(); 6 | 7 | const Button = () => ; 8 | 9 | describe('FormWrapper component', () => { 10 | test('should render properly', async () => { 11 | const errorMessage = 'Submit Error'; 12 | const { getByText, rerender } = render( 13 | 14 | 20 | ); 21 | }; 22 | 23 | PlayPauseButton.propTypes = { 24 | isPlay: PropTypes.bool, 25 | color: PropTypes.string, 26 | size: PropTypes.number 27 | }; 28 | 29 | export default PlayPauseButton; 30 | -------------------------------------------------------------------------------- /src/Components/SoundUploader/index.js: -------------------------------------------------------------------------------- 1 | import React, { useRef, useState } from 'react'; 2 | import styled from 'styled-components'; 3 | 4 | const FileInput = styled.input``; 5 | const FileErrorSpan = styled.span` 6 | color: red; 7 | `; 8 | 9 | const SoundUploader = () => { 10 | const inputEl = useRef(null); 11 | const [fileError, setFileError] = useState(false); 12 | const errorDuration = 2000; 13 | const errorTimeout = () => 14 | setTimeout(() => setFileError(false), errorDuration); 15 | 16 | const uploadSound = event => { 17 | try { 18 | const file = event.target.files[0]; 19 | if (file.size > 1000000) { 20 | setFileError('File size must not exceed 1MB'); 21 | errorTimeout(); 22 | inputEl.current.value = ''; 23 | } else { 24 | // TODO: What should we do here, add sound to a container component that stores users custom sounds? 25 | } 26 | } catch (err) { 27 | setFileError('Something went wrong with file upload'); 28 | errorTimeout(); 29 | } 30 | }; 31 | 32 | return ( 33 |
34 | Upload Sound 35 | 41 | {fileError && {fileError}} 42 |
43 | ); 44 | }; 45 | 46 | export default SoundUploader; 47 | -------------------------------------------------------------------------------- /src/Components/SoundUploader/story.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { storiesOf } from '@storybook/react'; 3 | import SoundUploader from './index'; 4 | 5 | storiesOf('SoundUploader', module).add('Default', () => { 6 | return ; 7 | }); 8 | -------------------------------------------------------------------------------- /src/Components/SoundWave/SoundWave.story.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { storiesOf } from '@storybook/react'; 3 | import { withKnobs, color, files } from '@storybook/addon-knobs'; 4 | import SoundWave from './index'; 5 | import soundFile from '../../resources/audio/testSound.mp3'; 6 | 7 | const returnKnobs = () => ({ 8 | waveColor: color('Wave Color', '#333333'), 9 | progressColor: color('Progress Color', '#DE6A08'), 10 | audioFile: files('Audio File', '.mp3', soundFile) 11 | }); 12 | 13 | storiesOf('SoundWave', module) 14 | .addDecorator(withKnobs) 15 | .add('with default', () => { 16 | return ; 17 | }) 18 | .add('with different props', () => { 19 | const knobs = returnKnobs(); 20 | return ; 21 | }); 22 | -------------------------------------------------------------------------------- /src/Components/SoundWave/index.js: -------------------------------------------------------------------------------- 1 | import React, { useRef, useEffect, useState } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | const SoundWave = ({ 5 | audioFile, 6 | waveColor = '#333333', 7 | progressColor = '#DE6A08' 8 | }) => { 9 | const waveFormRef = useRef(null); 10 | const waveSurferRef = useRef(null); 11 | const [isPlay, setIsPlay] = useState(false); 12 | 13 | useEffect(() => { 14 | setIsPlay(false); 15 | waveSurferRef.current = window.WaveSurfer.create({ 16 | container: waveFormRef.current, 17 | waveColor, 18 | progressColor 19 | }); 20 | waveSurferRef.current.load(audioFile); 21 | return () => waveSurferRef.current.destroy(); 22 | }, [audioFile, waveColor, progressColor]); 23 | 24 | const handlePlayAndPause = () => { 25 | waveSurferRef.current.playPause(); 26 | setIsPlay(!isPlay); 27 | }; 28 | 29 | return ( 30 | <> 31 | 32 |
33 | 34 | ); 35 | }; 36 | 37 | SoundWave.propTypes = { 38 | audioFile: PropTypes.string.isRequired, 39 | waveColor: PropTypes.string, 40 | progressColor: PropTypes.string 41 | }; 42 | 43 | export default SoundWave; 44 | -------------------------------------------------------------------------------- /src/Components/SplashScreen/SplashScreen.styles.js: -------------------------------------------------------------------------------- 1 | import styled, { keyframes } from 'styled-components'; 2 | 3 | const infiniteBeat = keyframes` 4 | 0% { 5 | transform: scale(1); 6 | } 7 | 100% { 8 | transform: scale(1.05); 9 | } 10 | `; 11 | 12 | export const Overlay = styled.div` 13 | position: absolute; 14 | top: 0; 15 | left: 0; 16 | width: 100vw; 17 | height: 100vh; 18 | background-color: #fff; 19 | display: flex; 20 | justify-content: center; 21 | align-items: center; 22 | `; 23 | 24 | export const LogoContainer = styled.div` 25 | width: 20vw; 26 | height: 40vh; 27 | animation: ${infiniteBeat} 0.5s ease-in infinite; 28 | `; 29 | 30 | export const LogoImage = styled.img` 31 | width: 100%; 32 | max-height: 100%; 33 | `; 34 | -------------------------------------------------------------------------------- /src/Components/SplashScreen/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import logo from '../../resources/logos/logo_image.jpg'; 3 | import { Overlay, LogoContainer, LogoImage } from './SplashScreen.styles'; 4 | 5 | const SplashScreen = () => ( 6 | 7 | 8 | 9 | 10 | 11 | ); 12 | 13 | export default SplashScreen; 14 | -------------------------------------------------------------------------------- /src/Components/TimeSignature/timeSignature.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const TimeSigStyle = styled.div` 6 | display: flex; 7 | flex-direction: row; 8 | input { 9 | width: 3.375rem; 10 | height: 1.875rem; 11 | margin: 1rem; 12 | 13 | background: rgba(0, 0, 0, 0.05); 14 | border-radius: 2.4375rem; 15 | } 16 | `; 17 | 18 | const TimeSignature = ({ setBeatDivision, setBeatsMeasure }) => { 19 | return ( 20 | <> 21 | 22 |

Time Signature:

23 | { 27 | setBeatsMeasure(2); 28 | setBeatDivision(4); 29 | }} 30 | /> 31 | { 35 | setBeatsMeasure(3); 36 | setBeatDivision(4); 37 | }} 38 | /> 39 | { 43 | setBeatsMeasure(4); 44 | setBeatDivision(4); 45 | }} 46 | /> 47 | { 51 | setBeatsMeasure(6); 52 | setBeatDivision(8); 53 | }} 54 | /> 55 |
56 | 57 | ); 58 | }; 59 | 60 | TimeSignature.propTypes = { 61 | setBeatDivision: PropTypes.func, 62 | setBeatsMeasure: PropTypes.func 63 | }; 64 | 65 | export default TimeSignature; 66 | -------------------------------------------------------------------------------- /src/constants/constants.js: -------------------------------------------------------------------------------- 1 | /** *********************************** COLORS ********************************************** */ 2 | export const black = '#333333'; 3 | export const white = '#FFFFFF'; 4 | 5 | export const primary900 = '#190C01'; 6 | export const primary800 = '#7B3B04'; 7 | export const primary700 = '#AD5206'; 8 | export const primary600 = '#DE6A08'; 9 | export const primary500 = '#F78321'; 10 | export const primary400 = '#F99F52'; 11 | export const primary300 = '#FBBA84'; 12 | export const primary200 = '#FCD6B5'; 13 | export const primary100 = '#FEF1E6'; 14 | 15 | export const blue900 = '#102D53'; 16 | export const blue800 = '#18427A'; 17 | export const blue700 = '#2056A0'; 18 | export const blue600 = '#276BC7'; 19 | export const blue500 = '#2F80ED'; 20 | export const blue400 = '#609EF1'; 21 | export const blue300 = '#92BCF6'; 22 | export const blue200 = '#C3DBFA'; 23 | export const blue100 = '#F5F9FE'; 24 | 25 | export const gray900 = '#383D43'; 26 | export const gray800 = '#525962'; 27 | export const gray700 = '#6C7682'; 28 | export const gray600 = '#8692A1'; 29 | export const gray500 = '#A0AEC0'; 30 | export const gray400 = '#B7C1CF'; 31 | export const gray300 = '#CDD5DE'; 32 | export const gray200 = '#E4E8ED'; 33 | export const gray100 = '#FAFBFC'; 34 | 35 | export const red900 = '#562323'; 36 | export const red800 = '#18427A'; 37 | export const red700 = '#A54444'; 38 | export const red600 = '#CD5555'; 39 | export const red500 = '#F56565'; 40 | export const red400 = '#F78A8A'; 41 | export const red300 = '#FAAEAE'; 42 | export const red200 = '#FCD3D3'; 43 | export const red100 = '#FFF7F7'; 44 | 45 | export const yellow900 = '#53461A'; 46 | export const yellow800 = '#796726'; 47 | export const yellow700 = '#9F8833'; 48 | export const yellow600 = '#C6A83F'; 49 | export const yellow500 = '#ECC94B'; 50 | export const yellow400 = '#F1D676'; 51 | export const yellow300 = '#F5E3A1'; 52 | export const yellow200 = '#FAF0CB'; 53 | export const yellow100 = '#FEFCF6'; 54 | 55 | export const green900 = '#00422B'; 56 | export const green800 = '#006040'; 57 | export const green700 = '#007E54'; 58 | export const green600 = '#009D68'; 59 | export const green500 = '#00BB7C'; 60 | export const green400 = '#3DCB9B'; 61 | export const green300 = '#79DBBA'; 62 | export const green200 = '#B6EBD9'; 63 | export const green100 = '#F2FCF8'; 64 | -------------------------------------------------------------------------------- /src/mockData/mockLayout.js: -------------------------------------------------------------------------------- 1 | const mockLayout1 = [ 2 | { 3 | name: 'hiHat', 4 | icon: '🇹🇼', 5 | beats: [true, true, true, true] 6 | }, 7 | { 8 | name: 'bass', 9 | icon: '🛢️', 10 | beats: [true, false, false, false] 11 | }, 12 | { name: 'snare', icon: '🥁', beats: [false, false, true, false] } 13 | ]; 14 | 15 | export default mockLayout1; 16 | -------------------------------------------------------------------------------- /src/pages/_app.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import App from 'next/app'; 3 | import styled, { createGlobalStyle } from 'styled-components'; 4 | import Link from 'next/link'; 5 | import { signout } from '../utils/common-functions'; 6 | import ErrorBoundary from '../Components/ErrorBoundary'; 7 | import Logo from '../Components/Logo/Logo'; 8 | 9 | const BodyStyling = createGlobalStyle` 10 | body { 11 | a{ 12 | text-decoration: none; 13 | color: black 14 | } 15 | } 16 | `; 17 | 18 | const PageWrapper = styled.div` 19 | padding: 0 2rem; 20 | margin: 0 auto; 21 | max-width: 80rem; 22 | `; 23 | 24 | const HeaderStyling = styled.div` 25 | display: flex; 26 | justify-content: space-between; 27 | space-between; 28 | margin-bottom: 3rem; 29 | `; 30 | 31 | const Button = styled.button` 32 | max-height: 2rem; 33 | margin: auto 0; 34 | `; 35 | 36 | class MyApp extends App { 37 | render() { 38 | const { Component, pageProps } = this.props; 39 | return ( 40 | 41 | 42 | 43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | 54 |
55 |
56 | ); 57 | } 58 | } 59 | 60 | export default MyApp; 61 | -------------------------------------------------------------------------------- /src/pages/_document.js: -------------------------------------------------------------------------------- 1 | // See https://dev.to/aprietof/nextjs--styled-components-the-really-simple-guide----101c 2 | import Document, { Head, Main, NextScript } from 'next/document'; 3 | import React from 'react'; 4 | import { ServerStyleSheet } from 'styled-components'; 5 | 6 | export default class MyDocument extends Document { 7 | static getInitialProps({ renderPage }) { 8 | const sheet = new ServerStyleSheet(); 9 | 10 | const page = renderPage(App => props => 11 | sheet.collectStyles() 12 | ); 13 | 14 | const styleTags = sheet.getStyleElement(); 15 | 16 | return { ...page, styleTags }; 17 | } 18 | 19 | render() { 20 | return ( 21 | 22 | {this.props.styleTags} 23 | 24 |
25 | 26 | 27 |