Skip to content

Commit 9342d06

Browse files
ACAC
authored andcommitted
undo commit
0 parents  commit 9342d06

File tree

119 files changed

+9266
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+9266
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
["@babel/env", {"modules": false}],
4+
"@babel/preset-react",
5+
],
6+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
indent_size = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
max_line_length = 80
11+
trim_trailing_whitespace = true
12+
13+
[*.md]
14+
max_line_length = 0
15+
trim_trailing_whitespace = false

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/index.js
13+
14+
# sample app
15+
/sample/node_modules
16+
/sample/yarn.lock
17+
18+
# misc
19+
/.idea
20+
.idea
21+
.DS_Store
22+
.env.local
23+
.env.development.local
24+
.env.test.local
25+
.env.production.local
26+
27+
npm-debug.log*
28+
yarn.lock
29+
yarn-debug.log*
30+
yarn-error.log*
31+
32+
*.tgz
33+
34+
# gh-pages
35+
*/build/*

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
tests/
3+
public/
4+
sample/
5+
src/
6+
rollup.config.js
7+
yarn.lock
8+
*.tgz

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 HyperTrack
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# HyperTrack Views for ReactJS
2+
3+
A wrapper for views provided through the [HyperTrack dashboard](https://dashboard.hypertrack.com/). It allows you to integrate the same views into your own application.
4+
5+
> Please check out the [Views Guide](https://docs.hypertrack.com/#views) for a closer look at the capabilities provided by HyperTrack Views.
6+
7+
![sample view](public/sample.png "Sample View")
8+
9+
## Prerequisites
10+
11+
- Set up a HyperTrack account and obtain your [Publishable Key from the Dashboard](https://dashboard.hypertrack.com/setup)
12+
- Integrate the HyperTrack SDK in your application ([iOS](https://github.com/hypertrack/quickstart-ios), [Android](https://github.com/hypertrack/quickstart-android), or [React Native](https://github.com/hypertrack/quickstart-react-native)) or use our sample app to send location data ([iOS](https://github.com/hypertrack/live-app-ios) or [Android](https://github.com/hypertrack/live-app-android))
13+
14+
## Explore sample app
15+
16+
You can use the sample app provided to explore the capabilities and usage of this component. Please [visit this page to open the sample app](https://hypertrack.github.io/views-react/).
17+
18+
To run the sample app on your own, follow these steps:
19+
20+
Jump to the sample app folder:
21+
22+
```shell
23+
cd sample
24+
```
25+
26+
Install all app dependencies:
27+
28+
```shell
29+
npm i
30+
31+
yarn
32+
```
33+
34+
> Note: Do not run the installation in the root folder. If that has been done before sample app dependecies were installed, NPM will use installed packages from the root node_modules, which might reason conflicts and break the build process
35+
36+
Run the sample app:
37+
38+
```shell
39+
node run start
40+
41+
yarn start
42+
```
43+
44+
The CLI will open up the locally hosted sample app (`http://localhost:3000/`) and should look like this:
45+
![sample app](public/sample-app-v1.png "Sample App")
46+
47+
## Installation
48+
49+
You can use either Yarn or NPM to add `hypertrack-views-react` to your project:
50+
51+
```shell
52+
npm install --save hypertrack-views-react
53+
54+
yarn add hypertrack-views-react
55+
```
56+
57+
## Usage
58+
59+
```javascript
60+
import { LiveView } from "hypertrack-views-react";
61+
62+
const PUBLISHABLE_KEY = "<your_key>";
63+
64+
<LiveView
65+
publishableKey={PUBLISHABLE_KEY}
66+
showTooltips={true}
67+
showDeviceList={false}
68+
showDeviceCard={false}
69+
selectedDeviceId={"00112233-4455-6677-8899-AABBCCDDEEFF"}
70+
defaultLayer={"custom"}
71+
customLayerUrl={"http://mt2.google.com/vt/lyrs=s&x={x}&y={y}&z={z}"}
72+
assetsUrl={"https://abc-sdk-test-assets.s3-us-west-2.amazonaws.com/"}
73+
/>;
74+
```
75+
76+
## Configuration
77+
78+
| Property | Type | Default | Description |
79+
| ---------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80+
| publishableKey | string | N/A | The publishable key of your account from the [Setup page on the Dashboard](https://dashboard.hypertrack.com/setup) |
81+
| showTooltips | boolean | `false` | Show the device ID right next to the location marker of a device |
82+
| showDeviceList | boolean | `true` | Show the list of all tracked devices, includes filter and search options. A click on a device will place zoom to the device location |
83+
| showDeviceCard | boolean | `true` | Show the device detail card on the single device view |
84+
| selectedDeviceId | string | `null` | ID of the device to be displayed (case sensistive). Can be obtained using the [Device API](https://docs.hypertrack.com/#api-devices). Adding this will change the view to a single device mode (including device data, activity, and more) |
85+
| defaultLayer | string | `base` | Can be either one of: [`base`](https://cloud.maptiler.com/maps/voyager/), [`street`](https://cloud.maptiler.com/maps/streets/), [`satellite`](https://cloud.maptiler.com/maps/hybrid/), or `custom`. Custom will only work if a customLayerUrl is provided. |
86+
| customLayerUrl | string | `null` | URL to a Leaflet-compatible [tiled web map](https://en.wikipedia.org/wiki/Tiled_web_map) in XYZ format. Only raster is supported and it needs to be public accessible. |
87+
| assetsUrl | string | `null` | URL to a public asset folder containig SVG files to replace default icons. The filenames need to match exactly. Missing icons will show the default versions. |
88+
89+
> Note: The component passes along all additional properties, so you can use properties like `className`.
90+
91+
#### Showing a single device
92+
93+
When provided with the `selectedDeviceId` property, the component will render a single device view as opposed to the device overview. You can find more details in the [Live device view documentation](https://docs.hypertrack.com/#live-device-view).
94+
95+
![live device view](public/sample-single-device.png "Live Device View")
96+
97+
> The device info card on the left side can be disabled by setting `showDeviceCard` to `false`
98+
99+
#### Adding a custom map layer
100+
101+
With the `customLayerUrl` property, you can reference a raster tile to be added as a custom map layer. Users can select the custom view from the ![map-layer-icon](public/map-layer.png "map layer icon") button on the top right side of the view. The layer is pre-selected based on the `defaultLayer` property. After setting the `customLayerUrl`, you can set the `defaultLayer` property to `custom` to render this new tile by default.
102+
103+
There are different ways to obtain and/or generate a custom layer. [OpenMapTiles](https://openmaptiles.org/) might be of interest. You can also generate/customize [MapBox maps and access them as raster tiles](https://docs.mapbox.com/api/maps/#raster-tiles).
104+
105+
> Note: Please ensure you use the XYZ URL format, which looks something like this: `/tile-name/{z}/{x}/{y}.png`
106+
107+
Here are some sample layer tiles:
108+
109+
| Layer | URL | Preview |
110+
| ---------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------- |
111+
| Google Maps: Satellite | `http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}` | <img src="public/satellite-map.png" alt="satellite preview" width="150"/> |
112+
| Google Maps: Roadmap/Streets | `http://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}` | <img src="public/streets-map.png" alt="streets preview" width="150"/> |
113+
| Google Maps: Hybrid | `http://mt0.google.com/vt/lyrs=s,h&hl=en&x={x}&y={y}&z={z}` | <img src="public/hybrid-map.png" alt="hybrid preview" width="150"/> |
114+
115+
#### Replacing default icons
116+
117+
By default, the views display a set of icons to indicate status, activity, and more. You can replace each icon individually. Below is a list of all the replaceable icons.
118+
119+
> **Original Icons**: You can use the [default icons](i) and make your modifications
120+
121+
| Filename | Default | Description |
122+
| -------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
123+
| `live-direction.svg` | <img src="https://dashboard.hypertrack.com/assets/live-direction.svg" alt="live-direction.svg" width="20"/> | Dot indicated the live location and direction of a device |
124+
| `live.svg` | <img src="https://dashboard.hypertrack.com/assets/live.svg" alt="live.svg" width="20"/> | Dot indicated the live location of a device |
125+
| `offline.svg` | <img src="https://dashboard.hypertrack.com/assets/offline.svg" alt="offline.svg" width="20"/> | Dot indicated the last known location of a device |
126+
| `walk.svg` | <img src="https://dashboard.hypertrack.com/assets/walk.svg" alt="walk.svg" width="20"/> | Activity icon for walking activity |
127+
| `run.svg` | <img src="https://dashboard.hypertrack.com/assets/run.svg" alt="run.svg" width="20"/> | Activity icon for running activity |
128+
| `cycle.svg` | <img src="https://dashboard.hypertrack.com/assets/cycle.svg" alt="cycle.svg" width="20"/> | Activity icon for cycling activity |
129+
| `drive.svg` | <img src="https://dashboard.hypertrack.com/assets/drive.svg" alt="drive.svg" width="20"/> | Activity icon for driving activity |
130+
| `stop.svg` | <img src="https://dashboard.hypertrack.com/assets/stop.svg" alt="stop.svg" width="20"/> | Activity icon for stopping activity |
131+
| `unknown.svg` | <img src="https://dashboard.hypertrack.com/assets/unknown.svg" alt="unknown.svg" width="20"/> | Activity icon for unknown activity |
132+
| `inactive.svg` | <img src="https://dashboard.hypertrack.com/assets/inactive.svg" alt="inactive.svg" width="20"/> | Status icon for inactive device |
133+
| `disconnected.svg` | <img src="https://dashboard.hypertrack.com/assets/disconnected.svg" alt="disconnected.svg" width="20"/> | Status icon for disconnected device |
134+
135+
## Versioning
136+
137+
We use [Semantic Versioning](http://semver.org/). For the versions available, see the [tags on this repository](https://github.com/hypertrack/views-react/tags).
138+
139+
## License
140+
141+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

package.json

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{
2+
"name": "hypertrack-views-react",
3+
"version": "1.1.18",
4+
"private": false,
5+
"license": "MIT",
6+
"main": "index.js",
7+
"files": [
8+
"index.js",
9+
"bundle.css",
10+
"package.json",
11+
"README.MD"
12+
],
13+
"style": "leaflet/dist/leaflet.css",
14+
"repository": {
15+
"type": "git",
16+
"url": "git+https://github.com/hypertrack/views-react.git"
17+
},
18+
"dependencies": {
19+
"apollo-client": "^2.6.4",
20+
"apollo-link": "^1.2.12",
21+
"apollo-link-http": "^1.5.15",
22+
"aws-appsync": "^1.8.1",
23+
"classnames": "^2.2.6",
24+
"copy-text-to-clipboard": "^2.1.0",
25+
"date-fns": "^1.30.1",
26+
"downshift": "^3.2.10",
27+
"graphql": "^14.4.2",
28+
"graphql-tag": "^2.10.1",
29+
"leaflet": "^1.5.0",
30+
"leaflet-defaulticon-compatibility": "^0.1.1",
31+
"leaflet.featuregroup.subgroup": "^1.0.2",
32+
"leaflet.markercluster": "^1.4.1",
33+
"lodash.debounce": "^4.0.8",
34+
"lodash.throttle": "^4.1.1",
35+
"lottie-web": "^5.5.5",
36+
"node-sass": "^4.12.0",
37+
"prop-types": "^15.7.2",
38+
"react": "^16.8.2",
39+
"react-animate-height": "^2.0.15",
40+
"react-apollo": "^2.5.8",
41+
"react-day-picker": "^7.3.0",
42+
"react-detect-offline": "^2.3.0",
43+
"react-dom": "^16.8.2",
44+
"react-if": "^3.4.0",
45+
"react-loadable": "^5.5.0"
46+
},
47+
"scripts": {
48+
"analyze": "source-map-explorer build/static/*.js",
49+
"start": "NODE_ENV=developmentsdk react-scripts start",
50+
"build": "rollup -c --environment INCLUDE_DEPS,BUILD:production",
51+
"release": "release-it",
52+
"test": "react-scripts test --verbose=true",
53+
"eject": "react-scripts eject"
54+
},
55+
"eslintConfig": {
56+
"extends": "react-app"
57+
},
58+
"browserslist": [
59+
">0.2%",
60+
"not dead",
61+
"not ie <= 11",
62+
"not op_mini all",
63+
"ie 10"
64+
],
65+
"devDependencies": {
66+
"@babel/preset-env": "^7.5.5",
67+
"@babel/preset-react": "^7.0.0-0",
68+
"@babel/runtime": "^7.5.4",
69+
"add": "^2.0.6",
70+
"babel-core": "^7.0.0-0",
71+
"babel-plugin-transform-runtime": "^6.23.0",
72+
"babel-preset-es2015-rollup": "^3.0.0",
73+
"babel-preset-react": "^6.24.1",
74+
"cssnano": "^4.1.10",
75+
"postcss-cssnext": "^3.1.0",
76+
"postcss-nested": "^4.1.2",
77+
"postcss-simple-vars": "^5.0.2",
78+
"react-scripts": "^3.0.1",
79+
"release-it": "^12.3.5",
80+
"rollup": "^1.17.0",
81+
"rollup-plugin-babel": "^4.3.3",
82+
"rollup-plugin-commonjs": "^10.0.1",
83+
"rollup-plugin-json": "^4.0.0",
84+
"rollup-plugin-node-resolve": "^5.2.0",
85+
"rollup-plugin-postcss": "^2.0.3",
86+
"rollup-plugin-replace": "^2.2.0",
87+
"rollup-plugin-terser": "^5.1.1"
88+
},
89+
"release-it": {
90+
"github": {
91+
"release": true
92+
}
93+
},
94+
"publishConfig": {
95+
"registry": "https://registry.npmjs.org/"
96+
}
97+
}

public/_redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* /index.html 200

public/favicon.ico

21.3 KB
Binary file not shown.

public/favicon.png

1.5 KB
Loading

0 commit comments

Comments
 (0)