Skip to content
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

DISPLAY-1019: Fixed poster template to not display anything when no event #144

Merged
merged 6 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#144](https://github.com/os2display/display-templates/pull/144)
- Fixed poster template to account show message when not configured correctly.
tuj marked this conversation as resolved.
Show resolved Hide resolved
- [#142](https://github.com/os2display/display-templates/pull/142)
Update poster template to display url domain.
- Update poster template to display url domain.

## [1.3.0] - 2023-09-14

Expand Down
4 changes: 2 additions & 2 deletions build/poster-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1696848106826",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1696848106826",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1697045018905",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1697045018905",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-schema.json",
"assets": [],
"options": {},
Expand Down
4 changes: 2 additions & 2 deletions build/poster-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1696848106826",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1696848106826",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1697045018905",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1697045018905",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-schema.json",
"assets": [],
"options": {},
Expand Down
2 changes: 1 addition & 1 deletion build/poster.js

Large diffs are not rendered by default.

159 changes: 86 additions & 73 deletions src/poster/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,86 +157,97 @@ function Poster({ slide, content, run, slideDone, executionId }) {

return (
<>
{feed?.configuration?.posterType === "single" &&
!feed?.configuration?.singleSelectedOccurrence && (
<div style={{ color: "white", margin: "1em" }}>
Der er ikke valgt et event eller en forekomst.
</div>
)}

{/* TODO: Adjust styling to variables from Theme */}
<IntlProvider messages={translations} locale="da" defaultLocale="da">
<div className={`template-poster ${showLogo && "with-logo"}`}>
<div
className="image-area"
style={{
backgroundImage: `url("${image}")`,
...(show
? { animation: `fade-in ${animationDuration}ms` }
: { animation: `fade-out ${animationDuration}ms` }),
}}
/>
<div className="header-area">
<div className="center">
<h1>
{!overrideTitle && name}
{overrideTitle}
</h1>
<p className="lead">
{!overrideSubTitle && excerpt}
{overrideSubTitle}
</p>
{currentEvent !== null && (
<IntlProvider messages={translations} locale="da" defaultLocale="da">
<div className={`template-poster ${showLogo && "with-logo"}`}>
<div
className="image-area"
style={{
backgroundImage: `url("${image}")`,
...(show
? { animation: `fade-in ${animationDuration}ms` }
: { animation: `fade-out ${animationDuration}ms` }),
}}
/>
<div className="header-area">
<div className="center">
<h1>
{!overrideTitle && name}
{overrideTitle}
</h1>
<p className="lead">
{!overrideSubTitle && excerpt}
{overrideSubTitle}
</p>
</div>
</div>
</div>
<div className="info-area">
<div className="center">
{!hideTime && startDate && (
<span>
{singleDayEvent && (
<span>
<div className="date">{formatDate(startDate)}</div>
<div className="date">
{formatTime(startDate)} - {formatTime(endDate)}
</div>
</span>
<div className="info-area">
<div className="center">
{!hideTime && startDate && (
<span>
{singleDayEvent && (
<span>
<div className="date">{formatDate(startDate)}</div>
<div className="date">
{formatTime(startDate)} - {formatTime(endDate)}
</div>
</span>
)}
{/* todo if startdate is not equal to enddate */}
{!singleDayEvent && (
<span>
<div className="date">
{startDate && formatDateNoYear(startDate)} -{" "}
{endDate && formatDate(endDate)}
</div>
<div className="date">
{formatTime(startDate)} - {formatTime(endDate)}
</div>
</span>
)}
</span>
)}
{place && <p className="place">{place.name}</p>}
<p className="ticket">
{!ticketPriceRange && (
<FormattedMessage id="free" defaultMessage="free" />
)}
{ticketPriceRange && (
<>
{!overrideTicketPrice && ticketPriceRange}
{overrideTicketPrice}
</>
)}
{/* todo if startdate is not equal to enddate */}
{!singleDayEvent && (
<span>
<div className="date">
{startDate && formatDateNoYear(startDate)} -{" "}
{endDate && formatDate(endDate)}
</div>
<div className="date">
{formatTime(startDate)} - {formatTime(endDate)}
</div>
</p>
<>
{readMoreText && <p className="moreinfo">{readMoreText}</p>}
{!overrideReadMoreUrl && url && (
<span className="look-like-link">{getUrlDomain(url)}</span>
)}
{overrideReadMoreUrl && (
<span className="look-like-link">
{overrideReadMoreUrl}
</span>
)}
</span>
)}
{place && <p className="place">{place.name}</p>}
<p className="ticket">
{!ticketPriceRange && (
<FormattedMessage id="free" defaultMessage="free" />
)}
{ticketPriceRange && (
<>
{!overrideTicketPrice && ticketPriceRange}
{overrideTicketPrice}
</>
)}
</p>
<>
{readMoreText && <p className="moreinfo">{readMoreText}</p>}
{!overrideReadMoreUrl && url && (
<span className="look-like-link">{getUrlDomain(url)}</span>
)}
{overrideReadMoreUrl && (
<span className="look-like-link">{overrideReadMoreUrl}</span>
)}
</>
</>
</div>
</div>
{showLogo && (
<div className="logo-area">
<img src={logoUrl} alt="" />
</div>
)}
</div>
{showLogo && (
<div className="logo-area">
<img src={logoUrl} alt="" />
</div>
)}
</div>
</IntlProvider>
</IntlProvider>
)}

<ThemeStyles id={executionId} css={slide?.themeData?.cssStyles} />
</>
Expand All @@ -263,6 +274,8 @@ Poster.propTypes = {
overrideReadMoreUrl: PropTypes.string,
hideTime: PropTypes.bool,
readMoreText: PropTypes.string,
posterType: PropTypes.string,
singleSelectedOccurrence: PropTypes.string
}),
}),
feedData: PropTypes.arrayOf(
Expand Down
Loading