forked from tidepool-org/uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch
master
into electron-medtronic600
- Loading branch information
Showing
67 changed files
with
2,456 additions
and
1,286 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 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,2 @@ | ||
# nvm | ||
source ~/.nvm/nvm.sh |
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,38 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: ~/tidepool-org/chrome-uploader | ||
parallelism: 1 | ||
# CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did. | ||
# If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables . | ||
environment: | ||
BASH_ENV: ".circleci/bash_env.sh" | ||
macos: | ||
xcode: '9.0' | ||
steps: | ||
- checkout | ||
- run: echo 'export PATH=${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin' >> $BASH_ENV | ||
- restore_cache: | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
- run: | ||
name: Install nvm and node | ||
command: | | ||
set +e | ||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash | ||
source ~/.nvm/nvm.sh | ||
nvm install v8.2.1 | ||
nvm alias default v8.2.1 | ||
- run: node -v | ||
- run: curl -o- -L https://yarnpkg.com/install.sh | bash | ||
- run: yarn config set cache-folder ~/.cache/yarn | ||
- run: yarn --frozen-lockfile | ||
- save_cache: | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
paths: | ||
- ~/.cache/yarn | ||
- ./node_modules | ||
# Test | ||
- run: yarn lint | ||
- run: yarn test | ||
# Package | ||
- run: yarn package |
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 +1 @@ | ||
7.9.0 | ||
8.2.1 |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
/* | ||
* == BSD2 LICENSE == | ||
* Copyright (c) 2014-2016, Tidepool Project | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the associated License, which is identical to the BSD 2-Clause | ||
* License as published by the Open Source Initiative at opensource.org. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the License for more details. | ||
* | ||
* You should have received a copy of the License along with this program; if | ||
* not, you can obtain one from Tidepool Project at tidepool.org. | ||
* == BSD2 LICENSE == | ||
*/ | ||
|
||
import _ from 'lodash'; | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { bindActionCreators } from 'redux'; | ||
import sundial from 'sundial'; | ||
|
||
import { sync as syncActions } from '../actions/'; | ||
|
||
import styles from '../../styles/components/DeviceTimeModal.module.less'; | ||
|
||
export class DeviceTimeModal extends Component { | ||
determineDeviceType = () => { | ||
const { showingDeviceTimePrompt } = this.props; | ||
const { deviceTags } = showingDeviceTimePrompt.cfg; | ||
if(_.indexOf(deviceTags, 'insulin-pump') !== -1){ | ||
return 'insulin-pump'; | ||
} | ||
if(_.indexOf(deviceTags, 'cgm') !== -1){ | ||
return 'cgm'; | ||
} | ||
if(_.indexOf(deviceTags, 'bgm') !== -1){ | ||
return 'bgm'; | ||
} | ||
return 'unknown'; | ||
} | ||
|
||
isAnimas = () => { | ||
const { showingDeviceTimePrompt } = this.props; | ||
const {deviceInfo} = showingDeviceTimePrompt.cfg; | ||
return deviceInfo && deviceInfo.driverId && deviceInfo.driverId === 'Animas'; | ||
} | ||
|
||
handleContinue = () => { | ||
const { sync, showingDeviceTimePrompt } = this.props; | ||
showingDeviceTimePrompt.callback(null); | ||
sync.dismissedDeviceTimePromp(); | ||
} | ||
|
||
handleCancel = () => { | ||
const { sync, showingDeviceTimePrompt } = this.props; | ||
showingDeviceTimePrompt.callback('deviceTimePromptClose'); | ||
sync.dismissedDeviceTimePromp(); | ||
} | ||
|
||
getActions = () => { | ||
const buttons = []; | ||
if ( !this.isAnimas() ) { | ||
buttons.push( | ||
<button key='continue' className={styles.buttonSecondary} onClick={this.handleContinue}> | ||
Upload anyway | ||
</button>, | ||
); | ||
} | ||
buttons.push( | ||
<button key='cancel' className={styles.button} onClick={this.handleCancel}> | ||
Cancel this upload | ||
</button> | ||
); | ||
|
||
return buttons; | ||
} | ||
|
||
getMessage = () => { | ||
const type = this.determineDeviceType(); | ||
let message; | ||
switch (type) { | ||
case 'insulin-pump': | ||
message = ( | ||
<div className={styles.text}> | ||
<div className={styles.body}> | ||
Is your pump time set correctly? If not: | ||
<br/> | ||
<div><span className={styles.numeral}>1.</span> Cancel the current upload</div> | ||
<div><span className={styles.numeral}>2.</span> Check the time on your device</div> | ||
<div><span className={styles.numeral}>3.</span> Check the time zone in the Uploader</div> | ||
</div> | ||
</div> | ||
); | ||
break; | ||
case 'cgm': | ||
message = ( | ||
<div className={styles.text}> | ||
<div className={styles.body}> | ||
Is your CGM time set correctly? If not: | ||
<br/> | ||
<div><span className={styles.numeral}>1.</span> Cancel the current upload</div> | ||
<div><span className={styles.numeral}>2.</span> Check the time on your device</div> | ||
<div><span className={styles.numeral}>3.</span> Check the time zone in the Uploader</div> | ||
</div> | ||
</div> | ||
); | ||
break; | ||
case 'bgm': | ||
message = ( | ||
<div className={styles.text}> | ||
<div className={styles.body}> | ||
Is your meter time set correctly? If not: | ||
<br/> | ||
<div><span className={styles.numeral}>1.</span> Cancel the current upload</div> | ||
<div><span className={styles.numeral}>2.</span> Check the time on your device</div> | ||
<div><span className={styles.numeral}>3.</span> Check the time zone in the Uploader</div> | ||
</div> | ||
</div> | ||
); | ||
break; | ||
default: | ||
break; | ||
} | ||
return message; | ||
} | ||
|
||
getTitle = () => { | ||
const type = this.determineDeviceType(); | ||
let title; | ||
switch (type) { | ||
case 'insulin-pump': | ||
title = 'Your pump doesn\'t appear to be in'; | ||
break; | ||
case 'cgm': | ||
title = 'Your CGM doesn\'t appear to be in'; | ||
break; | ||
case 'bgm': | ||
title = 'Your meter doesn\'t appear to be in'; | ||
break; | ||
default: | ||
break; | ||
} | ||
return title; | ||
} | ||
|
||
render() { | ||
const { showingDeviceTimePrompt } = this.props; | ||
|
||
if(!showingDeviceTimePrompt){ | ||
return null; | ||
} | ||
|
||
const { showingDeviceTimePrompt: { cfg: { timezone }, times: { serverTime, deviceTime } } } = this.props; | ||
|
||
const title = this.getTitle(); | ||
const message = this.getMessage(); | ||
const actions = this.getActions(); | ||
|
||
return ( | ||
<div className={styles.modalWrap}> | ||
<div className={styles.modal}> | ||
<div className={styles.title}> | ||
<div>{title}</div> | ||
<div className={styles.highlight}>{`${timezone}:`}</div> | ||
</div> | ||
<hr className={styles.hr} /> | ||
<div className={styles.text}> | ||
<div className={styles.timeCompare}> | ||
<div>{timezone}:</div> | ||
<div className={styles.highlight}>{sundial.formatInTimezone(serverTime, timezone, 'h:mm a')}</div> | ||
</div> | ||
<div className={styles.timeCompare}> | ||
<div>Device time:</div> | ||
<div className={styles.highlight}>{sundial.formatInTimezone(deviceTime, timezone, 'h:mm a')}</div> | ||
</div> | ||
</div> | ||
<hr className={styles.hr} /> | ||
{message} | ||
<div className={styles.actions}> | ||
{actions} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default connect( | ||
(state, ownProps) => { | ||
return { | ||
showingDeviceTimePrompt: state.showingDeviceTimePrompt | ||
}; | ||
}, | ||
(dispatch) => { | ||
return { | ||
sync: bindActionCreators(syncActions, dispatch) | ||
}; | ||
} | ||
)(DeviceTimeModal); |
Oops, something went wrong.