-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor to cleanup types and follow are-report state config
- Loading branch information
Showing
51 changed files
with
277 additions
and
236 deletions.
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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
apps/fishing-map/features/area-report/reports.config.selectors.ts
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,25 @@ | ||
import { createSelector } from '@reduxjs/toolkit' | ||
import { selectQueryParam } from 'routes/routes.selectors' | ||
import { AreaReportState, AreaReportStateProperty } from './reports.types' | ||
import { DEFAULT_AREA_REPORT_STATE } from './reports.config' | ||
|
||
type AreaReportProperty<P extends AreaReportStateProperty> = Required<AreaReportState>[P] | ||
function selectAreaReportStateProperty<P extends AreaReportStateProperty>(property: P) { | ||
return createSelector([selectQueryParam(property)], (urlProperty): AreaReportProperty<P> => { | ||
if (urlProperty !== undefined) return urlProperty | ||
return DEFAULT_AREA_REPORT_STATE[property] as AreaReportProperty<P> | ||
}) | ||
} | ||
|
||
export const selectReportCategorySelector = selectAreaReportStateProperty('reportCategory') | ||
export const selectReportAreaBounds = selectAreaReportStateProperty('reportAreaBounds') | ||
export const selectReportActivityGraph = selectAreaReportStateProperty('reportActivityGraph') | ||
export const selectReportVesselGraphSelector = selectAreaReportStateProperty('reportVesselGraph') | ||
export const selectReportVesselFilter = selectAreaReportStateProperty('reportVesselFilter') | ||
export const selectReportVesselPage = selectAreaReportStateProperty('reportVesselPage') | ||
export const selectReportResultsPerPage = selectAreaReportStateProperty('reportResultsPerPage') | ||
export const selectReportTimeComparison = selectAreaReportStateProperty('reportTimeComparison') | ||
export const selectReportBufferValueSelector = selectAreaReportStateProperty('reportBufferValue') | ||
export const selectReportBufferUnitSelector = selectAreaReportStateProperty('reportBufferUnit') | ||
export const selectReportBufferOperationSelector = | ||
selectAreaReportStateProperty('reportBufferOperation') |
Oops, something went wrong.