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

πŸ“ˆ πŸ‘” βœ… Dashboard rewrite (complete) + profile logic improvements + initial testing framework! #1046

Merged
merged 179 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
b9385e6
Initial commit, added chart
ctyrrellnrel Jul 12, 2023
26fe4f9
Added two new components
ctyrrellnrel Jul 12, 2023
c05e071
Added view state to MetricsCard
ctyrrellnrel Jul 12, 2023
011b858
Added button to switch between components
ctyrrellnrel Jul 12, 2023
e36ba87
Added button and styling to MetricsCard
ctyrrellnrel Jul 12, 2023
4440e1d
Removing unnecessary code
ctyrrellnrel Jul 13, 2023
5ca9754
Added MetricsCard module to metrics.js
ctyrrellnrel Jul 19, 2023
f3af351
Merge branch 'aria_and_fall_2023_rewrite' of https://github.com/e-mis…
JGreenlee Aug 21, 2023
cb4c65c
remove unneeded code from old PR
JGreenlee Aug 21, 2023
ef8ce3c
move MetricDetails and MetricsCard to js/metrics
JGreenlee Aug 21, 2023
1bd3b62
use new MetricsTab instead of main-metrics
JGreenlee Aug 22, 2023
c24da18
new MetricsTab
JGreenlee Aug 22, 2023
7473855
add typings for metric data
JGreenlee Aug 22, 2023
8753162
reformat MetricsCard to work with new MetricsTab
JGreenlee Aug 22, 2023
12d17ce
fill out MetricDetails
JGreenlee Aug 22, 2023
52854c0
implement datepicker + agg metrics on new dashboard
JGreenlee Aug 23, 2023
5ebced8
adjust padding in MetricsCard
JGreenlee Aug 23, 2023
f32609e
MetricsCard fix typing of Props
JGreenlee Aug 23, 2023
470b4e0
add ActiveMinutesCard to new dashboard
JGreenlee Aug 23, 2023
f93ba1e
rename UserMetrics type to MetricsData
JGreenlee Aug 23, 2023
6026918
add @types/react to devDependencies
JGreenlee Aug 23, 2023
eb60ad5
refactor & memoize seconds to minutes calculation
JGreenlee Aug 23, 2023
18eafef
unify MetricDetails and MetricsCard
JGreenlee Aug 23, 2023
db06256
delete MetricDetails.tsx
JGreenlee Aug 23, 2023
9f46973
Merge branch 'aria_and_fall_2023_rewrite' of https://github.com/e-mis…
JGreenlee Aug 23, 2023
cf4f0e6
generalize format functions in useImperialConfig
JGreenlee Aug 24, 2023
964da4b
fix formatForDisplay
JGreenlee Aug 24, 2023
c417879
show units correctly on MetricsCards
JGreenlee Aug 24, 2023
7a3a6c6
support aggregate metrics on MetricsCard
JGreenlee Aug 24, 2023
b04aab7
fix MetricsCard not always updating details view
JGreenlee Aug 24, 2023
b6dfb4f
fix vertical scrolling on new Dashboard tab
JGreenlee Aug 24, 2023
d0763cd
use i18n for ActiveMinutesCard
JGreenlee Aug 24, 2023
d074cab
update BarChart for categorical data & flat inputs
JGreenlee Aug 24, 2023
6780dae
in MetricsCard, pass records to BarChart
JGreenlee Aug 24, 2023
4e7b054
styling tweaks and refactoring
JGreenlee Aug 24, 2023
8f8d229
add chart to ActiveMinutesCard
JGreenlee Aug 25, 2023
4aa123a
begin Carbon Footprint card
Aug 26, 2023
db5c005
BarChart: support stacked bars
JGreenlee Aug 28, 2023
23a479c
show date ranges for weeks on ActiveMinutesCard
JGreenlee Aug 28, 2023
c480d67
readable labels on new dashboard
JGreenlee Aug 28, 2023
9e40252
fix axis units on MetricsCard
JGreenlee Aug 28, 2023
fde2283
refactor new dashboard into Carousel
JGreenlee Aug 28, 2023
167e3d1
refactoring metrics card styles
JGreenlee Aug 28, 2023
76ebb17
more user metrics
Aug 28, 2023
8972b51
add percent change to carbon card
Aug 28, 2023
9c8e884
rough draft carbon chart
Aug 28, 2023
8839613
comment out "average speed" card
JGreenlee Aug 28, 2023
7643895
dashboard: initial load 15 days ago to yesterday
JGreenlee Aug 28, 2023
35cd467
add carbon goal lines
Aug 28, 2023
0fa637d
move %change to Card Title
Aug 29, 2023
f4179f3
flip bar chart to horizonal
Aug 29, 2023
3d0c910
clean up CarbonFootprintCard
Aug 29, 2023
c93961b
support split-line labels in horizontal BarChart
Aug 29, 2023
9e8aebc
i18n for CarbonFootprintCard
Aug 29, 2023
5aad944
add group metrics to chart
Aug 29, 2023
e6370c0
adjust styling of ChangeIdicator
Aug 29, 2023
258721c
prevent double negative
Aug 30, 2023
8151d7f
fix time ticks
Aug 30, 2023
4c44a00
patches to % change
Aug 30, 2023
8cc6d7f
eliminate create range function
Aug 30, 2023
9b128b7
show certain/uncertain and goal lines
Aug 30, 2023
8fc1c65
make ToggleSwitch more generic
JGreenlee Aug 31, 2023
c468478
move ToggleSwitch to /js/components
JGreenlee Aug 31, 2023
29a0ab1
match ToggleSwitch props to SegmentedButtonProps
JGreenlee Aug 31, 2023
d2a8dc5
revert extra functions in metricsHelper.ts
JGreenlee Aug 31, 2023
d9f478b
ActiveMinutesCard -> WeeklyActiveMinutesCard
JGreenlee Aug 31, 2023
4613f80
describe active minutes at bottom of card
JGreenlee Aug 31, 2023
8a605e0
add LineChart.tsx
JGreenlee Aug 31, 2023
2aea2e5
add DailyActiveMinutesCard to MetricsTab
JGreenlee Aug 31, 2023
691c206
BarChart: support positioning of lineAnnotations
JGreenlee Aug 31, 2023
41ba903
add weekly minutes goal, fix lone "0"
JGreenlee Aug 31, 2023
20b457a
allow gaps in daily active minutes line chart
JGreenlee Aug 31, 2023
6504bae
Merge remote-tracking branch 'origin/dashboard-rewrite' into dashboar…
Aug 31, 2023
bcc1010
color meter chart
Aug 31, 2023
71adf57
darken the guideline lines
Aug 31, 2023
950b163
forgotten color import
Aug 31, 2023
09d4711
add footnote
Aug 31, 2023
a9b311a
refactor BarChart
JGreenlee Sep 1, 2023
d48d333
Merge branch 'label_dashboard_profile_sept_2023' into dashboard-rewrite
JGreenlee Sep 5, 2023
0f4a4e9
add text to Carbon Card
Sep 5, 2023
15ed685
move carbon footprint text to dedicated card
Sep 6, 2023
1c3b532
shorten carbon chart labels
Sep 6, 2023
b377933
bars colored by mode
Sep 6, 2023
e2b6b99
remove extraneous commented code
JGreenlee Sep 7, 2023
4143bf0
refactor makeColorMap
JGreenlee Sep 7, 2023
e0c7d82
refactor modeColors
JGreenlee Sep 7, 2023
40a9b5e
slim the Carousel card margins
JGreenlee Sep 7, 2023
96ee1c6
decrease Y axis font size on BarChart
JGreenlee Sep 7, 2023
3335086
format CarbonTextCard as rows
JGreenlee Sep 7, 2023
50c5292
fix warnings in MetricsCard
JGreenlee Sep 7, 2023
3cb062a
remove colons from carbon categories
JGreenlee Sep 7, 2023
aad133e
style US decarbonization goals text as footnote
JGreenlee Sep 7, 2023
3ef6860
add footnote for "Unlabeled" uncertainty
JGreenlee Sep 7, 2023
ac59d00
make Carousel cards slightly wider
JGreenlee Sep 7, 2023
9976516
fix previous week bar value
Sep 7, 2023
e4cadd2
adjust color-by-mode on dashboard
JGreenlee Sep 8, 2023
4c1e967
Merge branch 'label_dashboard_profile_sept_2023' of https://github.co…
JGreenlee Sep 9, 2023
44d3185
refactor: rename BarChart to Chart
JGreenlee Sep 11, 2023
25a5f5a
big refactor of BarChart & LineChart
JGreenlee Sep 11, 2023
83aa958
add base mode colors to DailyActiveMinutesCard
JGreenlee Sep 11, 2023
c240f79
convert the log page to React
Sep 11, 2023
7f73823
add subtitles to all dashboard cards
JGreenlee Sep 12, 2023
ca8edbe
change "Co2" to "COβ‚‚"
JGreenlee Sep 12, 2023
6a353f8
fix name of CarbonTextCard
JGreenlee Sep 12, 2023
62ea9f4
add ActiveMinutesTableCard
JGreenlee Sep 12, 2023
17f401c
remove the old Dashboard tab
JGreenlee Sep 12, 2023
ef6ba26
Merge remote-tracking branch 'upstream/label_dashboard_profile_sept_2…
Sep 12, 2023
8ebc390
implement refresh() on MetricsTab
JGreenlee Sep 12, 2023
89e3d64
add CDC recommendations footnote
JGreenlee Sep 12, 2023
06f7b2d
i18n + add footnote markers on CarbonTextCard
JGreenlee Sep 12, 2023
72f6437
remove fake data that was used for testing
JGreenlee Sep 12, 2023
9208ec0
dashboard: use rich mode text, not readable label
JGreenlee Sep 12, 2023
7dbc343
remove old dashboard library nvd3
JGreenlee Sep 12, 2023
c8ceafe
refactor dialogStyle and create Action Menu
Sep 12, 2023
b682e53
ActionMenu title
Sep 12, 2023
7d2b9dc
make space for annotation at top of chart
JGreenlee Sep 12, 2023
5fcc5d4
fix footprint calculations using baseModes
JGreenlee Sep 12, 2023
7e55e83
add SensedPage, fix scrolling
Sep 12, 2023
4c430d2
take out old code
Sep 12, 2023
7d0eb81
adjust ChangeIndicator colors and text
JGreenlee Sep 12, 2023
f1f9b57
update log page to load more
Sep 12, 2023
e21cb6e
load on enter
Sep 12, 2023
92ad2ee
fix dateRange issue
JGreenlee Sep 12, 2023
496b353
refactor .then() to try/catch
Sep 12, 2023
fe44ae6
resolve error
Sep 12, 2023
e50f0a1
remove infiniteScrollComplete broadcasts
Sep 12, 2023
fd32aee
fix sensed formatting
Sep 12, 2023
d20bf2e
i18n for ui strings
Sep 13, 2023
f132056
remove old functions
Sep 13, 2023
723c5e7
factor out "Locations" and "Motion Type"
Sep 13, 2023
d04d5ee
combine dev-errors into errors
Sep 13, 2023
a3b0c08
show Unlabeled as faint grey, last item in legend
JGreenlee Sep 14, 2023
b9e1416
re-order "Prev. week" before "Past week", refactor
JGreenlee Sep 14, 2023
0ecfa58
tweak ChangeIndicator style
JGreenlee Sep 14, 2023
54e6d8b
fix error sometimes if metrics is not defined yet
JGreenlee Sep 14, 2023
907737b
add 'meter' gradients to carbon graph
JGreenlee Sep 14, 2023
a3264e2
adjust carbon meter gradient
JGreenlee Sep 14, 2023
67111b8
refactor: remove darkenForBorder + fix
JGreenlee Sep 14, 2023
5e7a50c
React Control Helpers
Sep 14, 2023
9255675
fix medium accuracy
Sep 14, 2023
1b8a43c
remove update complete listeners
Sep 14, 2023
9078488
eliminate settingsScope
Sep 14, 2023
e02db4a
remove "safeToggle"
Sep 14, 2023
d55760f
prevent "missing argument errors"
Sep 14, 2023
2cb1145
remove safe toggle code
Sep 14, 2023
1189700
isolate forceSync code to ControlSyncHelper
Sep 14, 2023
df78758
don't store a duplicate copy of the collectConfig
Sep 14, 2023
fe2dd55
fix segmentDaysByWeeks
JGreenlee Sep 15, 2023
f57603c
use custom labels
Sep 15, 2023
f9822c5
Merge branch 'dashboard-rewrite' of https://github.com/JGreenlee/e-mi…
Sep 15, 2023
388b5d7
carbon chart: fix border of green, 'low' emissions
JGreenlee Sep 15, 2023
44753f6
add slight borderRadius to Charts
JGreenlee Sep 15, 2023
9cad0ee
reorder goal lines + adjust colors
JGreenlee Sep 15, 2023
c2c656c
fix group text
Sep 15, 2023
dd126a7
only show metrics for whole weeks
Sep 15, 2023
1551eee
move functions into helpers
Sep 15, 2023
1cfb190
restore log statement
Sep 15, 2023
f012973
fetch DB before updating
Sep 15, 2023
c46e2dc
move sync rows to devZone
Sep 18, 2023
7f8ff42
move from .then to await
Sep 18, 2023
2876872
endTripForceSync using await
Sep 18, 2023
de20d3b
"taxi" -> "worst case"
Sep 18, 2023
8f5fb89
remove calorie keys
Sep 18, 2023
edd8624
Merge remote-tracking branch 'upstream/label_dashboard_profile_sept_2…
Sep 19, 2023
ab26e18
Merge branch 'onboarding_routing_sept_2023' into dashboard-rewrite
JGreenlee Sep 25, 2023
e93059f
Merge pull request #1029 from Abby-Wheelis/unblock-routing
shankari Sep 25, 2023
da20511
Merge branch 'dashboard-rewrite' of https://github.com/JGreenlee/e-mi…
Sep 25, 2023
4cc97db
Merge upstream, resolved main.js
Sep 25, 2023
8c6bdb2
update comments about prev vs past week
Sep 25, 2023
752674b
not >= 7 day weeks, == 7 day weeks
Sep 25, 2023
bb4fdd0
update infinity behavior on changeIndicator
Sep 25, 2023
87b3456
Merge pull request #1018 from JGreenlee/dashboard-rewrite
shankari Sep 26, 2023
00d808d
register all ChartJS elements as workaround
JGreenlee Sep 27, 2023
c190794
Merge pull request #1039 from JGreenlee/chartjs-register-workaround
shankari Sep 27, 2023
8b6c316
fix: handle undetermined state of appstatus checks
JGreenlee Sep 28, 2023
8e061a0
fix blank checkList problem
Sep 28, 2023
faaeda6
export modeColors so it can be used in tests
JGreenlee Sep 28, 2023
e5b2834
fix toggle issue - remove cch
Sep 28, 2023
0f7caef
Merge pull request #1041 from JGreenlee/fix-appstatus-checks
shankari Sep 28, 2023
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
2 changes: 0 additions & 2 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@
"angular": "1.6.7",
"angular-animate": "1.6.7",
"angular-local-storage": "^0.7.1",
"angular-nvd3": "^1.0.7",
"angular-sanitize": "1.6.7",
"angular-simple-logger": "^0.1.7",
"angular-translate": "^2.18.1",
Expand Down Expand Up @@ -158,7 +157,6 @@
"moment-timezone": "^0.5.43",
"ng-i18next": "^1.0.7",
"npm": "^9.6.3",
"nvd3": "^1.8.6",
"phonegap-plugin-barcodescanner": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner#v8.1.0",
"prop-types": "^15.8.1",
"react": "^18.2.*",
Expand Down
2 changes: 0 additions & 2 deletions package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"angular": "1.6.7",
"angular-animate": "1.6.7",
"angular-local-storage": "^0.7.1",
"angular-nvd3": "^1.0.7",
"angular-sanitize": "1.6.7",
"angular-simple-logger": "^0.1.7",
"angular-translate": "^2.18.1",
Expand Down Expand Up @@ -83,7 +82,6 @@
"moment-timezone": "^0.5.43",
"ng-i18next": "^1.0.7",
"npm": "^9.6.3",
"nvd3": "^1.8.6",
"prop-types": "^15.8.1",
"react": "^18.2.*",
"react-chartjs-2": "^5.2.0",
Expand Down
12 changes: 0 additions & 12 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
max-height: 50px;
}

