Skip to content

Commit 23dc6f5

Browse files
author
Yannick
authored
Merge pull request #35 from webgem-xyz/Media
✨ Added Media Component ✨ Added map & remove measurement button to Measurement Component ✨ Added MeasurementRow Component ( thx @Coen ) 🎨 Made code of the Measurement Component DRY by moving measurementRow to component (#17 #18 #19 #20 #21 #22) ( Thx @Coen ) 🎨 Changed color values from #7e7e7e and #fafafa to use var(--var-name) 🎨 Updated Media Component to use measurementRow (DRY) 🎨 Fixed code styling issues ( #25 #27 #28 #30 ) ( Thx @Coen ) 🎨 Changed readme.md to README.md 🐛 Fixed items being in the wrong order ( #41 ) 🐛 Quickfix for issues ( #46 #47 ) 🐛 Moved syncState out of components in to src/components/home.js ( #31 ) ( This fix has been temporarily disabled due to #46 & #47 ) 🐛 Changed font-weight: 900; to font-weight: 700; as the font does not support a font-weight of 900. 🐛 Changed Media Component from path="/media/:mediaId" to path="/med/:mediaId" so the Item Component actually sends you to the correct view when u click a media measurement. 📝 Added measurementRow to README 📝 Added removeMeasurement function as accepted prop for the Measurement Component 📝 Fixed spelling mistakes in ISSUE_TEMPLATE.md 📝 Updated README to add the right props to the Media Component 📝 Fixed spelling mistake in CHANGELOG.md on line 40 ❗️ This build contains temporarily fixes. These issues should be resolved properly as soon as possible. Thx @Coen for a fixing a lot of the issues in the Measurement Component. Thx @ThijsvanRijn for reviewing the changes made.
2 parents 008ea7a + a261f47 commit 23dc6f5

File tree

19 files changed

+555
-96
lines changed

19 files changed

+555
-96
lines changed

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "uva-reactnativeapp"
4+
}
5+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/.bin/acorn
2-
node_modules/
2+
node_modules/
3+
build/

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [0.0.7] - 2018-01-18
7+
### Added
8+
- Map to measurement page.
9+
- Remove button to view measurement.
10+
11+
### Fixed
12+
- A quickfix for #46 and #47 (Still needs proper fixing!) ❗
13+
- Fixed items being in the wrong order in the Overview Component [#41](https://github.com/webgem-xyz/UVA-React/issues/41)
14+
15+
16+
## [0.0.6] - 2018-01-18
17+
### Added
18+
- MeasurementRow Component to README [#44](https://github.com/webgem-xyz/UVA-React/issues/44)
19+
20+
### Fixed
21+
- Spelling mistakes in ISSUE_TEMPLATE.md
22+
- Moved syncState out of Measurement Component in to Home.js [#31](https://github.com/webgem-xyz/UVA-React/issues/31)
23+
24+
### Changed
25+
- readme.md to README.md (The standard).
26+
- Updated Media Component in README to show the proper props it accepts.
27+
28+
## [0.0.5] - 2018-01-18
29+
### Changed
30+
- Made code more DRY
31+
- Updated Media to use MeasurementRow Component
32+
- Changed color values to the global variable
33+
- Fixed font-weight 900 to 700
34+
35+
## [0.0.4] - 2018-01-18
36+
### Added
37+
- Media component. (Still needs the new measurement component)
38+
39+
### Changed
40+
- Item component now uses measurement type to determine if it should send it to /mes/:measurementId or /med/:mediaId
41+
- Router path changed from "/media/:mediaId" to "/med/:mediaId"
42+
643
## [0.0.3] - 2018-01-18
744
### Fixed
845
- Spelling mistake in README (line 7)

ISSUE_TEMPLATE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
Short description of what the issue is, what we should change.
22

33
## How we do it now
4-
-
4+
-
55
-
66

77
## Why does this need improving.
8-
-
9-
-
8+
-
9+
-
1010

1111
## What would we need to change.
1212
-
13-
-
13+
-
1414

1515
## Which files are affected.
16-
- src/components/addButtton/index.js (example)
16+
- src/components/addButtton/index.js (example)
1717
-
1818

1919
## Error messages if available
@@ -26,4 +26,4 @@ Short description of what the issue is, what we should change.
2626
-
2727

2828
## Estimated time needed to change.
29-
Fixing this issue will proberly take arround .. to .. hours
29+
Fixing this issue will probably take around .. to .. hours

firebase.json

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"rewrites": [
3+
{
4+
"source": "**",
5+
"destination": "/index.html"
6+
}
7+
],
8+
"headers": [
9+
{
10+
"source": "**",
11+
"headers": [
12+
{
13+
"key": "Cache-Control",
14+
"value": "public, max-age=3600, no-cache"
15+
},
16+
{
17+
"key": "Access-Control-Max-Age",
18+
"value": "600"
19+
}
20+
]
21+
},
22+
{
23+
"source": "/sw.js",
24+
"headers": [
25+
{
26+
"key": "Cache-Control",
27+
"value": "private, no-cache"
28+
}
29+
]
30+
},
31+
{
32+
"source": "**/*.chunk.*.js",
33+
"headers": [
34+
{
35+
"key": "Cache-Control",
36+
"value": "public, max-age=31536000"
37+
}
38+
]
39+
},
40+
{
41+
"source": "/",
42+
"headers": [
43+
{
44+
"key": "Link",
45+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style"
46+
}
47+
]
48+
},
49+
{
50+
"source": "/account",
51+
"headers": [
52+
{
53+
"key": "Link",
54+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-account.chunk.14754.js>; rel=preload; as=script"
55+
}
56+
]
57+
},
58+
{
59+
"source": "/addMedia",
60+
"headers": [
61+
{
62+
"key": "Link",
63+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-addMedia.chunk.0993d.js>; rel=preload; as=script"
64+
}
65+
]
66+
},
67+
{
68+
"source": "/overview",
69+
"headers": [
70+
{
71+
"key": "Link",
72+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-overview.chunk.ac036.js>; rel=preload; as=script"
73+
}
74+
]
75+
},
76+
{
77+
"source": "/login",
78+
"headers": [
79+
{
80+
"key": "Link",
81+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-login.chunk.b8935.js>; rel=preload; as=script"
82+
}
83+
]
84+
},
85+
{
86+
"source": "/add",
87+
"headers": [
88+
{
89+
"key": "Link",
90+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-add.chunk.d9d39.js>; rel=preload; as=script"
91+
}
92+
]
93+
},
94+
{
95+
"source": "/measurement",
96+
"headers": [
97+
{
98+
"key": "Link",
99+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-measurement.chunk.b0abb.js>; rel=preload; as=script"
100+
}
101+
]
102+
},
103+
{
104+
"source": "/Media",
105+
"headers": [
106+
{
107+
"key": "Link",
108+
"value": "</bundle.80def.js>; rel=preload; as=script, </style.a240d.css>; rel=preload; as=style, </route-Media.chunk.53605.js>; rel=preload; as=script"
109+
}
110+
]
111+
}
112+
],
113+
"public": "build"
114+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"preact-router": "^2.6.0",
4444
"re-base": "^3.2.1",
4545
"react-firebase-file-uploader": "^2.4.1",
46+
"react-gmaps": "^1.7.0",
4647
"react-router": "^4.2.0",
4748
"recharts": "^1.0.0-beta.9"
4849
}

readme.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
5858
* [Item Component](#item-component)
5959
* [Login Component](#login-component)
6060
* [Measurement Component](#measurement-component)
61+
* [MeasurementRow Component](#measurement-component)
6162
* [Media Component](#media-component)
6263
* [Overview Component](#overview-component)
6364
* [ProgressBar Component](#progressbar-component)
@@ -337,10 +338,54 @@ Attribute | Type | Usage
337338
Signin | function | The function that handles the login.
338339

339340
## Measurement Component
341+
### Usage
340342
The Measurement component consists of the following
341-
* Information from the Measurements
342-
* A Delete button
343+
* Header
344+
* Back Arrow
345+
* View Measurement
343346
* Map focused at the coordinates from the measurements.
347+
* List of data (label - value)
348+
* Longitude
349+
* Latitude
350+
* Date
351+
* Acidity (pH)
352+
* Salinity (PSU)
353+
* Tempature
354+
* A button to delete the measurements
355+
356+
### Location
357+
The Measurement Component is located at
358+
```
359+
src/routes/measurement/
360+
```
361+
### Attributes
362+
The Measurements Component accepts the following attributes
363+
364+
Attribute | Type | Usage
365+
--- | --- | ---
366+
measurementId | string | Used to get the measurement that was selected.
367+
measurements | object | Object of al the meaurements, reduced to the measurement the user is currently being viewed.
368+
removeMeasurement | func | Function that handles deleting the measurement from the database.
369+
370+
## MeasurementRow Component
371+
### Usage
372+
The MeasurementRow Component consists of the following
373+
* Wrapper row
374+
* Label
375+
* Value
376+
377+
### Location
378+
The MeasurementRow Component is located at
379+
```
380+
src/components/measurementRow/
381+
```
382+
### Attributes
383+
The MeasurementsRow Component accepts the following attributes
384+
385+
Attribute | Type | Usage
386+
--- | --- | ---
387+
label | string | What should the label be of the data.
388+
value | string | The value of the measurementRow.
344389

345390
## Media Component
346391
### Usage
@@ -367,8 +412,8 @@ The Media Component accepts the following attributes
367412

368413
Attribute | Type | Usage
369414
--- | --- | ---
370-
Uid | string | Used to get the media of the user.
371415
mediaId | string | Used to get the media that was selected.
416+
measurements | object | Passes down all measurements, Media Component reduces the data to what the user is trying to view.
372417

373418

374419
## Overview Component

src/components/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default class App extends Component {
6060
<Home path="/mes/:measurementId" uid={this.state.uid} />
6161
<Home path="/add" uid={this.state.uid} />
6262
<Home path="/addMedia" uid={this.state.uid} />
63-
<Home path="/media/:mediaId" uid={this.state.uid} />
63+
<Home path="/med/:mediaId" uid={this.state.uid} />
6464
<Home
6565
path="/account"
6666
uid={this.state.uid}

src/components/home/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from 'preact';
1+
import { Component, h } from 'preact';
22
import { PropTypes } from 'preact-compat';
33
import { Router, route } from 'preact-router';
44
import moment from 'moment';
@@ -19,6 +19,7 @@ export default class Home extends Component {
1919
super(props);
2020

2121
this.addMeasurement = this.addMeasurement.bind(this);
22+
this.removeMeasurement = this.removeMeasurement.bind(this);
2223

2324
this.state = {
2425
measurements: {},
@@ -50,6 +51,14 @@ export default class Home extends Component {
5051
route('/');
5152
}
5253

54+
removeMeasurement = (e, key) => {
55+
e.preventDefault();
56+
const measurements = { ...this.state.measurements };
57+
measurements[key] = null;
58+
this.setState({ measurements });
59+
route('/');
60+
};
61+
5362
handleRoute = e => {
5463
this.currentUrl = e.url;
5564
};
@@ -62,6 +71,7 @@ export default class Home extends Component {
6271
path="/mes/:measurementId"
6372
uid={this.props.uid}
6473
measurements={this.state.measurements}
74+
removeMeasurement={this.removeMeasurement}
6575
/>
6676
<Add
6777
path="/add"
@@ -74,7 +84,7 @@ export default class Home extends Component {
7484
measurements={this.state.measurements}
7585
addMeasurement={this.addMeasurement}
7686
/>
77-
<Media path="/media/:mediaId" uid={this.props.uid} />
87+
<Media path="/med/:mediaId" uid={this.props.uid} measurements={this.state.measurements} />
7888
<Account
7989
path="/account"
8090
uid={this.props.uid}

src/components/item/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class Item extends Component {
2828
render() {
2929
const details = this.props.details;
3030
return (
31-
<Link href={`/mes/${this.props.index}`} class={style.link}>
31+
<Link href={`/${details.type}/${this.props.index}`} class={style.link}>
3232
<div class={style.itemLinkWrap}>
3333
<img src={defineImgSrc(details)} alt={defineImgAlt(details)} height="20" class={style.icon} />
3434
<p class={style.date}>{details.date}</p>

0 commit comments

Comments
 (0)