style: add eslint configuration and fixed linter issues (#35)
* style: add eslint configuration as per bee-js * chore: add `plugin:react/reocommended` in `.eslintrc` Co-authored-by: nugaon <50576770+nugaon@users.noreply.github.com> * chore: add `consistent` to `array-bracket-newline` as per review * style: after automatic fixes with `npm run lint` * style: fixed all linter errors * refactor: fixed all linter warnings * chore: added missing new line at end of `.prettierrc` file Co-authored-by: nugaon <50576770+nugaon@users.noreply.github.com>
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Route } from 'react-router-dom';
|
||||
|
||||
|
||||
const AppRoute = ( {component: Component, layout: Layout, ...rest }) => (
|
||||
<Route {...rest} render={props => (
|
||||
<Layout {...props}>
|
||||
<Component {...props} />
|
||||
</Layout>
|
||||
)} />
|
||||
)
|
||||
|
||||
export default AppRoute;
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { JSXElementConstructor, ReactElement } from 'react'
|
||||
import { Route, RouteComponentProps } from 'react-router-dom'
|
||||
|
||||
interface Props {
|
||||
component: JSXElementConstructor<RouteComponentProps>
|
||||
layout: JSXElementConstructor<RouteComponentProps>
|
||||
exact?: boolean
|
||||
path: string
|
||||
}
|
||||
|
||||
const AppRoute = ({ component: Component, layout: Layout, exact, path }: Props): ReactElement => (
|
||||
<Route
|
||||
exact={exact}
|
||||
path={path}
|
||||
render={props => (
|
||||
<Layout {...props}>
|
||||
<Component {...props} />
|
||||
</Layout>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
|
||||
export default AppRoute
|
||||
+19
-20
@@ -1,27 +1,26 @@
|
||||
import React from 'react';
|
||||
import { Switch } from 'react-router-dom';
|
||||
import type { ReactElement } from 'react'
|
||||
import { Switch } from 'react-router-dom'
|
||||
|
||||
import AppRoute from './AppRoute';
|
||||
import AppRoute from './AppRoute'
|
||||
|
||||
// layouts
|
||||
import Dashboard from '../layout/Dashboard';
|
||||
import Dashboard from '../layout/Dashboard'
|
||||
|
||||
// pages
|
||||
import Status from '../pages/status/index';
|
||||
import Files from '../pages/files/index';
|
||||
import Peers from '../pages/peers/index';
|
||||
import Accounting from '../pages/accounting/index';
|
||||
import Settings from '../pages/settings/index';
|
||||
import Status from '../pages/status/index'
|
||||
import Files from '../pages/files/index'
|
||||
import Peers from '../pages/peers/index'
|
||||
import Accounting from '../pages/accounting/index'
|
||||
import Settings from '../pages/settings/index'
|
||||
|
||||
const BaseRouter = (): ReactElement => (
|
||||
<Switch>
|
||||
<AppRoute exact path="/" layout={Dashboard} component={Status} />
|
||||
<AppRoute exact path="/files/" layout={Dashboard} component={Files} />
|
||||
<AppRoute exact path="/peers/" layout={Dashboard} component={Peers} />
|
||||
<AppRoute exact path="/accounting/" layout={Dashboard} component={Accounting} />
|
||||
<AppRoute exact path="/settings/" layout={Dashboard} component={Settings} />
|
||||
</Switch>
|
||||
)
|
||||
|
||||
const BaseRouter = (props: any) => (
|
||||
<Switch>
|
||||
<AppRoute exact path='/' layout={ Dashboard } component={Status}/>
|
||||
<AppRoute exact path='/files/' layout={ Dashboard } component={Files}/>
|
||||
<AppRoute exact path='/peers/' layout={ Dashboard } component={Peers}/>
|
||||
<AppRoute exact path='/accounting/' layout={ Dashboard } component={Accounting}/>
|
||||
<AppRoute exact path='/settings/' layout={ Dashboard } component={Settings}/>
|
||||
</Switch>
|
||||
);
|
||||
|
||||
export default BaseRouter;
|
||||
export default BaseRouter
|
||||
|
||||
Reference in New Issue
Block a user