Skip to content

Commit

Permalink
Ramp build for 7.7.1 avalon tag testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Dananji committed Mar 29, 2024
1 parent 9fa4ea1 commit 11cddd5
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 33 deletions.
52 changes: 43 additions & 9 deletions dist/ramp.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,20 @@ function handleFetchErrors(response) {
}
return response;
}

/**
* Identify a segment is within the given playable range.
* If BOTH start and end times of the segment is outside of the given range => false
* @param {Object} segmentRange JSON with start, end times of segment
* @param {Object} range JSON with end time of media/media-fragment in player
* @returns
*/
function checkSrcRange(segmentRange, range) {
if (segmentRange === undefined) {
return false;
} else if (range === undefined) {
return true;
} else if (segmentRange.end > range.end || segmentRange.start < range.start) {
} else if (segmentRange.start > range.end && segmentRange.end > range.end) {
return false;
} else {
return true;
Expand Down Expand Up @@ -1825,6 +1833,7 @@ function getStructureRanges(manifest) {
var label = getLabelValue(range.getLabel().getValue());
var canvases = range.getCanvasIds();
var duration = 0;
var canvasDuration = 0;
var rangeDuration = range.getDuration();
if (rangeDuration != undefined) {
var start = rangeDuration.start,
Expand All @@ -1843,9 +1852,16 @@ function getStructureRanges(manifest) {
isEmpty = canvasInfo.isEmpty;
summary = canvasInfo.summary;
homepage = canvasInfo.homepage;
isClickable = checkSrcRange(range.getDuration(), canvasInfo.range);
if (isCanvas && canvasInfo.range != undefined) {
duration = canvasInfo.range.end - canvasInfo.range.start;
// Mark all timespans as clickable, and provide desired behavior in ListItem component
isClickable = true;
if (canvasInfo.range != undefined) {
var _canvasInfo$range = canvasInfo.range,
_start = _canvasInfo$range.start,
_end = _canvasInfo$range.end;
canvasDuration = _end - _start;
if (isCanvas) {
duration = _end - _start;
}
}
}
var item = {
Expand All @@ -1863,7 +1879,8 @@ function getStructureRanges(manifest) {
}) : [],
duration: timeToHHmmss(duration),
isClickable: isClickable,
homepage: homepage
homepage: homepage,
canvasDuration: canvasDuration
};
if (canvases.length > 0) {
// Increment the index for each timespan
Expand Down Expand Up @@ -6038,6 +6055,7 @@ var ListItem = function ListItem(_ref) {
items = _ref.items,
itemIndex = _ref.itemIndex,
rangeId = _ref.rangeId,
canvasDuration = _ref.canvasDuration,
sectionRef = _ref.sectionRef,
structureContainerRef = _ref.structureContainerRef;
var playerDispatch = usePlayerDispatch();
Expand All @@ -6061,10 +6079,25 @@ var ListItem = function ListItem(_ref) {
var handleClick = React__default["default"].useCallback(function (e) {
e.preventDefault();
e.stopPropagation();
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
var _getMediaFragment = getMediaFragment(itemIdRef.current, canvasDuration),
start = _getMediaFragment.start,
end = _getMediaFragment.end;
var inRange = checkSrcRange({
start: start,
end: end
}, {
end: canvasDuration
});
/*
Only continue the click action if not both start and end times of
the timespan are not outside Canvas' duration
*/
if (inRange) {
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
});
}
});
React__default["default"].useEffect(function () {
// Auto-scroll active structure item into view
Expand Down Expand Up @@ -6105,7 +6138,7 @@ var ListItem = function ListItem(_ref) {
return /*#__PURE__*/React__default["default"].createElement("li", {
"data-testid": "list-item",
ref: liRef,
className: "ramp--structured-nav__list-item\n ".concat((currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
className: "ramp--structured-nav__list-item\n ".concat(itemIdRef.current != undefined && (currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
"aria-label": itemLabelRef.current,
"data-label": itemLabelRef.current,
"data-summary": itemSummaryRef.current
Expand All @@ -6127,6 +6160,7 @@ ListItem.propTypes = {
items: PropTypes.array.isRequired,
itemIndex: PropTypes.number,
rangeId: PropTypes.string.isRequired,
canvasDuration: PropTypes.number.isRequired,
sectionRef: PropTypes.object.isRequired,
structureContainerRef: PropTypes.object.isRequired
};
Expand Down
2 changes: 1 addition & 1 deletion dist/ramp.cjs.min.js

Large diffs are not rendered by default.

52 changes: 43 additions & 9 deletions dist/ramp.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,20 @@ function handleFetchErrors(response) {
}
return response;
}

/**
* Identify a segment is within the given playable range.
* If BOTH start and end times of the segment is outside of the given range => false
* @param {Object} segmentRange JSON with start, end times of segment
* @param {Object} range JSON with end time of media/media-fragment in player
* @returns
*/
function checkSrcRange(segmentRange, range) {
if (segmentRange === undefined) {
return false;
} else if (range === undefined) {
return true;
} else if (segmentRange.end > range.end || segmentRange.start < range.start) {
} else if (segmentRange.start > range.end && segmentRange.end > range.end) {
return false;
} else {
return true;
Expand Down Expand Up @@ -1794,6 +1802,7 @@ function getStructureRanges(manifest) {
var label = getLabelValue(range.getLabel().getValue());
var canvases = range.getCanvasIds();
var duration = 0;
var canvasDuration = 0;
var rangeDuration = range.getDuration();
if (rangeDuration != undefined) {
var start = rangeDuration.start,
Expand All @@ -1812,9 +1821,16 @@ function getStructureRanges(manifest) {
isEmpty = canvasInfo.isEmpty;
summary = canvasInfo.summary;
homepage = canvasInfo.homepage;
isClickable = checkSrcRange(range.getDuration(), canvasInfo.range);
if (isCanvas && canvasInfo.range != undefined) {
duration = canvasInfo.range.end - canvasInfo.range.start;
// Mark all timespans as clickable, and provide desired behavior in ListItem component
isClickable = true;
if (canvasInfo.range != undefined) {
var _canvasInfo$range = canvasInfo.range,
_start = _canvasInfo$range.start,
_end = _canvasInfo$range.end;
canvasDuration = _end - _start;
if (isCanvas) {
duration = _end - _start;
}
}
}
var item = {
Expand All @@ -1832,7 +1848,8 @@ function getStructureRanges(manifest) {
}) : [],
duration: timeToHHmmss(duration),
isClickable: isClickable,
homepage: homepage
homepage: homepage,
canvasDuration: canvasDuration
};
if (canvases.length > 0) {
// Increment the index for each timespan
Expand Down Expand Up @@ -6007,6 +6024,7 @@ var ListItem = function ListItem(_ref) {
items = _ref.items,
itemIndex = _ref.itemIndex,
rangeId = _ref.rangeId,
canvasDuration = _ref.canvasDuration,
sectionRef = _ref.sectionRef,
structureContainerRef = _ref.structureContainerRef;
var playerDispatch = usePlayerDispatch();
Expand All @@ -6030,10 +6048,25 @@ var ListItem = function ListItem(_ref) {
var handleClick = React.useCallback(function (e) {
e.preventDefault();
e.stopPropagation();
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
var _getMediaFragment = getMediaFragment(itemIdRef.current, canvasDuration),
start = _getMediaFragment.start,
end = _getMediaFragment.end;
var inRange = checkSrcRange({
start: start,
end: end
}, {
end: canvasDuration
});
/*
Only continue the click action if not both start and end times of
the timespan are not outside Canvas' duration
*/
if (inRange) {
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
});
}
});
React.useEffect(function () {
// Auto-scroll active structure item into view
Expand Down Expand Up @@ -6074,7 +6107,7 @@ var ListItem = function ListItem(_ref) {
return /*#__PURE__*/React.createElement("li", {
"data-testid": "list-item",
ref: liRef,
className: "ramp--structured-nav__list-item\n ".concat((currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
className: "ramp--structured-nav__list-item\n ".concat(itemIdRef.current != undefined && (currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
"aria-label": itemLabelRef.current,
"data-label": itemLabelRef.current,
"data-summary": itemSummaryRef.current
Expand All @@ -6096,6 +6129,7 @@ ListItem.propTypes = {
items: PropTypes.array.isRequired,
itemIndex: PropTypes.number,
rangeId: PropTypes.string.isRequired,
canvasDuration: PropTypes.number.isRequired,
sectionRef: PropTypes.object.isRequired,
structureContainerRef: PropTypes.object.isRequired
};
Expand Down
52 changes: 43 additions & 9 deletions dist/ramp.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,20 @@
}
return response;
}

/**
* Identify a segment is within the given playable range.
* If BOTH start and end times of the segment is outside of the given range => false
* @param {Object} segmentRange JSON with start, end times of segment
* @param {Object} range JSON with end time of media/media-fragment in player
* @returns
*/
function checkSrcRange(segmentRange, range) {
if (segmentRange === undefined) {
return false;
} else if (range === undefined) {
return true;
} else if (segmentRange.end > range.end || segmentRange.start < range.start) {
} else if (segmentRange.start > range.end && segmentRange.end > range.end) {
return false;
} else {
return true;
Expand Down Expand Up @@ -1800,6 +1808,7 @@
var label = getLabelValue(range.getLabel().getValue());
var canvases = range.getCanvasIds();
var duration = 0;
var canvasDuration = 0;
var rangeDuration = range.getDuration();
if (rangeDuration != undefined) {
var start = rangeDuration.start,
Expand All @@ -1818,9 +1827,16 @@
isEmpty = canvasInfo.isEmpty;
summary = canvasInfo.summary;
homepage = canvasInfo.homepage;
isClickable = checkSrcRange(range.getDuration(), canvasInfo.range);
if (isCanvas && canvasInfo.range != undefined) {
duration = canvasInfo.range.end - canvasInfo.range.start;
// Mark all timespans as clickable, and provide desired behavior in ListItem component
isClickable = true;
if (canvasInfo.range != undefined) {
var _canvasInfo$range = canvasInfo.range,
_start = _canvasInfo$range.start,
_end = _canvasInfo$range.end;
canvasDuration = _end - _start;
if (isCanvas) {
duration = _end - _start;
}
}
}
var item = {
Expand All @@ -1838,7 +1854,8 @@
}) : [],
duration: timeToHHmmss(duration),
isClickable: isClickable,
homepage: homepage
homepage: homepage,
canvasDuration: canvasDuration
};
if (canvases.length > 0) {
// Increment the index for each timespan
Expand Down Expand Up @@ -6013,6 +6030,7 @@
items = _ref.items,
itemIndex = _ref.itemIndex,
rangeId = _ref.rangeId,
canvasDuration = _ref.canvasDuration,
sectionRef = _ref.sectionRef,
structureContainerRef = _ref.structureContainerRef;
var playerDispatch = usePlayerDispatch();
Expand All @@ -6036,10 +6054,25 @@
var handleClick = React__default["default"].useCallback(function (e) {
e.preventDefault();
e.stopPropagation();
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
var _getMediaFragment = getMediaFragment(itemIdRef.current, canvasDuration),
start = _getMediaFragment.start,
end = _getMediaFragment.end;
var inRange = checkSrcRange({
start: start,
end: end
}, {
end: canvasDuration
});
/*
Only continue the click action if not both start and end times of
the timespan are not outside Canvas' duration
*/
if (inRange) {
playerDispatch({
clickedUrl: itemIdRef.current,
type: 'navClick'
});
}
});
React__default["default"].useEffect(function () {
// Auto-scroll active structure item into view
Expand Down Expand Up @@ -6080,7 +6113,7 @@
return /*#__PURE__*/React__default["default"].createElement("li", {
"data-testid": "list-item",
ref: liRef,
className: "ramp--structured-nav__list-item\n ".concat((currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
className: "ramp--structured-nav__list-item\n ".concat(itemIdRef.current != undefined && (currentNavItem === null || currentNavItem === void 0 ? void 0 : currentNavItem.id) === itemIdRef.current && (isPlaylist || !isCanvas) ? ' active' : ''),
"aria-label": itemLabelRef.current,
"data-label": itemLabelRef.current,
"data-summary": itemSummaryRef.current
Expand All @@ -6102,6 +6135,7 @@
items: PropTypes.array.isRequired,
itemIndex: PropTypes.number,
rangeId: PropTypes.string.isRequired,
canvasDuration: PropTypes.number.isRequired,
sectionRef: PropTypes.object.isRequired,
structureContainerRef: PropTypes.object.isRequired
};
Expand Down
2 changes: 2 additions & 0 deletions docs/build/bundle.26eaadcb.js

Large diffs are not rendered by default.

File renamed without changes.
2 changes: 0 additions & 2 deletions docs/build/bundle.fa42d389.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="rsg-root"></div>
<script src="build/bundle.fa42d389.js"></script>
<script src="build/bundle.26eaadcb.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/manifests/dev/lunchroom_manners.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@
},
"items": [
{
"id": "http://localhost:3003/dev/lunchroom_manners/canvas/1#t=511,527",
"id": "http://localhost:3003/dev/lunchroom_manners/canvas/1#t=573,600",
"type": "Canvas"
}
]
Expand Down
2 changes: 1 addition & 1 deletion docs/manifests/prod/lunchroom_manners.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@
},
"items": [
{
"id": "https://iiif-react-media-player.netlify.app/prod/lunchroom_manners/canvas/1#t=511,527",
"id": "https://iiif-react-media-player.netlify.app/prod/lunchroom_manners/canvas/1#t=573,600",
"type": "Canvas"
}
]
Expand Down

0 comments on commit 11cddd5

Please sign in to comment.