Skip to content

Fixed poster duration and slide done #169

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
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## Unreleased

- [#169](https://github.com/os2display/display-templates/pull/169)
- Fixed duration and slide done.
- [#165](https://github.com/os2display/display-templates/pull/165)
- Fixed transitions for poster.
- Fixed dates for poster spanning multiple days.
Expand Down
6 changes: 3 additions & 3 deletions build/poster-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1738154345932",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1738154345932",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-schema.json?ts=1738154345932",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1742482693753",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1742482693753",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-schema.json?ts=1742482693753",
"assets": [],
"options": {},
"content": {}
Expand Down
6 changes: 3 additions & 3 deletions build/poster-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1738154345932",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1738154345932",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-schema.json?ts=1738154345932",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1742482693753",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1742482693753",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-schema.json?ts=1742482693753",
"assets": [],
"options": {},
"content": {}
Expand Down
2 changes: 1 addition & 1 deletion build/poster.js

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/poster/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ function Poster({ slide, content, run, slideDone, executionId }) {

// Animation.
const animationDuration = 500;
const { entryDuration = 15 } = content; // default 15s.
const entryDurationMilliseconds = entryDuration * 1000;
const { duration = 15000 } = content; // default 15s.

// Props from currentEvent.
const {
Expand Down Expand Up @@ -125,7 +124,7 @@ function Poster({ slide, content, run, slideDone, executionId }) {

animationTimerRef.current = setTimeout(() => {
setShow(false);
}, entryDurationMilliseconds - animationDuration + 50);
}, duration - animationDuration + 50);
}

if (timerRef?.current) {
Expand All @@ -138,12 +137,12 @@ function Poster({ slide, content, run, slideDone, executionId }) {
} else {
setCurrentIndex(nextIndex);
}
}, entryDurationMilliseconds);
}, duration);
}, [currentIndex]);

useEffect(() => {
if (run) {
if (feedData && currentEvent === null && feedData?.length > 0) {
if (feedData?.length > 0) {
setCurrentIndex(0);
} else {
setTimeout(() => slideDone(slide), 1000);
Expand Down Expand Up @@ -315,7 +314,7 @@ Poster.propTypes = {
),
}).isRequired,
content: PropTypes.shape({
entryDuration: PropTypes.number,
duration: PropTypes.number,
showLogo: PropTypes.bool,
mediaContain: PropTypes.bool,
}).isRequired,
Expand Down