Skip to content

Commit 03b3edc

Browse files
committed
nitpicks and docs updates
1 parent 0b23a1b commit 03b3edc

File tree

7 files changed

+23
-26
lines changed

7 files changed

+23
-26
lines changed

src/components/settings/NonTandem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const NonTandem = (props) => {
207207
</div>
208208
</div>
209209
<pre className={styles.copyText} id="copySettingsText">
210-
{nonTandemText(pumpSettings, lookupKey, bgUnits)}
210+
{nonTandemText(pumpSettings, bgUnits, lookupKey)}
211211
</pre>
212212
</div>
213213
);

src/components/settings/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To keep our componets as similar when viewed in the web app as when printed. Whe
1111
Based on the mode the component is being viewed in we have a prop that can be used and then the component be shown in a different state. In the settings instance it means showing all the settings sections expanded.
1212

1313
```
14-
printView: React.PropTypes.bool.isRequired
14+
view: PropTypes.oneOf([DISPLAY_VIEW, PRINT_VIEW]).isRequired,
1515
```
1616

1717
*In the css:*
@@ -22,3 +22,13 @@ If there are any specific print styles these are contained in the section below.
2222
....
2323
}
2424
```
25+
26+
27+
### copy text
28+
29+
*Aim:*
30+
To enable the easy copy and pasting of the settings while also allowing the user to modify the table that has been copied. To do this we need to remove all styles and have a very simple text representation of the table while still keeping its basic format.
31+
32+
*In the component:*
33+
We are using `ClipboardButton` and then have built a text representation of the settings that essentially uses a commandline tool `text-table`. This is then embedded in a `<pre>..</pre>` tag as we want to ensure no styles are copied. All of the work is done in `utils\settings\textData.js` to built the table.
34+

src/components/settings/Tandem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const Tandem = (props) => {
101101
{tables}
102102
</div>
103103
<pre className={styles.copyText} id="copySettingsText">
104-
{tandemText(pumpSettings, bgUnits, styles)}
104+
{tandemText(pumpSettings, bgUnits)}
105105
</pre>
106106
</div>
107107
);

src/components/settings/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
* == BSD2 LICENSE ==
1616
*/
1717

18-
export const COPY_VIEW = 'copy';
1918
export const DISPLAY_VIEW = 'display';
2019
export const PRINT_VIEW = 'print';

src/containers/settings/PumpSettingsContainer.css

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

src/containers/settings/PumpSettingsContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { MGDL_UNITS, MMOLL_UNITS } from '../../utils/constants';
2525

2626
import NonTandem from '../../components/settings/NonTandem';
2727
import Tandem from '../../components/settings/Tandem';
28-
import { COPY_VIEW, DISPLAY_VIEW, PRINT_VIEW } from '../../components/settings/constants';
28+
import { DISPLAY_VIEW, PRINT_VIEW } from '../../components/settings/constants';
2929

3030
export class PumpSettingsContainer extends PureComponent {
3131
static propTypes = {
@@ -44,7 +44,7 @@ export class PumpSettingsContainer extends PureComponent {
4444
}).isRequired,
4545
settingsState: PropTypes.object.isRequired,
4646
toggleSettingsSection: PropTypes.func.isRequired,
47-
view: PropTypes.oneOf([COPY_VIEW, DISPLAY_VIEW, PRINT_VIEW]).isRequired,
47+
view: PropTypes.oneOf([DISPLAY_VIEW, PRINT_VIEW]).isRequired,
4848
}
4949

5050
componentWillMount() {

src/utils/settings/textData.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ function buildTextTable(name, rows, columns) {
9595
/**
9696
* nonTandemText
9797
* @param {Object} settings all settings data
98-
* @param {String} manufacturer one of: animas, carelink, insulet, medtronic
9998
* @param {String} units MGDL_UNITS or MMOLL_UNITS
99+
* @param {String} manufacturer one of: animas, carelink, insulet, medtronic
100100
*
101101
* @return {String} non tandem settings as a string table
102102
*/
103-
export function nonTandemText(settings, manufacturer, units) {
103+
export function nonTandemText(settings, units, manufacturer) {
104104
let tablesString = '';
105105
_.map(nonTandemData.basalSchedules(settings), (schedule) => {
106106
const basal = nonTandemData.basal(schedule, settings, manufacturer);
@@ -139,11 +139,15 @@ export function nonTandemText(settings, manufacturer, units) {
139139
* tandemText
140140
* @param {Object} settings all settings data
141141
* @param {String} units MGDL_UNITS or MMOLL_UNITS
142-
* @param {Object} styles styles applied
143142
*
144143
* @return {String} tandem settings as a string table
145144
*/
146-
export function tandemText(settings, units, styles) {
145+
export function tandemText(settings, units) {
146+
const styles = {
147+
bolusSettingsHeader: '',
148+
basalScheduleHeader: '',
149+
};
150+
147151
let tablesString = '';
148152
_.map(tandemData.basalSchedules(settings), (schedule) => {
149153
const basal = tandemData.basal(schedule, settings, units, styles);

0 commit comments

Comments
 (0)