-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UIREQMED-2: Add pages: Confirm item arrival, Mediated requests action…
…s and Send item in transit
- Loading branch information
1 parent
ee3f8ba
commit 9272478
Showing
20 changed files
with
446 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
Pane, | ||
Paneset, | ||
} from '@folio/stripes/components'; | ||
|
||
import NavigationMenu from '../NavigationMenu'; | ||
|
||
import { | ||
FILTER_PANE_WIDTH, | ||
getConfirmItemArrivalUrl, | ||
} from '../../constants'; | ||
|
||
export default class ConfirmItemArrival extends React.Component { | ||
static propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
location: ReactRouterPropTypes.location.isRequired, | ||
}; | ||
|
||
render() { | ||
const { | ||
history, | ||
location, | ||
} = this.props; | ||
|
||
return ( | ||
<Paneset data-testid="confirmItemArrivalPaneSet"> | ||
<Pane | ||
data-testid="confirmItemArrivalPane" | ||
defaultWidth={FILTER_PANE_WIDTH} | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.filterPane.selectActivity" />} | ||
> | ||
<NavigationMenu | ||
history={history} | ||
location={location} | ||
value={getConfirmItemArrivalUrl()} | ||
/> | ||
</Pane> | ||
<Pane | ||
defaultWidth="fill" | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.confirmItemArrival.paneTitle" />} | ||
/> | ||
</Paneset> | ||
); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/components/ConfirmItemArrival/ConfirmItemArrival.test.js
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,35 @@ | ||
import { | ||
render, | ||
screen, | ||
cleanup, | ||
} from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import ConfirmItemArrival from './ConfirmItemArrival'; | ||
|
||
const testIds = { | ||
confirmItemArrivalPaneSet: 'confirmItemArrivalPaneSet', | ||
confirmItemArrivalPane: 'confirmItemArrivalPane', | ||
}; | ||
const labelIds = { | ||
paneTitle: 'ui-requests-mediated.app.confirmItemArrival.paneTitle', | ||
}; | ||
|
||
describe('ConfirmItemArrival', () => { | ||
beforeEach(() => { | ||
render(<ConfirmItemArrival />); | ||
}); | ||
|
||
afterEach(cleanup); | ||
|
||
it('should render pane set', () => { | ||
expect(screen.getByTestId(testIds.confirmItemArrivalPaneSet)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render pane', () => { | ||
expect(screen.getByTestId(testIds.confirmItemArrivalPane)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render pane title', () => { | ||
expect(screen.getByText(labelIds.paneTitle)).toBeVisible(); | ||
}); | ||
}); |
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 @@ | ||
export { default } from './ConfirmItemArrival'; |
55 changes: 55 additions & 0 deletions
55
src/components/MediatedRequestsActions/MediatedRequestsActions.js
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,55 @@ | ||
import React from 'react'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
AppIcon, | ||
} from '@folio/stripes/core'; | ||
|
||
import { | ||
Pane, | ||
Paneset, | ||
} from '@folio/stripes/components'; | ||
|
||
import NavigationMenu from '../NavigationMenu'; | ||
|
||
import { | ||
APP_ICON_NAME, | ||
FILTER_PANE_WIDTH, | ||
getMediatedRequestsActionsUrl, | ||
} from '../../constants'; | ||
|
||
export default class MediatedRequestsActions extends React.Component { | ||
static propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
location: ReactRouterPropTypes.location.isRequired, | ||
}; | ||
|
||
render() { | ||
const { | ||
history, | ||
location, | ||
} = this.props; | ||
|
||
return ( | ||
<Paneset data-testid="mediatedRequestsActionsPaneSet"> | ||
<Pane | ||
data-testid="mediatedRequestsActionPane" | ||
defaultWidth={FILTER_PANE_WIDTH} | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.filterPane.selectActivity" />} | ||
> | ||
<NavigationMenu | ||
history={history} | ||
location={location} | ||
value={getMediatedRequestsActionsUrl()} | ||
/> | ||
</Pane> | ||
<Pane | ||
defaultWidth="fill" | ||
appIcon={<AppIcon app={APP_ICON_NAME} />} | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.mediatedRequestsActions.paneTitle" />} | ||
/> | ||
</Paneset> | ||
); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/components/MediatedRequestsActions/MediatedRequestsActions.test.js
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,35 @@ | ||
import { | ||
render, | ||
screen, | ||
cleanup, | ||
} from '@folio/jest-config-stripes/testing-library/react'; | ||
|
||
import MediatedRequestsActions from './MediatedRequestsActions'; | ||
|
||
const testIds = { | ||
mediatedRequestsActionsPaneSet: 'mediatedRequestsActionsPaneSet', | ||
mediatedRequestsActionPane: 'mediatedRequestsActionPane', | ||
}; | ||
const labelIds = { | ||
paneTitle: 'ui-requests-mediated.app.mediatedRequestsActions.paneTitle', | ||
}; | ||
|
||
describe('MediatedRequests', () => { | ||
beforeEach(() => { | ||
render(<MediatedRequestsActions />); | ||
}); | ||
|
||
afterEach(cleanup); | ||
|
||
it('should render pane set', () => { | ||
expect(screen.getByTestId(testIds.mediatedRequestsActionsPaneSet)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render pane', () => { | ||
expect(screen.getByTestId(testIds.mediatedRequestsActionPane)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render pane title', () => { | ||
expect(screen.getByText(labelIds.paneTitle)).toBeVisible(); | ||
}); | ||
}); |
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 @@ | ||
export { default } from './MediatedRequestsActions'; |
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,4 @@ | ||
.separator { | ||
border-bottom: 1px solid var(--color-border-p2); | ||
margin-bottom: 1rem; | ||
} |
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,88 @@ | ||
import PropTypes from 'prop-types'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import { | ||
Select, | ||
} from '@folio/stripes/components'; | ||
|
||
import { | ||
getConfirmItemArrivalUrl, | ||
getMediatedRequestsActionsUrl, | ||
getSendItemInTransitUrl, | ||
} from '../../constants'; | ||
|
||
import css from './NavigationMenu.css'; | ||
|
||
const NavigationMenu = ({ | ||
history, | ||
location, | ||
value, | ||
dataOptions, | ||
separator, | ||
}) => { | ||
const intl = useIntl(); | ||
|
||
const defaultOptions = [ | ||
{ | ||
label: intl.formatMessage({ id: 'ui-requests-mediated.app.mediatedRequestsActions.navigation' }), | ||
value: getMediatedRequestsActionsUrl(), | ||
}, | ||
{ | ||
label: intl.formatMessage({ id: 'ui-requests-mediated.app.confirmItemArrival.navigation' }), | ||
value: getConfirmItemArrivalUrl(), | ||
}, | ||
{ | ||
label: intl.formatMessage({ id: 'ui-requests-mediated.app.sendItemInTransit.navigation' }), | ||
value: getSendItemInTransitUrl(), | ||
}, | ||
]; | ||
|
||
const handleChangeMenu = (event) => { | ||
const pathname = event.target.value; | ||
const destination = { | ||
pathname, | ||
state: location.state, | ||
}; | ||
|
||
if (pathname === getMediatedRequestsActionsUrl()) { | ||
destination.search = location.state; | ||
} else { | ||
destination.state = location.search; | ||
} | ||
|
||
history.push(destination); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Select | ||
value={value} | ||
dataOptions={dataOptions || defaultOptions} | ||
onChange={handleChangeMenu} | ||
/> | ||
{separator && | ||
<div | ||
className={css.separator} | ||
data-testid="separator" | ||
/> | ||
} | ||
</> | ||
); | ||
}; | ||
|
||
NavigationMenu.defaultProps = { | ||
value: getMediatedRequestsActionsUrl(), | ||
}; | ||
|
||
NavigationMenu.propTypes = { | ||
history: PropTypes.shape({ push: PropTypes.func.isRequired }).isRequired, | ||
location: PropTypes.object.isRequired, | ||
dataOptions: PropTypes.arrayOf(PropTypes.shape({ | ||
label: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
})), | ||
separator: PropTypes.bool, | ||
value: PropTypes.string, | ||
}; | ||
|
||
export default NavigationMenu; |
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 @@ | ||
export { default } from './NavigationMenu'; |
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,49 @@ | ||
import React from 'react'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { | ||
Pane, | ||
Paneset, | ||
} from '@folio/stripes/components'; | ||
|
||
import NavigationMenu from '../NavigationMenu'; | ||
|
||
import { | ||
FILTER_PANE_WIDTH, | ||
getSendItemInTransitUrl, | ||
} from '../../constants'; | ||
|
||
export default class SendItemInTransit extends React.Component { | ||
static propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
location: ReactRouterPropTypes.location.isRequired, | ||
}; | ||
|
||
render() { | ||
const { | ||
history, | ||
location, | ||
} = this.props; | ||
|
||
return ( | ||
<Paneset data-testid="sendItemInTransitPaneSet"> | ||
<Pane | ||
data-testid="sendItemInTransitPane" | ||
defaultWidth={FILTER_PANE_WIDTH} | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.filterPane.selectActivity" />} | ||
> | ||
<NavigationMenu | ||
history={history} | ||
location={location} | ||
value={getSendItemInTransitUrl()} | ||
/> | ||
</Pane> | ||
<Pane | ||
defaultWidth="fill" | ||
paneTitle={<FormattedMessage id="ui-requests-mediated.app.sendItemInTransit.paneTitle" />} | ||
/> | ||
</Paneset> | ||
); | ||
} | ||
} |
Oops, something went wrong.