Skip to content

Commit

Permalink
Add AZMs (Active Zone Minutes) dataline (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhartley authored Jun 16, 2022
1 parent 847a966 commit 49dfd6c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 deletions.
26 changes: 26 additions & 0 deletions app/datalines/azms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { me } from 'appbit';
import clock from 'clock';
import { today } from 'user-activity';

import Dataline from './Dataline';
import { swapClass } from '../utils';

export default new Dataline({
name: 'AZMS',
checkPermissions() {
return me.permissions.granted('access_activity');
},
updateValue() {
const raw = today.adjusted.activeZoneMinutes.total || 0;
const unit = `minute${raw === 1 ? '' : 's'}`;

this.valueRef.text = `${raw} ${unit}`;
swapClass(this.valueRef.root, 'color', 'magenta');
},
start() {
clock.addEventListener('tick', this.updateValue);
},
stop() {
clock.removeEventListener('tick', this.updateValue);
},
});
3 changes: 2 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import DIST from './datalines/distance';
import LVLS from './datalines/levels';
import HRRT from './datalines/heartrate';
import CALS from './datalines/calories';
import AZMS from './datalines/azms';
import { swapClass } from './utils';

// Set our clock granularity to seconds to update lines.
Expand All @@ -38,7 +39,7 @@ const host = String(device.modelName)



const allDatalines = { TIME, DATE, BATT, STEP, DIST, LVLS, HRRT, CALS };
const allDatalines = { TIME, DATE, BATT, STEP, DIST, LVLS, HRRT, CALS, AZMS };

let updatePromptLine;

Expand Down
1 change: 1 addition & 0 deletions common/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const DATA_LINE_MAP = {
DIST: 'Distance',
HRRT: 'Heart rate',
CALS: 'Calories burned',
AZMS: 'Active Zone Minutes',
};

const getDatalineObjectByValue = (value) => {
Expand Down
35 changes: 16 additions & 19 deletions resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ svg.theme__DEFAULT {
fill: #ffaa00;
}
.theme__DEFAULT.color__purple {
fill: #aa00aa;
fill: #c420c4;
}
.theme__DEFAULT.color__red {
fill: #ff3333;
}
.theme__DEFAULT.color__magenta {
fill: #ff66aa;
}


svg.theme__DRACULA {
Expand All @@ -44,92 +47,86 @@ svg.theme__DRACULA {
.theme__DRACULA.color__red {
fill: #ff5555;
}
.theme__DRACULA.color__magenta {
fill: #FF79C6;
}


svg.theme__HOPSCOTCH {
viewport-fill: #322931;
fill: #d5d3d5;
}

#Labels.theme__HOPSCOTCH {
fill: #797379;
}

.theme__HOPSCOTCH.color__cyan {
fill: #1290bf;
}

.theme__HOPSCOTCH.color__green {
fill: #8fc13e;
}

.theme__HOPSCOTCH.color__orange {
fill: #fd8b19;
}

.theme__HOPSCOTCH.color__purple {
fill: #c85e7c;
}

.theme__HOPSCOTCH.color__red {
fill: #dd464c;
}
.theme__HOPSCOTCH.color__magenta {
fill: #149b93; /* Okay, not magenta but at least unique */
}

svg.theme__SOLARIZED_DARK {
viewport-fill: #002b36;
fill: #657b83;
}

#Labels.theme__SOLARIZED_DARK {
fill: #839496;
}

.theme__SOLARIZED_DARK.color__cyan {
fill: #2aa198;
}

.theme__SOLARIZED_DARK.color__green {
fill: #859900;
}

.theme__SOLARIZED_DARK.color__orange {
fill: #cb4b16;
}

.theme__SOLARIZED_DARK.color__purple {
fill: #6c71c4;
}

.theme__SOLARIZED_DARK.color__red {
fill: #dc322f;
}
.theme__SOLARIZED_DARK.color__magenta {
fill: #d33682;
}


svg.theme__SOLARIZED_LIGHT {
viewport-fill: #eee8d5;
fill: #657b83;
}

#Labels.theme__SOLARIZED_LIGHT {
fill: #586e75;
}

.theme__SOLARIZED_LIGHT.color__cyan {
fill: #2aa198;
}

.theme__SOLARIZED_LIGHT.color__green {
fill: #859900;
}

.theme__SOLARIZED_LIGHT.color__orange {
fill: #cb4b16;
}

.theme__SOLARIZED_LIGHT.color__purple {
fill: #6c71c4;
}

.theme__SOLARIZED_LIGHT.color__red {
fill: #dc322f;
}
.theme__SOLARIZED_LIGHT.color__magenta {
fill: #d33682;
}

0 comments on commit 49dfd6c

Please sign in to comment.