-
Notifications
You must be signed in to change notification settings - Fork 9
[OSDEV-2353] Production location skeleton page #884
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
Merged
VadimKovalenkoSNF
merged 40 commits into
main
from
OSDEV-2353-production-location-skeleton-page
Feb 24, 2026
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
b50dc17
Add feature flag for production location page
VadimKovalenkoSNF 78a34c2
Update release notes
VadimKovalenkoSNF 398248f
Update facility routing
VadimKovalenkoSNF a779f4c
Fix redirect error with full path and os id mismatch
VadimKovalenkoSNF 88de642
Add tests for util functions
VadimKovalenkoSNF 719fe81
Upd release notes
VadimKovalenkoSNF e732986
Use normalizedOsId for proper data fetch
VadimKovalenkoSNF a817ff8
Fix migration conflicts, upd release notes
VadimKovalenkoSNF 0906787
Upd release notes
VadimKovalenkoSNF 192f773
Minor test update
VadimKovalenkoSNF 2576d5a
Redirect to regular facility route im embed mode is embed mode is ena…
VadimKovalenkoSNF fda9275
Upd Release notes
VadimKovalenkoSNF daa3bc1
Fix Release notes
VadimKovalenkoSNF 279ef5f
Add basic components for new production location page (partial impl)
VadimKovalenkoSNF de18a05
Restructure components
VadimKovalenkoSNF 3c68834
Fix responsive layout
VadimKovalenkoSNF d89861a
Merge branch 'main' into OSDEV-2353-production-location-skeleton-page
VadimKovalenkoSNF 3da0f66
Fix post-merge issues
VadimKovalenkoSNF b33a6c1
Fix mail link to point to the old facility endpoint
VadimKovalenkoSNF 9c2b761
Fix move-to-facility link
VadimKovalenkoSNF b0aa20c
Add title object to classes
VadimKovalenkoSNF 6f8340a
Fix Redirect condition when production location has been merged
VadimKovalenkoSNF a76e643
Add a title entry to contributeFieldsStyles
VadimKovalenkoSNF dfcc4da
Use proper links in ContributeFields
VadimKovalenkoSNF 852ced3
Replace href with to on every Link
VadimKovalenkoSNF 8104e25
Minor refactoring of the closure status
VadimKovalenkoSNF 81d1bd7
Introduce getPrimaryText() function
VadimKovalenkoSNF b6328ab
Merge branch 'main' into OSDEV-2353-production-location-skeleton-page
VadimKovalenkoSNF c72ddb5
Fix lint issues
VadimKovalenkoSNF 5262030
Minor lint fixes, add missing style
VadimKovalenkoSNF 6530fa9
Merge branch 'main' into OSDEV-2353-production-location-skeleton-page
VadimKovalenkoSNF 05e0eaf
Restructure folders and components related to new Production Location…
VadimKovalenkoSNF f06cff5
Rename components filenames to their corresponding names
VadimKovalenkoSNF c3be47b
Remove index.js entry point for production location components
VadimKovalenkoSNF 8593157
Fix lint issues
VadimKovalenkoSNF 74432e8
Add safeguard for closure report
VadimKovalenkoSNF 74ef0a1
Create separate PrimaryText component
VadimKovalenkoSNF 4089af0
Fix lint issue
VadimKovalenkoSNF 1e64dae
Update release notes
VadimKovalenkoSNF 8f3e3f1
Update release notes placement
VadimKovalenkoSNF 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
.../src/components/ProductionLocation/ClaimSection/ClaimDataContainer/ClaimDataContainer.jsx
This file contains hidden or 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,15 @@ | ||
| import React from 'react'; | ||
| import { withStyles } from '@material-ui/core/styles'; | ||
| import Typography from '@material-ui/core/Typography'; | ||
|
|
||
| import styles from './styles'; | ||
|
|
||
| const ClaimDataContainer = ({ classes, className }) => ( | ||
| <div className={`${classes.container} ${className || ''}`}> | ||
| <Typography variant="title" className={classes.title} component="h3"> | ||
| Claim Data | ||
| </Typography> | ||
| </div> | ||
| ); | ||
|
|
||
| export default withStyles(styles)(ClaimDataContainer); |
9 changes: 9 additions & 0 deletions
9
src/react/src/components/ProductionLocation/ClaimSection/ClaimDataContainer/styles.js
This file contains hidden or 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,9 @@ | ||
| export default theme => | ||
| Object.freeze({ | ||
| container: Object.freeze({ | ||
| backgroundColor: 'white', | ||
| }), | ||
| title: Object.freeze({ | ||
| marginBottom: theme.spacing.unit, | ||
| }), | ||
| }); |
72 changes: 72 additions & 0 deletions
72
src/react/src/components/ProductionLocation/Heading/ClaimFlag/ClaimFlag.jsx
This file contains hidden or 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,72 @@ | ||
| import React from 'react'; | ||
| import { Link } from 'react-router-dom'; | ||
| import { connect } from 'react-redux'; | ||
| import Typography from '@material-ui/core/Typography'; | ||
| import Icon from '@material-ui/core/Icon'; | ||
| import { withStyles } from '@material-ui/core/styles'; | ||
|
|
||
| import BadgeClaimed from '../../../BadgeClaimed'; | ||
|
|
||
| import { | ||
| makeClaimFacilityLinkWithFeatureFlag, | ||
| convertFeatureFlagsObjectToListOfActiveFlags, | ||
| } from '../../../../util/util'; | ||
| import { ENABLE_V1_CLAIMS_FLOW } from '../../../../util/constants'; | ||
|
|
||
| import { getBackgroundColorClass, getMainText } from './utils'; | ||
| import styles from './styles'; | ||
|
|
||
| const FacilityDetailsClaimFlag = ({ | ||
| classes, | ||
| osId, | ||
| isClaimed, | ||
| isPending, | ||
| isEmbed, | ||
| isV1ClaimsFlowEnabled, | ||
| }) => { | ||
| if (isEmbed) return null; | ||
| const rootVariantClass = | ||
| classes[getBackgroundColorClass(isClaimed, isPending)]; | ||
| const claimFacilityLink = makeClaimFacilityLinkWithFeatureFlag( | ||
| osId, | ||
| isV1ClaimsFlowEnabled, | ||
| ); | ||
| return ( | ||
| <div className={rootVariantClass} data-testid="claim-banner"> | ||
| <div className={classes.contentContainer}> | ||
| <Icon className={classes.itemPadding}> | ||
| <BadgeClaimed /> | ||
| </Icon> | ||
| <Typography className={classes.itemPadding}> | ||
| {getMainText(isClaimed, isPending)} | ||
| </Typography> | ||
| {!isClaimed && !isPending ? ( | ||
| <Typography className={classes.itemPadding}> | ||
| <Link | ||
| to={claimFacilityLink} | ||
| href={claimFacilityLink} | ||
| className={classes.link} | ||
| > | ||
| I want to claim this production location | ||
| </Link> | ||
| </Typography> | ||
| ) : null} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| const mapStateToProps = ({ featureFlags: { flags } }) => { | ||
| const activeFeatureFlags = convertFeatureFlagsObjectToListOfActiveFlags( | ||
| flags, | ||
| ); | ||
| return { | ||
| isV1ClaimsFlowEnabled: activeFeatureFlags.includes( | ||
| ENABLE_V1_CLAIMS_FLOW, | ||
| ), | ||
| }; | ||
| }; | ||
|
|
||
| export default connect(mapStateToProps)( | ||
| withStyles(styles)(FacilityDetailsClaimFlag), | ||
| ); |
40 changes: 40 additions & 0 deletions
40
src/react/src/components/ProductionLocation/Heading/ClaimFlag/styles.js
This file contains hidden or 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,40 @@ | ||
| import COLOURS from '../../../../util/COLOURS'; | ||
|
|
||
| export default theme => | ||
| Object.freeze({ | ||
| rootClaimed: { | ||
| backgroundColor: COLOURS.GREEN, | ||
| color: '#191919', | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| }, | ||
| rootPending: { | ||
| backgroundColor: COLOURS.NAVIGATION, | ||
| color: '#191919', | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| }, | ||
| rootUnclaimed: { | ||
| backgroundColor: COLOURS.LIGHT_RED, | ||
| color: '#191919', | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| }, | ||
| contentContainer: { | ||
| width: '100%', | ||
| maxWidth: '1072px', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| flexWrap: 'wrap', | ||
| paddingRight: theme.spacing.unit, | ||
| paddingBottom: theme.spacing.unit, | ||
| }, | ||
| link: { | ||
| color: theme.palette.primary.main, | ||
| }, | ||
| itemPadding: { | ||
| paddingLeft: theme.spacing.unit * 3, | ||
| paddingTop: theme.spacing.unit, | ||
| paddingBottom: theme.spacing.unit / 4, | ||
| }, | ||
| }); |
15 changes: 15 additions & 0 deletions
15
src/react/src/components/ProductionLocation/Heading/ClaimFlag/utils.js
This file contains hidden or 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,15 @@ | ||
| export const getBackgroundColorClass = (isClaimed, isPending) => { | ||
| if (isClaimed) return 'rootClaimed'; | ||
| if (isPending) return 'rootPending'; | ||
| return 'rootUnclaimed'; | ||
| }; | ||
|
|
||
| export const getMainText = (isClaimed, isPending) => { | ||
| if (isClaimed) { | ||
| return 'This production location has been claimed by an owner or manager'; | ||
| } | ||
| if (isPending) { | ||
| return 'There is a pending claim for this production location'; | ||
| } | ||
| return 'This production location has not been claimed'; | ||
| }; |
63 changes: 63 additions & 0 deletions
63
src/react/src/components/ProductionLocation/Heading/ClosureStatus/ClosureStatus.jsx
This file contains hidden or 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,63 @@ | ||
| import React from 'react'; | ||
| import get from 'lodash/get'; | ||
| import Typography from '@material-ui/core/Typography'; | ||
| import { withStyles } from '@material-ui/core/styles'; | ||
|
|
||
| import FeatureFlag from '../../../FeatureFlag'; | ||
| import { REPORT_A_FACILITY } from '../../../../util/constants'; | ||
|
|
||
| import PrimaryText from './PrimaryText'; | ||
| import styles from './styles'; | ||
|
|
||
| const ProductionLocationDetailClosureStatus = ({ | ||
| data, | ||
| clearFacility, | ||
| classes, | ||
| useProductionLocationPage = false, | ||
| search = '', | ||
| }) => { | ||
| const report = get(data, 'properties.activity_reports[0]'); | ||
| const newOsId = get(data, 'properties.new_os_id'); | ||
| const isClosed = get(data, 'properties.is_closed'); | ||
| const isPending = report?.status === 'PENDING'; | ||
|
|
||
| if (!report) return null; | ||
|
|
||
| if (!isPending && !isClosed) return null; | ||
|
|
||
| return ( | ||
| <FeatureFlag flag={REPORT_A_FACILITY}> | ||
| <div className={classes.status}> | ||
| <div className={classes.contentContainer}> | ||
| <i | ||
| className={`${classes.text} ${classes.icon} far fa-fw fa-store-slash`} | ||
| /> | ||
| <div className={classes.textBox}> | ||
| <PrimaryText | ||
| report={report} | ||
| isPending={isPending} | ||
| isClosed={isClosed} | ||
| newOsId={newOsId} | ||
| classes={classes} | ||
| useProductionLocationPage={ | ||
| useProductionLocationPage | ||
| } | ||
| search={search} | ||
| clearFacility={clearFacility} | ||
| /> | ||
| {isPending && ( | ||
| <Typography | ||
| className={classes.text} | ||
| variant="body1" | ||
| > | ||
| Status pending | ||
| </Typography> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </FeatureFlag> | ||
| ); | ||
| }; | ||
|
|
||
| export default withStyles(styles)(ProductionLocationDetailClosureStatus); |
67 changes: 67 additions & 0 deletions
67
src/react/src/components/ProductionLocation/Heading/ClosureStatus/PrimaryText.jsx
This file contains hidden or 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,67 @@ | ||
| import React from 'react'; | ||
| import Typography from '@material-ui/core/Typography'; | ||
| import { Link } from 'react-router-dom'; | ||
|
|
||
| import { | ||
| makeFacilityDetailLink, | ||
| makeFacilityDetailLinkOnRedirect, | ||
| } from '../../../../util/util'; | ||
|
|
||
| const PrimaryText = ({ | ||
| report, | ||
| isPending, | ||
| isClosed, | ||
| newOsId, | ||
| classes, | ||
| useProductionLocationPage, | ||
| search, | ||
| clearFacility, | ||
| }) => { | ||
| if (isPending) { | ||
| const closureState = (report.closure_state || 'unknown').toLowerCase(); | ||
| return ( | ||
| <Typography className={classes.text} variant="subheading"> | ||
| This facility may be {closureState} | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| if (isClosed && !!newOsId) { | ||
| const movedToPathname = useProductionLocationPage | ||
| ? makeFacilityDetailLinkOnRedirect( | ||
| newOsId, | ||
| search, | ||
| useProductionLocationPage, | ||
| ) | ||
| : makeFacilityDetailLink(newOsId); | ||
| return ( | ||
| <Typography className={classes.text} variant="subheading"> | ||
| This facility has moved to{' '} | ||
| <Link | ||
| to={{ | ||
| pathname: movedToPathname, | ||
| state: { | ||
| panMapToFacilityDetails: true, | ||
| }, | ||
| }} | ||
| className={classes.text} | ||
| onClick={() => clearFacility()} | ||
| > | ||
| {newOsId} | ||
| </Link> | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| if (isClosed) { | ||
| return ( | ||
| <Typography className={classes.text} variant="subheading"> | ||
| This facility is closed | ||
| </Typography> | ||
| ); | ||
| } | ||
|
|
||
| return null; | ||
| }; | ||
|
|
||
| export default PrimaryText; | ||
31 changes: 31 additions & 0 deletions
31
src/react/src/components/ProductionLocation/Heading/ClosureStatus/styles.js
This file contains hidden or 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,31 @@ | ||
| export default theme => | ||
| Object.freeze({ | ||
| status: { | ||
| backgroundColor: 'rgb(40, 39, 39)', | ||
| borderRadius: 0, | ||
| display: 'flex', | ||
| justifyContent: 'center', | ||
| }, | ||
| contentContainer: { | ||
| width: '100%', | ||
| maxWidth: '1072px', | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| flexWrap: 'wrap', | ||
| padding: theme.spacing.unit, | ||
| }, | ||
| icon: { | ||
| fontSize: '24px', | ||
| fontWeight: 'normal', | ||
| paddingLeft: theme.spacing.unit * 2, | ||
| paddingRight: theme.spacing.unit * 3, | ||
| }, | ||
| textBox: { | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| }, | ||
| text: { | ||
| color: 'rgb(255, 255, 255)', | ||
| fontSize: '14px', | ||
| }, | ||
| }); |
15 changes: 15 additions & 0 deletions
15
src/react/src/components/ProductionLocation/Heading/DataSourcesInfo/DataSourcesInfo.jsx
This file contains hidden or 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,15 @@ | ||
| import React from 'react'; | ||
| import Typography from '@material-ui/core/Typography'; | ||
| import { withStyles } from '@material-ui/core/styles'; | ||
|
|
||
| import styles from './styles'; | ||
|
|
||
| const ProductionLocationDetailsDataSourcesInfo = ({ classes, className }) => ( | ||
| <div className={`${classes.container} ${className || ''}`}> | ||
| <Typography variant="title" className={classes.title} component="h3"> | ||
| Understanding Data Sources | ||
| </Typography> | ||
| </div> | ||
| ); | ||
|
|
||
| export default withStyles(styles)(ProductionLocationDetailsDataSourcesInfo); |
9 changes: 9 additions & 0 deletions
9
src/react/src/components/ProductionLocation/Heading/DataSourcesInfo/styles.js
This file contains hidden or 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,9 @@ | ||
| export default theme => | ||
| Object.freeze({ | ||
| container: Object.freeze({ | ||
| backgroundColor: 'white', | ||
| }), | ||
| title: Object.freeze({ | ||
| marginBottom: theme.spacing.unit, | ||
| }), | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.