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

Make the Dashboard tab configurable, and implement new components #1142

Merged
merged 60 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
946758a
show metrics tab if phone_dashboard_ui is set in app config
JGreenlee Apr 3, 2024
d3034eb
show/hide sections in MetricsTab based on config
JGreenlee Apr 3, 2024
5130653
show/hide unlabeled metrics based on config
jiji14 Apr 4, 2024
16edaf2
set the active modes based on config (active_travel_options.modes_list)
jiji14 Apr 5, 2024
b17ffb7
set summary list based on config (summary_options.metrics_list)
jiji14 Apr 5, 2024
21adb20
Merge branch 'refactoring_timelinecontext' of https://github.com/JGre…
JGreenlee Apr 12, 2024
84f8a51
Merge remote-tracking branch 'other/refactoring_timelinecontext' into…
jiji14 Apr 18, 2024
b95c268
show uncertain-footnote only when to show the uncertainty
jiji14 Apr 19, 2024
57d2298
rendering surveys Card components dynamically
jiji14 Apr 19, 2024
18e99bb
Surveys Cards components UI done
jiji14 Apr 19, 2024
2281c7e
Chart UI fix
jiji14 Apr 25, 2024
c38c353
update TimelineScrollList only when the active tab is 'label'
jiji14 Apr 26, 2024
1f7a692
add getSurveyMetric API endpoint
jiji14 May 4, 2024
58cfb5f
get new survey data every 24 hours
jiji14 May 4, 2024
8150e95
delete dummy data and process survey data from server
jiji14 May 5, 2024
ed52e0f
Merge branch 'refactoring_timelinecontext' of https://github.com/JGre…
JGreenlee May 13, 2024
d68354e
Delete the getSurveyMetric API call from the server logic alteration
jiji14 May 16, 2024
d4b3f51
Separate 'Survey comparison Card' and 'Leaderboard Card'
jiji14 May 16, 2024
abec657
use the new yyyy_mm_dd endpoint for agg metrics
JGreenlee May 20, 2024
5ab984c
refactor valueForModeOnDay -> valueForFieldOnDay
JGreenlee May 20, 2024
5916fab
display response_count MetricsCard properly
JGreenlee May 20, 2024
ab6fece
include primary_ble_sensed_mode in derived properties
JGreenlee May 20, 2024
c9628e0
support localhost metrics when appConfig does not have 'server'
JGreenlee May 20, 2024
32336ea
add 'metrics.responses' to en.json
JGreenlee May 20, 2024
1d99f59
use real data for SurveyComparisonCard
JGreenlee May 21, 2024
c7fbc25
use real data for SurveyTripCategoriesCard
JGreenlee May 21, 2024
5a8759e
comment out leaderboard; remove dummy data
JGreenlee May 21, 2024
269faed
"metrics list" -> "metric list"
JGreenlee May 21, 2024
cc4d134
show "No data" better when there's nothing to show
JGreenlee May 21, 2024
7e1c536
use e-mission-common @ 0.5.0
JGreenlee May 21, 2024
7510bf1
use semver for e-mission-common dependency
JGreenlee May 23, 2024
2e02fb7
Merge branch 'master' of https://github.com/e-mission/e-mission-phone…
JGreenlee May 23, 2024
f28bc23
fix filters issue on 'additions' configs
JGreenlee May 23, 2024
18089bf
on config refresh, wait for resources to finish caching
JGreenlee May 23, 2024
0642f06
remove response_count from default metric_list
JGreenlee May 23, 2024
e4ba6d0
fix metrics values summing
JGreenlee May 23, 2024
6ff253f
refactor metrics "units" & "format" fns to support response_count charts
JGreenlee May 24, 2024
34a99da
fix incorrect summing of response_count objs
JGreenlee May 24, 2024
f71280f
unify datepickers, loadSpecificWeek -> loadDateRange; simplify
JGreenlee May 24, 2024
637d496
refactor & simplify MetricsTab
JGreenlee May 24, 2024
66bbc62
update metricsTypes
JGreenlee May 24, 2024
6ef2adf
remove dateForDayOfMetricData function
JGreenlee May 24, 2024
bbfbfa1
have MetricValue support type generics to disambiguate number vs object
JGreenlee May 24, 2024
96549b3
use e-mission-common @ 0.5.1
JGreenlee May 24, 2024
114d15e
improve MetricsTab loading
JGreenlee May 24, 2024
cbefbbd
remove unused code from MetricsTab
JGreenlee May 24, 2024
c803973
humanize all caps values for Metrics Tab
JGreenlee May 24, 2024
b3e80df
fix date range picker timezone issue
JGreenlee May 24, 2024
663f86c
update metricsHelper.test.ts to use the unified DayOfMetricData type
JGreenlee May 24, 2024
90b631c
Hide chart when there is no survey data
jiji14 May 25, 2024
a3570d6
type error handling
jiji14 May 25, 2024
084224e
fix checking data logic for surveyComparisonCard
jiji14 May 25, 2024
8cf5fb0
Add maxBarThickness for chart.js
jiji14 May 25, 2024
f55faf1
add more unit tests
jiji14 May 28, 2024
abf2f3f
export functions for tests and fix syntax issue
jiji14 May 28, 2024
66464ca
done unit tests with metricsHelper
jiji14 May 29, 2024
a963381
add useImperialConfig test
jiji14 May 29, 2024
3f08b6c
add getTheme unit test
jiji14 May 29, 2024
1bd1f48
add unit test if Carousel renders children correctly
jiji14 May 29, 2024
e55e5ae
add DateSelect rendering unit test
jiji14 May 30, 2024
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: 1 addition & 1 deletion package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"cordova-custom-config": "^5.1.1",
"cordova-plugin-ibeacon": "git+https://github.com/louisg1337/cordova-plugin-ibeacon.git",
"core-js": "^2.5.7",
"e-mission-common": "git+https://github.com/JGreenlee/e-mission-common.git#0.4.4",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"chartjs-adapter-luxon": "^1.3.1",
"chartjs-plugin-annotation": "^3.0.1",
"core-js": "^2.5.7",
"e-mission-common": "git+https://github.com/JGreenlee/e-mission-common.git#0.4.4",
"e-mission-common": "github:JGreenlee/e-mission-common#semver:0.5.1",
"enketo-core": "^6.1.7",
"enketo-transformer": "^4.0.0",
"fast-xml-parser": "^4.2.2",
Expand Down
26 changes: 26 additions & 0 deletions www/__tests__/Carousel.test.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is a basic test, but it is really very basic, almost so basic as to be useless. I would assume that we at least try to click on the button and check that the views move.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { render } from '@testing-library/react-native';
import { View } from 'react-native';
import Carousel from '../js/components/Carousel';

