-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworked some parts of the app, added vehicles view
- Loading branch information
1 parent
6c542e8
commit f36d33e
Showing
16 changed files
with
197 additions
and
475 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: yarn | ||
- run: yarn build | ||
- name: Upload | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: dist/bmw-status-${{ github.ref }}.dmg | ||
asset_name: macos | ||
tag: ${{ github.ref }} | ||
overwrite: true |
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,68 +1,19 @@ | ||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
# WORK IN PROGRESS | ||
|
||
## Available Scripts | ||
App implementing BMW's Connected Drive API using Electron and React | ||
|
||
In the project directory, you can run: | ||
Features | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.<br> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br> | ||
You will also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.<br> | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.<br> | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br> | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
- [x] Login | ||
- [ ] Login with TouchID | ||
- [x] View cars | ||
- [ ] Access car details | ||
- [ ] View PHEV/EV charging status | ||
- [ ] Implement polling for charging status | ||
- [ ] Add notifications for charging status | ||
- [ ] Implement service execution for heating/horn/lights (note: Lock/Unlock **will never be implemented for security reasons**) | ||
- [ ] Let's see whatever comes to mind | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). | ||
|
||
### Code Splitting | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting | ||
|
||
### Analyzing the Bundle Size | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size | ||
|
||
### Making a Progressive Web App | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app | ||
|
||
### Advanced Configuration | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration | ||
|
||
### Deployment | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment | ||
|
||
### `npm run build` fails to minify | ||
### `npm start` | ||
|
||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify | ||
App will open but keep in mind it's a tray 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from '../src/App'; | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div'); | ||
ReactDOM.render(<App />, div); | ||
ReactDOM.unmountComponentAtNode(div); | ||
}); |
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
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 was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,37 +1,41 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Card, Image, Icon } from 'semantic-ui-react'; | ||
import { Card, Image, Placeholder } from 'semantic-ui-react'; | ||
|
||
const Vehicle = ({ vehicle }) => { | ||
console.log('veh', vehicle, vehicle.vin); | ||
import carPlaceholder from '../../assets/images/car-placeholder.jpg'; | ||
|
||
const Vehicle = ({ vehicle, onClick }) => { | ||
const [image, setImage] = useState(null); | ||
|
||
useEffect(() => { | ||
vehicle.getImage().then(setImage); | ||
vehicle | ||
.getImage() | ||
.then(setImage) | ||
.catch(() => setImage(carPlaceholder)); | ||
}, []); | ||
|
||
return ( | ||
<Card> | ||
{image && <Image src={image} wrapped />} | ||
<Card onClick={onClick}> | ||
{image ? ( | ||
<Image src={image} wrapped /> | ||
) : ( | ||
<Placeholder> | ||
<Placeholder.Image square /> | ||
</Placeholder> | ||
)} | ||
<Card.Content> | ||
<Card.Header>{vehicle.vin}</Card.Header> | ||
<Card.Header>{vehicle.name}</Card.Header> | ||
<Card.Meta> | ||
<span className="date">Joined in 2015</span> | ||
<span>{vehicle.vin}</span> | ||
</Card.Meta> | ||
<Card.Description> | ||
Matthew is a musician living in Nashville. | ||
</Card.Description> | ||
</Card.Content> | ||
<Card.Content extra> | ||
<Icon name="user" /> | ||
22 Friends | ||
</Card.Content> | ||
</Card> | ||
); | ||
}; | ||
|
||
Vehicle.propTypes = { | ||
vehicle: PropTypes.object.isRequired, | ||
onClick: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default Vehicle; |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import { Segment, Header, Icon, Button } from 'semantic-ui-react'; | ||
import BMWApi from '@mihaiblaga89/bmw-connecteddrive-api'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { OPEN_ISSUE_URL } from '../../constants'; | ||
import Vehicle from '../Vehicle'; | ||
|
||
const { shell } = window.require('electron'); | ||
|
||
const HomeTab = ({ navigate }) => { | ||
const { vehicles } = BMWApi; | ||
if (!vehicles.length) { | ||
return ( | ||
<Segment placeholder> | ||
<Header icon> | ||
<Icon name="car" /> | ||
You have no car registered in BMW's Connected Drive or the | ||
API is not returning them. If you think this is an issue, | ||
please open a new issue on GitHub | ||
</Header> | ||
<Button | ||
onClick={() => shell.openExternal(OPEN_ISSUE_URL)} | ||
primary | ||
> | ||
Open issue | ||
</Button> | ||
</Segment> | ||
); | ||
} | ||
return ( | ||
<Segment> | ||
{vehicles.map(vehicle => ( | ||
<Vehicle | ||
onClick={() => navigate(`vehicle/${vehicle.vin}`)} | ||
vehicle={vehicle} | ||
key={vehicle.vin} | ||
/> | ||
))} | ||
</Segment> | ||
); | ||
}; | ||
|
||
HomeTab.propTypes = { | ||
navigate: PropTypes.func, | ||
}; | ||
|
||
export default HomeTab; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { useEffect } from 'react'; | ||
import { Segment, Button } from 'semantic-ui-react'; | ||
|
||
const VehicleTab = (...args) => { | ||
console.log('asd', args); | ||
return ( | ||
<Segment> | ||
<Button labelPosition="left" icon="left chevron" content="Back" /> | ||
</Segment> | ||
); | ||
}; | ||
|
||
export default VehicleTab; |
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
Oops, something went wrong.