Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new design #49

Merged
merged 41 commits into from
Nov 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f8b1918
Move About to Screen
amaury1093 Nov 15, 2018
43a619c
First batch of changes
amaury1093 Nov 16, 2018
cfa6fd4
Show details in details page
amaury1093 Nov 16, 2018
a47394d
Add banner on details
amaury1093 Nov 16, 2018
12058e2
Move Header inside Home
amaury1093 Nov 16, 2018
e0dc841
Use raw everywhere
amaury1093 Nov 16, 2018
5f46983
Add MST
amaury1093 Nov 16, 2018
9ff71df
Fix details page
amaury1093 Nov 16, 2018
0041874
Fix layout on homepage
amaury1093 Nov 16, 2018
b8810b0
Fix homepage
amaury1093 Nov 16, 2018
dbb158a
Fix About page
amaury1093 Nov 16, 2018
4d140d2
Add section in about
amaury1093 Nov 16, 2018
ecf62ab
Fix navigation transitions
amaury1093 Nov 16, 2018
51a8c6b
Fix shadows in Details
amaury1093 Nov 16, 2018
97481f0
Fix Search
amaury1093 Nov 16, 2018
98688d7
Use PureComponent everywhere
amaury1093 Nov 16, 2018
58389a9
Adjust cigarette position
amaury1093 Nov 16, 2018
b4a53e1
Fix scrolling on home
amaury1093 Nov 17, 2018
c54342d
Reorganize screens
amaury1093 Nov 17, 2018
72ddd59
Put error in mst
amaury1093 Nov 17, 2018
813ecf4
Fix button link
amaury1093 Nov 17, 2018
4f4d90a
Fix color
amaury1093 Nov 17, 2018
1766fe7
Small bugfixes
amaury1093 Nov 17, 2018
32776ed
Fix bug pollutants
amaury1093 Nov 17, 2018
035e881
Fix small bugs
amaury1093 Nov 17, 2018
d0f6526
Change meta info
amaury1093 Nov 17, 2018
6500c62
Update screenshots
amaury1093 Nov 17, 2018
fff94ff
Limit screenshot width
amaury1093 Nov 17, 2018
bc54c49
Fix limit width
amaury1093 Nov 17, 2018
fa06fed
Use img tag for screenshots
amaury1093 Nov 17, 2018
03072b0
Smaller images
amaury1093 Nov 17, 2018
cb27fbb
Images side by side
amaury1093 Nov 17, 2018
b1a1b97
Slightly bigger images
amaury1093 Nov 17, 2018
a6140c2
Bump version
amaury1093 Nov 17, 2018
59936ce
Fix lint
amaury1093 Nov 17, 2018
cf44b20
Add smoke video as separate component
amaury1093 Nov 17, 2018
e61502e
Fix header layout in details
amaury1093 Nov 17, 2018
401fb58
Add about text
amaury1093 Nov 17, 2018
5d3d51b
Add warning icons
amaury1093 Nov 17, 2018
9f2a907
Fix some designs
amaury1093 Nov 17, 2018
00252d2
Add font-awesome
amaury1093 Nov 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions App/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// Copyright (c) 2018, Amaury Martiny and the Shoot! I Smoke contributors
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

import React, { Component } from 'react';
import React, { PureComponent } from 'react';
import { Font } from 'expo';
import { Provider } from 'mobx-react';

import { Screens } from './Screens';
import { RootStore } from './stores';
import { Background as LoadingBackground } from './Screens/Loading/Background';
import { Screens } from './Screens';

// Set up global MST stores
const stores = RootStore.create({ api: undefined, error: false, location: {} });

