Skip to content

Commit 60fb51c

Browse files
committed
fix merge conflict in calendar detail
2 parents bfcdfd5 + 9869a09 commit 60fb51c

File tree

12 files changed

+120
-90
lines changed

12 files changed

+120
-90
lines changed

modules/badge/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @flow
2+
3+
export {OutlineBadge} from './outline'
4+
export {SolidBadge} from './solid'

source/components/solid-badge.js renamed to modules/badge/outline.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import * as React from 'react'
33
import {View, Text, StyleSheet} from 'react-native'
44
import * as c from '@frogpond/colors'
5+
import tinycolor from 'tinycolor2'
56

6-
type PropsType = {
7+
type Props = {
78
text: string,
89
accentColor?: string,
910
textColor?: string,
10-
style?: number | Object | Array<number | Object>,
11-
textStyle?: number | Object | Array<number | Object>,
11+
style?: any,
12+
textStyle?: any,
1213
}
1314

1415
let styles = StyleSheet.create({
@@ -24,24 +25,26 @@ let styles = StyleSheet.create({
2425
},
2526
})
2627

27-
export function SolidBadge({
28+
export function OutlineBadge({
2829
text,
2930
style,
3031
textStyle,
3132
accentColor = c.goldenrod,
3233
textColor = 'hsl(26, 49%, 34%)',
33-
}: PropsType) {
34-
const bgaccent = accentColor.replace('rgb', 'rgba').replace(')', ', 0.1)')
34+
}: Props) {
35+
const bgaccent = tinycolor(accentColor)
36+
.setAlpha(0.1)
37+
.toRgbString()
3538

3639
return (
3740
<View
3841
style={[
3942
styles.accessoryBadge,
40-
style,
4143
{backgroundColor: bgaccent, borderColor: accentColor},
44+
style,
4245
]}
4346
>
44-
<Text style={[styles.accessoryBadgeText, textStyle, {color: textColor}]}>
47+
<Text style={[styles.accessoryBadgeText, {color: textColor}, textStyle]}>
4548
{text}
4649
</Text>
4750
</View>

modules/badge/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@frogpond/badge",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"author": "",
7+
"license": "ISC",
8+
"scripts": {
9+
"test": "jest"
10+
},
11+
"peerDependencies": {
12+
"@frogpond/colors": "^1.0.0",
13+
"react": "^16.0.0",
14+
"tinycolor2": "^1.4.1",
15+
"react-native": "^0.55.4"
16+
}
17+
}

modules/badge/solid.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// @flow
2+
3+
import * as React from 'react'
4+
import {View, Text, StyleSheet, Platform} from 'react-native'
5+
import * as c from '@frogpond/colors'
6+
7+
type Props = {
8+
status: string,
9+
accentColor?: string,
10+
textColor?: string,
11+
}
12+
13+
export function SolidBadge(props: Props) {
14+
const {status, accentColor = c.goldenrod, textColor = c.white} = props
15+
16+
return (
17+
<View style={[styles.badge, {backgroundColor: accentColor}]}>
18+
<Text style={[styles.badgeText, {color: textColor}]}>{status}</Text>
19+
</View>
20+
)
21+
}
22+
23+
const styles = StyleSheet.create({
24+
badge: {
25+
marginTop: 20,
26+
paddingHorizontal: 12,
27+
paddingVertical: 4,
28+
borderRadius: 5,
29+
alignSelf: 'center',
30+
...Platform.select({
31+
android: {
32+
marginBottom: 14,
33+
},
34+
}),
35+
},
36+
badgeText: {
37+
fontSize: 18,
38+
},
39+
})

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"ios:release": "react-native run-ios --configuration Release",
1919
"ios-simulator": "xcrun instruments -s devices | peco --select-1 --query 'Simulator iPhone' --on-cancel error | sed 's~.*\\[\\(.*\\)\\].*~\\1~' | xargs open -n -a Simulator --args -CurrentDeviceUDID",
2020
"lint": "eslint --report-unused-disable-directives --max-warnings=0 --cache source/ modules/ scripts/ *.js",
21-
"prepare": "sed -i.bak 's/\\(_backedTextInputView.scrollEnabled = \\)YES;/\\1NO;/' node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m",
21+
"prepare": "npm run prepareScrollEnabled && npm run preparePopover",
22+
"preparePopover": "sed -i.bak '111s/\\(this.safeAreaViewReady = \\)false;/\\1true;/' node_modules/react-native-popover-view/src/Popover.js",
23+
"prepareScrollEnabled": "sed -i.bak 's/\\(_backedTextInputView.scrollEnabled = \\)YES;/\\1NO;/' node_modules/react-native/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m",
2224
"prettier": "prettier --write '{source,modules,scripts,e2e}/**/*.{js,json}' 'data/**/*.css' '*.js'",
2325
"prettier:changed": "pretty-quick",
2426
"prettier:since-master": "pretty-quick",
@@ -127,7 +129,7 @@
127129
"react-native-keychain": "3.0.0",
128130
"react-native-linear-gradient": "2.4.2",
129131
"react-native-network-info": "4.0.0",
130-
"react-native-onesignal": "3.2.6",
132+
"react-native-onesignal": "3.2.7",
131133
"react-native-paper": "2.0.1",
132134
"react-native-popover-view": "1.0.8",
133135
"react-native-restart": "0.0.7",

source/components/outline-badge.js

Lines changed: 0 additions & 46 deletions
This file was deleted.

source/redux/parts/notifications.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@ export function hydrate(): ThunkAction<
108108
}
109109
}
110110

111+
export function refreshPushStatus(): ThunkAction<SetPermissionsAction> {
112+
return dispatch => {
113+
OneSignal.getPermissionSubscriptionState(permissions => {
114+
dispatch({
115+
type: SET_PERMISSIONS,
116+
payload: {
117+
enabled: permissions.notificationsEnabled,
118+
hasPrompted: permissions.hasPrompted,
119+
},
120+
})
121+
})
122+
}
123+
}
124+
111125
type DisableNotificationsAction = {|
112126
type: 'notifications/DISABLE',
113127
|}

source/views/building-hours/detail/building.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import moment from 'moment-timezone'
88
import * as c from '@frogpond/colors'
99
import {getShortBuildingStatus} from '../lib'
1010

11-
import {OutlineBadge} from '../../../components/outline-badge'
11+
import {SolidBadge as Badge} from '@frogpond/badge'
1212
import {Header} from './header'
1313
import {ScheduleTable} from './schedule-table'
1414
import {ListFooter} from '@frogpond/lists'
@@ -37,6 +37,11 @@ type Props = {
3737
onProblemReport: () => any,
3838
}
3939

40+
const BGCOLORS = {
41+
Open: c.moneyGreen,
42+
Closed: c.salmon,
43+
}
44+
4045
export class BuildingDetail extends React.Component<Props> {
4146
shouldComponentUpdate(nextProps: Props) {
4247
return (
@@ -63,7 +68,7 @@ export class BuildingDetail extends React.Component<Props> {
6368
) : null}
6469

6570
<Header building={info} />
66-
<OutlineBadge status={openStatus} />
71+
<Badge accentColor={BGCOLORS[openStatus]} status={openStatus} />
6772
<ScheduleTable
6873
now={now}
6974
onProblemReport={onProblemReport}

source/views/building-hours/row.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import * as React from 'react'
44
import {View, Text, StyleSheet} from 'react-native'
5-
import {SolidBadge} from '../../components/solid-badge'
5+
import {OutlineBadge as Badge} from '@frogpond/badge'
66
import isEqual from 'lodash/isEqual'
77
import type momentT from 'moment'
88
import type {BuildingType} from './types'
@@ -122,7 +122,7 @@ export class BuildingRow extends React.Component<Props, State> {
122122
</Title>
123123

124124
{!info.isNotice ? (
125-
<SolidBadge
125+
<Badge
126126
accentColor={accentBg}
127127
style={styles.accessoryBadge}
128128
text={openStatus}

source/views/settings/screens/push-notifications/on-resume.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import * as React from 'react'
44
import {AppState} from 'react-native'
55
import {connect} from 'react-redux'
6-
import {hydrate} from '../../../../redux/parts/notifications'
6+
import {refreshPushStatus} from '../../../../redux/parts/notifications'
77

88
type Props = {
9-
rehydrate: () => any,
9+
refreshPushStatus: () => any,
1010
}
1111

1212
type State = {
@@ -33,7 +33,7 @@ class _CheckForPushSettingsOnResume extends React.Component<Props, State> {
3333
currentAppState !== 'active' && nextAppState === 'active'
3434

3535
if (shouldRehydrate) {
36-
this.props.rehydrate()
36+
this.props.refreshPushStatus()
3737
}
3838

3939
this.setState(() => ({appState: nextAppState}))
@@ -47,6 +47,6 @@ class _CheckForPushSettingsOnResume extends React.Component<Props, State> {
4747
export const CheckForPushSettingsOnResume = connect(
4848
null,
4949
(dispatch): Props => ({
50-
rehydrate: () => dispatch(hydrate()),
50+
refreshPushStatus: () => dispatch(refreshPushStatus()),
5151
}),
5252
)(_CheckForPushSettingsOnResume)

0 commit comments

Comments
 (0)