/* nvd3 styles */
@import 'nvd3/build/nv.d3.css';

.fill-container {
display: block;
position: relative;
Expand Down Expand Up @@ -746,15 +743,6 @@ timestamp-badge[light-bg] {
padding: 5% 10%;
}

svg {
display: block;
}
#chart, #chart svg {
margin-right: 10px;
}
.nvd3, nv-noData {
font-weight: 300 !important;
}
.metric-datepicker {
/*height: 33px;*/
display: flex; /* establish flex container */
Expand Down
55 changes: 31 additions & 24 deletions www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"nuke-all": "Nuke all buffers and cache",
"test-notification": "Test local notification",
"check-log": "Check log",
"log-title" : "Log",
"check-sensed-data": "Check sensed data",
"sensed-title": "Sensed Data: Transitions",
"collection": "Collection",
"sync": "Sync",
"button-accept": "I accept",
Expand Down Expand Up @@ -101,9 +103,11 @@
"less-than": " less than ",
"less": " less ",
"week-before": "vs. week before",
"this-week": "this week",
"pick-a-date": "Pick a date",
"trips": "trips",
"hours": "hours",
"minutes": "minutes",
"custom": "Custom"
},

Expand Down Expand Up @@ -140,42 +144,43 @@
"no-travel-hint": "To see more, change the filters above or go record some travel!"
},

