Skip to content

Commit

Permalink
Add manifestId as parameter of handleCanvasLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Jan 25, 2024
1 parent 9e856ec commit b95587a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

### Added

- Added `manifestId` as parameter of `handleCanvasLabel`

### Changed

- **Breaking**: Refactored the parameters of `handleCanvasLabel` to a map
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The available settings are:
{
canvasLabel: ...,
currentCanvasIndex: ...,
manifestId: ...,
}
```
Must return a string.
Expand Down
3 changes: 3 additions & 0 deletions src/components/WindowCanvasNavigationControls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const WindowCanvasNavigationControls = ({
currentCanvasIndex,
hasNextCanvas,
hasPreviousCanvas,
manifestId,
numCanvases,
setCanvasIndex,
setNextCanvas,
Expand All @@ -142,6 +143,7 @@ const WindowCanvasNavigationControls = ({
const canvasLbl = handleCanvasLabel({
canvasLabel,
currentCanvasIndex,
manifestId,
});
const inputId = `canvas-idx-${windowId}`;
return (
Expand Down Expand Up @@ -250,6 +252,7 @@ WindowCanvasNavigationControls.propTypes = {
currentCanvasIndex: PropTypes.number.isRequired,
hasNextCanvas: PropTypes.bool.isRequired,
hasPreviousCanvas: PropTypes.bool.isRequired,
manifestId: PropTypes.string.isRequired,
numCanvases: PropTypes.number.isRequired,
setCanvasIndex: PropTypes.func.isRequired,
setNextCanvas: PropTypes.func.isRequired,
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getCurrentCanvas,
getNextCanvasGrouping,
getPreviousCanvasGrouping,
getWindowManifests,
getWindowViewType,
} from "mirador/dist/es/src/state/selectors";

Expand Down Expand Up @@ -54,6 +55,7 @@ export default [
hasPreviousCanvas: !!getPreviousCanvasGrouping(state, {
windowId,
}),
manifestId: getWindowManifests(state, { windowId })[0],
numCanvases: canvases.length,
};
},
Expand Down

0 comments on commit b95587a

Please sign in to comment.