describe('Carousel component', () => {
const child1 = <View testID="child1">Child 1</View>;
const child2 = <View testID="child2">Child 2</View>;
const cardWidth = 100;
const cardMargin = 10;

it('renders children correctly', () => {
const { getByTestId } = render(
<Carousel cardWidth={cardWidth} cardMargin={cardMargin}>
{child1}
{child2}
</Carousel>,
);

const renderedChild1 = getByTestId('child1');
const renderedChild2 = getByTestId('child2');

expect(renderedChild1).toBeTruthy();
expect(renderedChild2).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions www/__tests__/DateSelect.test.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto, I would expect that we click on the button and the date select is displayed with the correct date range, and that when the user selects a particular range, it is returned correctly. The key here is not just the button display, but the logic around the clamping IIRC

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { render, screen } from '@testing-library/react-native';
import DateSelect from '../js/diary/list/DateSelect';

jest.mock('react-native-safe-area-context', () => ({
useSafeAreaInsets: () => ({ bottom: 30, left: 0, right: 0, top: 30 }),
}));
jest.spyOn(React, 'useState').mockImplementation((initialValue) => [initialValue, jest.fn()]);
jest.spyOn(React, 'useEffect').mockImplementation((effect: () => void) => effect());

describe('DateSelect', () => {
it('renders correctly', () => {
const onChooseMock = jest.fn();
const { getByText } = render(<DateSelect mode="range" onChoose={onChooseMock} />);

expect(screen.getByTestId('button-container')).toBeTruthy();
expect(screen.getByTestId('button')).toBeTruthy();
});
});
22 changes: 22 additions & 0 deletions www/__tests__/appTheme.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { getTheme } from '../js/appTheme';

describe('getTheme', () => {
it('should return the right theme with place', () => {
const theme = getTheme('place');
expect(theme.colors.elevation.level1).toEqual('#cbe6ff');
});

it('should return the right theme with untracked', () => {
const theme = getTheme('untracked');
expect(theme.colors.primary).toEqual('#8c4a57');
expect(theme.colors.primaryContainer).toEqual('#e3bdc2');
expect(theme.colors.elevation.level1).toEqual('#f8ebec');
});

it('should return the right theme with draft', () => {
const theme = getTheme('draft');
expect(theme.colors.primary).toEqual('#616971');
expect(theme.colors.primaryContainer).toEqual('#b6bcc2');
expect(theme.colors.background).toEqual('#eef1f4');
});
});
Loading
Loading