"user-gender": "Gender",
"gender-male": "Male",
"gender-female": "Female",
"user-height": "Height",
"user-weight": "Weight",
"user-age": "Age",

"main-metrics":{
"dashboard": "Dashboard",
"summary": "My Summary",
"chart": "Chart",
"change-data": "Change dates:",
"distance": "My Distance",
"trips": "My Trips",
"duration": "My Duration",
"distance": "Distance",
"trips": "Trips",
"duration": "Duration",
"fav-mode": "My Favorite Mode",
"speed": "My Speed",
"footprint": "My Footprint",
"estimated-emissions": "Estimated COβ‚‚ emissions",
"how-it-compares": "Ballpark comparisons",
"optimal": "Optimal (perfect mode choice for all my trips):",
"average": "Average for group:",
"avoided": "COβ‚‚ avoided (vs. all 'taxi'):",
"optimal": "Optimal (perfect mode choice for all my trips)",
"average": "Group Avg.",
"worst-case": "Worse Case",
"label-to-squish": "Label trips to collapse the range into a single number",
"range-uncertain-footnote": "Β²Due to the uncertainty of unlabeled trips, estimates may fall anywhere within the shown range. Label more trips for richer estimates.",
"lastweek": "My last week value:",
"us-2030-goal": "US 2030 Goal Estimate:",
"us-2050-goal": "US 2050 Goal Estimate:",
"calories": "My Calories",
"calibrate": "Calibrate",
"us-2030-goal": "2030 GuidelineΒΉ",
"us-2050-goal": "2050 GuidelineΒΉ",
"us-goals-footnote": "ΒΉGuidelines based on US decarbonization goals, scaled to per-capita travel-related emissions.",
"past-week" : "Past Week",
"prev-week" : "Prev. Week",
"no-summary-data": "No summary data",
"mean-speed": "My Average Speed",
"equals-cookies_one": "Equals at least {{count}} homemade chocolate chip cookie",
"equals-cookies_other": "Equals at least {{count}} homemade chocolate chip cookies",
"equals-icecream_one": "Equals at least {{count}} half cup vanilla ice cream",
"equals-icecream_other": "Equals at least {{count}} half cups vanilla ice cream",
"equals-bananas_one": "Equals at least {{count}} banana",
"equals-bananas_other": "Equals at least {{count}} bananas"
"user-totals": "My Totals",
"group-totals": "Group Totals",
"active-minutes": "Active Minutes",
"weekly-active-minutes": "Weekly minutes of active travel",
"daily-active-minutes": "Daily minutes of active travel",
"active-minutes-table": "Table of active minutes metrics",
"weekly-goal": "Weekly GoalΒ³",
"weekly-goal-footnote": "Β³Weekly goal based on CDC recommendation of 150 minutes of moderate activity per week.",
"labeled": "Labeled",
"unlabeled": "UnlabeledΒ²",
"footprint-label": "Footprint (kg COβ‚‚)"
},

