Skip to content

Commit 56581fc

Browse files
committed
Setup rematch
Setup demo routes Docs update Init store Init sample data Init axios mocks
1 parent 9d754fe commit 56581fc

37 files changed

+431
-93
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module.exports = {
3030
'@typescript-eslint/no-empty-interface': [0],
3131
'@typescript-eslint/explicit-member-accessibility': [0],
3232
'@typescript-eslint/no-explicit-any': [0],
33+
'react/prop-types': [0],
3334
'react/display-name': [0],
3435
'no-console': [0],
3536
},

README.md

-25
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,3 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
4949
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
5050

5151
To learn React, check out the [React documentation](https://reactjs.org/).
52-
53-
54-
## Useful links
55-
56-
#### Icons
57-
https://material.io/resources/icons/
58-
59-
60-
#### Adding polls
61-
https://github.com/isaacs/github/issues/1533
62-
63-
64-
#### React
65-
https://www.robinwieruch.de/react-state-usereducer-usestate-usecontext/
66-
67-
#### TypeScript
68-
69-
Infering React properties TypeScript definition from React runtime PropTypes
70-
https://dev.to/busypeoples/notes-on-typescript-inferring-react-proptypes-1g88
71-
72-
https://dev.to/ferdaber/typescript-and-jsx-part-iii---typing-the-props-for-a-component-1pg2
73-
https://dev.to/benweiser/how-to-set-up-eslint-typescript-prettier-with-create-react-app-3675
74-
https://medium.com/@dors718/linting-your-react-typescript-project-with-eslint-and-prettier-2423170c3d42
75-
https://medium.com/quick-code/how-to-integrate-eslint-prettier-in-react-6efbd206d5c4
76-
https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb

docs/drafts.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
## This is just a draft document with a thoughts :)
2+
3+
The points below are still in progress
4+
5+
6+
### Features
7+
8+
- Static typecheckign with TypeScript for large scale projects
9+
- Modular and scalable architecture
10+
- Built in JWT authentication
11+
- Built in interchangable REST and GraphQL API interaction services, pick the prefered option
12+
- Typed data entities
13+
- Not just a dummy template
14+
- Uses react hooks
15+
- State management with Redux + Rematch for reducing Redux code boilerplate
16+
- Material UI kit
17+
- Smart basic applications with real-world usage
18+
- Users/Organizations roles with many-to-many relations
19+
- Designed in SAAS setup in mind, with subscription planes and global system roles
20+
- and more...
21+
22+
23+
## FAQ
24+
25+
#### Who is Modular Material Admin for?
26+
27+
Modular Material Admin is a good fit for the more-advanced developers who want to build a large-scale dashboard application with a good coding practicies.
28+
29+
#### How Modular Material Admin is different from hundreds of other admin templates out there?
30+
31+
The most of the dashboard themes and templates are more focused on the UI components. This brings to the situation, that for the
32+
33+
34+
#### Why do you call it modular?
35+
36+
I've been working on different large scale apps for years already, and have developed my own way of structuring and naming the application parts. This turned out a really successfull approach, which helped me to ofocus on a single functionality module. The modules are like lego building blocks and mostly represent the application logical structure. If you think about our app in a small pieces, it's all about a tree! There are also directories starting with underscore, e.g. `_services`, which combine files or modules of the same type or purpose.
37+
38+
39+
#### Why do use TypeScript?
40+
41+
I beleive that the fucture of the JavaScript in large scale applications is TypeScript.
42+
It improves the code quality, helps to avoid of lot's of runtime errors, during refactoring and maintenance. In addition it provides a great intelisense, which boosts the productivity. TypeScript comes with it's overhead cost though, so if you want to build something small, it might be a bit of complicated to use.
43+
44+
#### Why do you use MaterialUI?
45+
46+
Although I'm not a big fan of material design, but the MaterialUI gives a huge solid fundation for building user interfaces. I never enjoyed using any UI framework that much as I did with MaterialUI. Big appreciation and my credits to the MaterialUI team.
47+
48+
49+
#### So REST or GraphQL?
50+
51+
I'm trying to build the Modular Material Admin in a way that you would be able to use your desired approach. Each component that needs an ASYNC data, has it's own {ComponentName}Service.tsx file, in which the ASYNC data can be obtained both from REST or GraphQL and resolved to the component. So it should be easy to pick the solution which fits better.
52+
53+
54+
#### Why Redux + Rematch for the state management?
55+
56+
Redux has became de-facto standart solution for the React state management. Unfortunately you need to write lot's of boilerplate code by default. Rematch solves that issue

docs/references.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Useful links
2+
3+
#### Icons
4+
https://material.io/resources/icons/
5+
6+
7+
#### Adding polls
8+
https://github.com/isaacs/github/issues/1533
9+
10+
11+
#### React
12+
https://www.robinwieruch.de/react-state-usereducer-usestate-usecontext/
13+
14+
React with Redux and hooks
15+
https://medium.com/@koss_lebedev/rematch-with-hooks-50a8380c46e4
16+
17+
#### TypeScript
18+
19+
Typescript Book:
20+
https://basarat.gitbooks.io/typescript/docs/promise.html
21+
22+
Infering React properties TypeScript definition from React runtime PropTypes
23+
https://dev.to/busypeoples/notes-on-typescript-inferring-react-proptypes-1g88
24+
25+
https://dev.to/ferdaber/typescript-and-jsx-part-iii---typing-the-props-for-a-component-1pg2
26+
https://dev.to/benweiser/how-to-set-up-eslint-typescript-prettier-with-create-react-app-3675
27+
https://medium.com/@dors718/linting-your-react-typescript-project-with-eslint-and-prettier-2423170c3d42
28+
https://medium.com/quick-code/how-to-integrate-eslint-prettier-in-react-6efbd206d5c4
29+
https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb

package-lock.json

+113
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@
1717
"@material-ui/icons": "^4.2.1",
1818
"@nivo/core": "^0.59.1",
1919
"@nivo/line": "^0.59.3",
20+
"@rematch/core": "^1.1.0",
21+
"@types/axios": "^0.14.0",
2022
"@types/chart.js": "^2.7.56",
2123
"@types/jest": "24.0.15",
2224
"@types/lodash": "^4.14.136",
2325
"@types/moment": "^2.13.0",
2426
"@types/node": "12.0.10",
2527
"@types/react": "16.8.22",
2628
"@types/react-dom": "16.8.4",
29+
"@types/react-redux": "^7.1.1",
2730
"@types/react-router-dom": "^4.3.4",
2831
"@types/recharts": "^1.1.17",
2932
"@types/store": "^2.0.2",
33+
"axios": "^0.19.0",
34+
"axios-mock-adapter": "^1.17.0",
3035
"chart.js": "^2.8.0",
3136
"cross-env": "^5.2.0",
3237
"disqus-react": "^1.0.6",
@@ -39,10 +44,13 @@
3944
"react": "^16.8.6",
4045
"react-chartist": "^0.13.3",
4146
"react-dom": "^16.8.6",
47+
"react-redux": "^7.1.0",
4248
"react-router-dom": "^5.0.1",
4349
"react-scripts": "3.0.1",
4450
"recharts": "^1.6.2",
51+
"redux": "^4.0.4",
4552
"rematch": "^0.1.3",
53+
"reselect": "^4.0.0",
4654
"store": "^2.0.12",
4755
"typeface-roboto": "0.0.75",
4856
"typescript": "3.5.2"

src/App.tsx

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
11
import React from 'react'
2+
import { Provider, connect } from 'react-redux'
23
import { ThemeProvider } from '@material-ui/styles'
34
import { HashRouter, BrowserRouter, Route, RouteProps, Redirect } from 'react-router-dom' //
45
import CssBaseline from '@material-ui/core/CssBaseline'
56

67
import config from './config'
8+
import store from './_store'
9+
import api from './_api'
710
import authService from './_services/authService'
8-
import theme from './_theme/index'
11+
import theme from './_theme'
912

1013
import Auth from './Auth/Auth'
1114
import { DashboardContainer } from './Dashboard'
1215

13-
// Use different router type depending on configuration
14-
const Router: React.ComponentType<any> =
15-
config.navigationType === 'history' ? BrowserRouter : HashRouter
16+
api.init()
1617

1718
// Init the authentication service
1819
authService.init({
1920
useDemoToken: true,
2021
})
2122

23+
// Use different router type depending on configuration
24+
const AppRouter: React.ComponentType<any> =
25+
config.navigationType === 'history' ? BrowserRouter : HashRouter
26+
2227
const App: React.FC = () => {
2328
return (
2429
<div className="App">
2530
<CssBaseline />
2631
<ThemeProvider theme={theme}>
27-
<Router>
28-
<Route path="/auth" component={Auth} />
29-
<PrivateRoute path="/" component={DashboardContainer} />
30-
</Router>
32+
<Provider store={store}>
33+
<AppRouter>
34+
<Route path="/auth" component={Auth} />
35+
<PrivateRoute path="/" component={DashboardContainer} />
36+
</AppRouter>
37+
</Provider>
3138
</ThemeProvider>
3239
</div>
3340
)

src/AppDocs.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# App module
2+
3+
This is the application entry component. It handles the main routing and authentication redirects.

0 commit comments

Comments
 (0)