This repository contains the frontend for the DevHeaven platform.
Conventions for naming files.
- Never use
index.jsas a file name only if you need to export a lot of different files from one directory. - Keep filenames simple use
Home.jsfor aPageHomecomponent. - Always prefix file names with a capital letter.
Conventions for naming and creating components.
- Prefix the component names with folder or their type i.e.
PageHomeandBoardColumninstead ofHomeandColumn. - Use a captial letter for functions that call the backend in pages (neglect this in components).
- Use a lower case letter for functions that don't call the backend.
Conventions for naming and creating types.
- Try to keep types simple use
LOADinstead ofLOAD_PROJECT. - Use the
LOADtype to fetch data incomponentDidMount(). - Create types of
_SUCCESSand_ERRORif you're using a form.
Conventions for naming and creating actions
- Try to keep action names simple like
loadinstead ofloadBoard. - Always use
payloadas parameter name if you need to pass values to an action.
Conventions for naming and creating reducers.
- Tryu to keep reducers names as a single word.
- Try to split reducers if they are becoming to large.
Conventions for naming and creating sagas.
- Try to keep names generic use
loadinstead ofgetProjectsorloadProjects. - When you need a value from state use selectors.
- Use the
APP_ERRORtype to display errors for load, archive and delete actions. - Use the
errorSelectoras a type to display errors for create and update actions. - Use the
__Stub__.jsfile to mock the API if needed.
General conventions.
- When you need to display a list of items use the
Tablecomponent. - When you need to create or update a item use the
ModalFormcomponent. - Use the color
redas background for archive and delete buttons. - Use the
PageLoadingcomponent when you need to fetch data from the API to display a loading page. - Try to keep pages under 200 lines.
- Try to keep components under 100 lines.
- Put all the data logic in the pages.
- Use components to visualize items.
- Try to make components generic so they can be reused.
There are probably some points of improvement in the application design, structure or code.
If you believe there is a best practice I have not followed, please let me know by opening an issue on the issue tracker. Pull requests are welcome!
DevHeaven is released under the MIT license:
The MIT License (MIT)
Copyright (c) 2019 DevHeaven
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.