"main-inf-scroll" : {
Expand Down Expand Up @@ -360,7 +365,9 @@
"errors": {
"while-populating-composite": "Error while populating composite trips",
"while-loading-another-week": "Error while loading travel of {{when}} week",
"while-loading-specific-week": "Error while loading travel for the week of {{day}}"
"while-loading-specific-week": "Error while loading travel for the week of {{day}}",
"while-log-messages": "While getting messages from the log ",
"while-max-index" : "While getting max index "
},
"consent-text": {
"title":"NREL OPENPATH PRIVACY POLICY/TERMS OF USE",
Expand Down
2 changes: 0 additions & 2 deletions www/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import './js/survey/input-matcher.js';
import './js/survey/multilabel/infinite_scroll_filters.js';
import './js/survey/multilabel/multi-label-ui.js';
import './js/diary.js';
import './js/recent.js';
import './js/diary/services.js';
import './js/survey/external/launch.js';
import './js/survey/enketo/answer.js';
Expand All @@ -40,7 +39,6 @@ import './js/survey/enketo/infinite_scroll_filters.js';
import './js/survey/enketo/enketo-trip-button.js';
import './js/survey/enketo/enketo-demographics.js';
import './js/survey/enketo/enketo-add-note-button.js';
import './js/metrics.js';
import './js/control/general-settings.js';
import './js/control/emailService.js';
import './js/control/uploadService.js';
Expand Down
3 changes: 2 additions & 1 deletion www/js/appTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const AppTheme = {
level4: '#e0f0ff', // lch(94% 50 250)
level5: '#d6ebff', // lch(92% 50 250)
},
success: '#38872e', // lch(50% 55 135)
success: '#00a665', // lch(60% 55 155)
warn: '#f8cf53', //lch(85% 65 85)
danger: '#f23934' // lch(55% 85 35)
},
roundness: 5,
Expand Down
41 changes: 41 additions & 0 deletions www/js/components/ActionMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react";
import { Modal } from "react-native";
import { Dialog, Button, useTheme } from "react-native-paper";
import { useTranslation } from "react-i18next";
import { settingStyles } from "../control/ProfileSettings";

const ActionMenu = ({vis, setVis, title, actionSet, onAction, onExit}) => {

const { t } = useTranslation();
const { colors } = useTheme();

return (
<Modal visible={vis} onDismiss={() => setVis(false)}
transparent={true}>
<Dialog visible={vis}
onDismiss={() => setVis(false)}
style={settingStyles.dialog(colors.elevation.level3)}>
<Dialog.Title>{title}</Dialog.Title>
<Dialog.Content>
{actionSet?.map((e) =>
<Button key={e.text}
onPress={() => {
onAction(e);
setVis(false);
}}>
{e.text}
</Button>
)}
</Dialog.Content>
<Dialog.Actions>
<Button onPress={() => {setVis(false);
onExit();}}>{
t('general-settings.cancel')}
</Button>
</Dialog.Actions>
</Dialog>
</Modal>
)
}

export default ActionMenu;
Loading
Loading