export class App extends Component {
export class App extends PureComponent {
state = {
fontLoaded: false
};
Expand All @@ -26,6 +31,12 @@ export class App extends Component {
render () {
const { fontLoaded } = this.state;

return fontLoaded ? <Screens /> : <LoadingBackground />;
return fontLoaded ? (
<Provider stores={stores}>
<Screens />
</Provider>
) : (
<LoadingBackground />
);
}
}
2 changes: 1 addition & 1 deletion App/App.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, Amaury Martiny and the Shoot! I Smoke contributors
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

/* eslint-env jest */
Expand Down
161 changes: 161 additions & 0 deletions App/Screens/About/About.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

import React, { PureComponent } from 'react';
import { Constants } from 'expo';
import { Linking, ScrollView, StyleSheet, Text, View } from 'react-native';

import { Box } from './Box';
import * as theme from '../../utils/theme';
import { BackButton } from '../../components/BackButton';

export class About extends PureComponent {
handleOpenAmaury = () => Linking.openURL('https://twitter.com/amaurymartiny');

handleOpenAqi = () => Linking.openURL('http:https://aqicn.org/');

handleOpenArticle = () =>
Linking.openURL(
'http:https://berkeleyearth.org/air-pollution-and-cigarette-equivalence/'
);

handleOpenGithub = () => Linking.openURL(Constants.manifest.extra.githubUrl);

handleOpenMarcelo = () =>
Linking.openURL('https://www.behance.net/marceloscoelho');

render () {
const { navigation } = this.props;
return (
<ScrollView style={theme.withPadding}>
<BackButton onClick={navigation.pop} style={styles.backButton} />

<View style={styles.section}>
<Text style={styles.h2}>
How do you calculate the number of cigarettes?
</Text>
<Text style={theme.text}>
This app was inspired by Berkeley Earth’s findings about the{' '}
<Text onPress={this.handleOpenArticle} style={theme.link}>
equivalence between air pollution and cigarette smoking
</Text>
. The rule of thumb is simple: one cigarette per day is the rough
equivalent of a PM2.5 level of 22{' '}
<Text style={styles.micro}>&micro;</Text>
g/m&sup3;
{' \u207D'}
&sup1;
{'\u207E'}.
</Text>
<Box />
<Text style={styles.articleLink}>
(1){' '}
<Text onPress={this.handleOpenArticle} style={theme.link}>
http:https://berkeleyearth.org/air-pollution-and-cigarette-equivalence/
</Text>
</Text>
</View>

<View style={styles.section}>
<Text style={styles.h2}>Where does the data come from?</Text>
<Text style={theme.text}>
Air quality data comes from{' '}
<Text onPress={this.handleOpenAqi} style={theme.link}>
WAQI
</Text>{' '}
in the form of PM2.5 AQI levels which are usually updated every one
hour and converted to direct PM2.5 levels by the app.
</Text>
</View>

<View style={styles.section}>
<Text style={styles.h2}>
Why is the station so far away from my current location?
</Text>
<Text style={theme.text}>
Since stations that measure and communicate Air Quality results
every hour are expensive, the data is still limited to
well-developed regions and larger cities around the globe. If you
are far from a more prominent urban center, results will probably
not be so accurate. Chances are that your air is better in that case
at least!
</Text>
</View>

<View style={styles.section}>
<Text style={styles.h2}>
The results are weird or inconsistent with other sources!
</Text>
<Text style={theme.text}>
We have also encountered a few surprising results: large cities with
better air than small villages; sudden huge increases in the number
of cigarettes; stations of the same town showing significantly
different numbers... The fact is air quality depends on several
factors such as temperature, pressure, humidity and even wind
direction and intensity. If the result seems weird for you, check{' '}
<Text onPress={this.handleOpenAqi} style={theme.link}>
WAQI
</Text>{' '}
for more information and history on your station.
</Text>
</View>

<View style={styles.credits}>
<Text style={styles.h2}>Credits</Text>
<Text style={theme.text}>
Concept &amp; Development by{' '}
<Text onPress={this.handleOpenAmaury} style={theme.link}>
Amaury Martiny
</Text>
.{'\n'}
Design &amp; Copywriting by{' '}
<Text onPress={this.handleOpenMarcelo} style={theme.link}>
Marcelo S. Coelho
</Text>
.{'\n'}
{'\n'}
Air quality data from{' '}
<Text onPress={this.handleOpenAqi} style={theme.link}>
WAQI
</Text>
.{'\n'}
Source code{' '}
<Text onPress={this.handleOpenGithub} style={theme.link}>
available on Github
</Text>
.{'\n'}
{'\n'}
Shoot! I Smoke v{Constants.manifest.version}.
</Text>
</View>
</ScrollView>
);
}
}

const styles = StyleSheet.create({
articleLink: {
...theme.text,
fontSize: 8
},
backButton: {
marginBottom: theme.spacing.normal,
marginTop: theme.spacing.normal
},
credits: {
borderTopColor: theme.iconBackgroundColor,
borderTopWidth: 1,
marginBottom: theme.spacing.normal,
paddingTop: theme.spacing.big
},
h2: {
...theme.title,
fontSize: 20,
letterSpacing: 0,
lineHeight: 24,
marginBottom: theme.spacing.small
},
section: {
marginBottom: theme.spacing.big
}
});
107 changes: 107 additions & 0 deletions App/Screens/About/Box/Box.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

import React, { PureComponent } from 'react';
import { Image, Platform, StyleSheet, Text, View } from 'react-native';

import cigarette from '../../../../assets/images/cigarette.png';
import * as theme from '../../../utils/theme';

export class Box extends PureComponent {
render () {
return (
<View style={styles.box}>
<View style={styles.equivalence}>
<View style={styles.statisticsLeft}>
<Image source={cigarette} style={styles.cigarette} />
<Text style={styles.value} />
<Text style={styles.label}>per day</Text>
</View>
<Text style={styles.equal}>=</Text>
<View style={styles.statisticsRight}>
<Text style={styles.value}>22</Text>
<Text style={styles.label}>
<Text style={styles.micro}>&micro;</Text>
g/m&sup3; PM2.5*
</Text>
</View>
</View>
<Text style={styles.boxDescription}>
*Atmospheric particulate matter (PM) that have a diameter of less than
2.5 micrometers, with increased chances of inhalation by living
beings.
</Text>
</View>
);
}
}

const styles = StyleSheet.create({
box: {
alignItems: 'center',
borderColor: '#EAEAEA',
borderRadius: 8,
borderWidth: 1,
backgroundColor: 'white',
marginTop: 20,
marginBottom: 10,
padding: 10
},
boxDescription: {
...theme.text,
fontSize: 9,
lineHeight: 16,
marginTop: 15
},
cigarette: {
left: 6,
position: 'absolute',
bottom: 12
},
equal: {
...theme.text,
color: theme.secondaryTextColor,
fontSize: 44,
lineHeight: 44,
marginHorizontal: 18
},
equivalence: {
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'center'
},
label: {
...theme.title,
color: theme.secondaryTextColor,
fontSize: 12,
fontWeight: '900',
letterSpacing: 0.5
},
micro: {
...Platform.select({
ios: {
fontFamily: 'Georgia'
},
android: {
fontFamily: 'normal'
}
})
},
statisticsLeft: {
alignItems: 'flex-end',
justifyContent: 'flex-end',
marginTop: 36,
paddingRight: 10,
width: 90
},
statisticsRight: {
alignItems: 'center',
width: 90
},
value: {
...theme.text,
color: theme.secondaryTextColor,
fontSize: 44,
lineHeight: 44
}
});
4 changes: 4 additions & 0 deletions App/Screens/About/Box/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

export * from './Box';
4 changes: 4 additions & 0 deletions App/Screens/About/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) 2018, Amaury Martiny
// SPDX-License-Identifier: GPL-3.0

export * from './About';
Loading