-
Notifications
You must be signed in to change notification settings - Fork 114
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
shankari
merged 60 commits into
e-mission:master
from
jiji14:configurable-app-dashboard
May 31, 2024
Merged
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 d3034eb
show/hide sections in MetricsTab based on config
JGreenlee 5130653
show/hide unlabeled metrics based on config
jiji14 16edaf2
set the active modes based on config (active_travel_options.modes_list)
jiji14 b17ffb7
set summary list based on config (summary_options.metrics_list)
jiji14 21adb20
Merge branch 'refactoring_timelinecontext' of https://github.com/JGre…
JGreenlee 84f8a51
Merge remote-tracking branch 'other/refactoring_timelinecontext' into…
jiji14 b95c268
show uncertain-footnote only when to show the uncertainty
jiji14 57d2298
rendering surveys Card components dynamically
jiji14 18e99bb
Surveys Cards components UI done
jiji14 2281c7e
Chart UI fix
jiji14 c38c353
update TimelineScrollList only when the active tab is 'label'
jiji14 1f7a692
add getSurveyMetric API endpoint
jiji14 58cfb5f
get new survey data every 24 hours
jiji14 8150e95
delete dummy data and process survey data from server
jiji14 ed52e0f
Merge branch 'refactoring_timelinecontext' of https://github.com/JGre…
JGreenlee d68354e
Delete the getSurveyMetric API call from the server logic alteration
jiji14 d4b3f51
Separate 'Survey comparison Card' and 'Leaderboard Card'
jiji14 abec657
use the new yyyy_mm_dd endpoint for agg metrics
JGreenlee 5ab984c
refactor valueForModeOnDay -> valueForFieldOnDay
JGreenlee 5916fab
display response_count MetricsCard properly
JGreenlee ab6fece
include primary_ble_sensed_mode in derived properties
JGreenlee c9628e0
support localhost metrics when appConfig does not have 'server'
JGreenlee 32336ea
add 'metrics.responses' to en.json
JGreenlee 1d99f59
use real data for SurveyComparisonCard
JGreenlee c7fbc25
use real data for SurveyTripCategoriesCard
JGreenlee 5a8759e
comment out leaderboard; remove dummy data
JGreenlee 269faed
"metrics list" -> "metric list"
JGreenlee cc4d134
show "No data" better when there's nothing to show
JGreenlee 7e1c536
use e-mission-common @ 0.5.0
JGreenlee 7510bf1
use semver for e-mission-common dependency
JGreenlee 2e02fb7
Merge branch 'master' of https://github.com/e-mission/e-mission-phone…
JGreenlee f28bc23
fix filters issue on 'additions' configs
JGreenlee 18089bf
on config refresh, wait for resources to finish caching
JGreenlee 0642f06
remove response_count from default metric_list
JGreenlee e4ba6d0
fix metrics values summing
JGreenlee 6ff253f
refactor metrics "units" & "format" fns to support response_count charts
JGreenlee 34a99da
fix incorrect summing of response_count objs
JGreenlee f71280f
unify datepickers, loadSpecificWeek -> loadDateRange; simplify
JGreenlee 637d496
refactor & simplify MetricsTab
JGreenlee 66bbc62
update metricsTypes
JGreenlee 6ef2adf
remove dateForDayOfMetricData function
JGreenlee bbfbfa1
have MetricValue support type generics to disambiguate number vs object
JGreenlee 96549b3
use e-mission-common @ 0.5.1
JGreenlee 114d15e
improve MetricsTab loading
JGreenlee cbefbbd
remove unused code from MetricsTab
JGreenlee c803973
humanize all caps values for Metrics Tab
JGreenlee b3e80df
fix date range picker timezone issue
JGreenlee 663f86c
update metricsHelper.test.ts to use the unified DayOfMetricData type
JGreenlee 90b631c
Hide chart when there is no survey data
jiji14 a3570d6
type error handling
jiji14 084224e
fix checking data logic for surveyComparisonCard
jiji14 8cf5fb0
Add maxBarThickness for chart.js
jiji14 f55faf1
add more unit tests
jiji14 abf2f3f
export functions for tests and fix syntax issue
jiji14 66464ca
done unit tests with metricsHelper
jiji14 a963381
add useImperialConfig test
jiji14 3f08b6c
add getTheme unit test
jiji14 1bd1f48
add unit test if Carousel renders children correctly
jiji14 e55e5ae
add DateSelect rendering unit test
jiji14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,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(); | ||
}); | ||
}); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
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,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(); | ||
}); | ||
}); |
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,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'); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.