Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from feedernet/prettier-js
Add Prettier Formatting
- Loading branch information
Showing
96 changed files
with
5,305 additions
and
4,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,100 @@ | ||
import React from 'react'; | ||
import {Switch, Route, withRouter, Link} from 'react-router-dom'; | ||
import React from "react"; | ||
import { Switch, Route, withRouter, Link } from "react-router-dom"; | ||
import Container from "react-bootstrap/Container"; | ||
import Navbar from "react-bootstrap/Navbar"; | ||
import Nav from "react-bootstrap/Nav"; | ||
import Icon from '@mdi/react' | ||
import {mdiSilverwareForkKnife, mdiCog, mdiPaw} from '@mdi/js'; | ||
import {ErrorComponent} from "./components/Error"; | ||
import Icon from "@mdi/react"; | ||
import { mdiSilverwareForkKnife, mdiCog, mdiPaw } from "@mdi/js"; | ||
import { ErrorComponent } from "./components/Error"; | ||
import FeederCardList from "./containers/FeederCardListContainer"; | ||
import FeedHistory from "./containers/FeedHistoryTableContainer"; | ||
import {getRootPath} from "./util"; | ||
import ProjectLogo from "./images/feeder-project-logo.svg" | ||
import { getRootPath } from "./util"; | ||
import ProjectLogo from "./images/feeder-project-logo.svg"; | ||
import NewFeederWizard from "./containers/NewFeederWizard"; | ||
import SnackModal from "./containers/SnackModalContainer"; | ||
import EditFeederModal from "./containers/EditFeederModalContainer"; | ||
import PetCardList from "./containers/PetCardListContainer"; | ||
import EditPetModal from "./containers/EditPetModalContainer"; | ||
import ScheduleModal from "./containers/ScheduleModalContainer"; | ||
|
||
const rootPath = getRootPath() | ||
const rootPath = getRootPath(); | ||
|
||
class App extends React.Component { | ||
state = { | ||
routes: [ | ||
{ | ||
path: rootPath, | ||
label: 'Feeder List', | ||
exact: true, | ||
render: props => { | ||
return <> | ||
<PetCardList {...props} /> | ||
<FeederCardList {...props} /> | ||
<FeedHistory {...props} /> | ||
<NewFeederWizard/> | ||
<SnackModal/> | ||
<EditFeederModal/> | ||
<EditPetModal/> | ||
<ScheduleModal/> | ||
</> | ||
} | ||
}, | ||
{ | ||
label: 'Page Not Found', | ||
render: () => { | ||
return <ErrorComponent message="Page Not Found!"/>; | ||
} | ||
} | ||
] | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<Navbar | ||
expand="lg" | ||
variant="dark" | ||
bg="primary" | ||
fixed="top" | ||
className={window.navigator.standalone === true ? "ios-app-nav" : null}> | ||
<Container> | ||
<Navbar.Brand href="#"> | ||
<img src={ProjectLogo} alt={"FeederNet Logo"} width={175}/> | ||
</Navbar.Brand> | ||
<Navbar.Toggle aria-controls="basic-navbar-nav"/> | ||
<Navbar.Collapse id="basic-navbar-nav"> | ||
<Nav className="mr-auto"> | ||
<Link | ||
to={rootPath} | ||
component={Nav.Link} | ||
active={window.location.pathname === `${rootPath}/`} | ||
> | ||
<Icon path={mdiPaw} size={.75}/> Home | ||
</Link> | ||
<Link to={`${rootPath}/settings`} component={Nav.Link}> | ||
<Icon path={mdiCog} size={.75}/> Settings | ||
</Link> | ||
</Nav> | ||
</Navbar.Collapse> | ||
</Container> | ||
</Navbar> | ||
<Container style={{marginTop: window.navigator.standalone === true ? 70 : 100}}> | ||
<Switch> | ||
{this.state.routes.map(ea => { | ||
return <Route key={ea.path} {...ea} />; | ||
})} | ||
</Switch> | ||
</Container> | ||
</div> | ||
); | ||
} | ||
state = { | ||
routes: [ | ||
{ | ||
path: rootPath, | ||
label: "Feeder List", | ||
exact: true, | ||
render: (props) => { | ||
return ( | ||
<> | ||
<PetCardList {...props} /> | ||
<FeederCardList {...props} /> | ||
<FeedHistory {...props} /> | ||
<NewFeederWizard /> | ||
<SnackModal /> | ||
<EditFeederModal /> | ||
<EditPetModal /> | ||
<ScheduleModal /> | ||
</> | ||
); | ||
}, | ||
}, | ||
{ | ||
label: "Page Not Found", | ||
render: () => { | ||
return <ErrorComponent message="Page Not Found!" />; | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<Navbar | ||
expand="lg" | ||
variant="dark" | ||
bg="primary" | ||
fixed="top" | ||
className={ | ||
window.navigator.standalone === true ? "ios-app-nav" : null | ||
} | ||
> | ||
<Container> | ||
<Navbar.Brand href="#"> | ||
<img src={ProjectLogo} alt={"FeederNet Logo"} width={175} /> | ||
</Navbar.Brand> | ||
<Navbar.Toggle aria-controls="basic-navbar-nav" /> | ||
<Navbar.Collapse id="basic-navbar-nav"> | ||
<Nav className="mr-auto"> | ||
<Link | ||
to={rootPath} | ||
component={Nav.Link} | ||
active={window.location.pathname === `${rootPath}/`} | ||
> | ||
<Icon path={mdiPaw} size={0.75} /> Home | ||
</Link> | ||
<Link to={`${rootPath}/settings`} component={Nav.Link}> | ||
<Icon path={mdiCog} size={0.75} /> Settings | ||
</Link> | ||
</Nav> | ||
</Navbar.Collapse> | ||
</Container> | ||
</Navbar> | ||
<Container | ||
style={{ marginTop: window.navigator.standalone === true ? 70 : 100 }} | ||
> | ||
<Switch> | ||
{this.state.routes.map((ea) => { | ||
return <Route key={ea.path} {...ea} />; | ||
})} | ||
</Switch> | ||
</Container> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default withRouter(App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
import {PET_API_BASE} from "../constants"; | ||
import {createPet} from "../constants/pet"; | ||
import {createAction} from "redux-api-middleware"; | ||
import { PET_API_BASE } from "../constants"; | ||
import { createPet } from "../constants/pet"; | ||
import { createAction } from "redux-api-middleware"; | ||
|
||
export const createPetAction = (name, animal_type, weight, birthday, activity_level, image = null, device_hid = null) => { | ||
const body = JSON.stringify({ | ||
name, | ||
animal_type, | ||
weight, | ||
birthday, | ||
image, | ||
activity_level, | ||
device_hid | ||
}); | ||
export const createPetAction = ( | ||
name, | ||
animal_type, | ||
weight, | ||
birthday, | ||
activity_level, | ||
image = null, | ||
device_hid = null | ||
) => { | ||
const body = JSON.stringify({ | ||
name, | ||
animal_type, | ||
weight, | ||
birthday, | ||
image, | ||
activity_level, | ||
device_hid, | ||
}); | ||
|
||
const meta = { | ||
method: 'POST', | ||
endpoint: `${PET_API_BASE}`, | ||
body | ||
}; | ||
return createAction({ | ||
endpoint: meta.endpoint, | ||
types: [ | ||
{type: createPet.CREATE_PET, meta}, | ||
{type: createPet.CREATE_PET_SUCCESS, meta}, | ||
{type: createPet.CREATE_PET_FAILURE, meta}, | ||
], | ||
method: meta.method, | ||
credentials: 'include', | ||
body | ||
}); | ||
}; | ||
const meta = { | ||
method: "POST", | ||
endpoint: `${PET_API_BASE}`, | ||
body, | ||
}; | ||
return createAction({ | ||
endpoint: meta.endpoint, | ||
types: [ | ||
{ type: createPet.CREATE_PET, meta }, | ||
{ type: createPet.CREATE_PET_SUCCESS, meta }, | ||
{ type: createPet.CREATE_PET_FAILURE, meta }, | ||
], | ||
method: meta.method, | ||
credentials: "include", | ||
body, | ||
}); | ||
}; |
Oops, something went wrong.