Skip to content

Commit

Permalink
DISPLAY-1019: Fixed poster template to account show message when not …
Browse files Browse the repository at this point in the history
…configured correctly
  • Loading branch information
tuj committed Oct 11, 2023
1 parent c1115f7 commit 33c8f22
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 79 deletions.
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.
- [#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.

158 changes: 85 additions & 73 deletions src/poster/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,86 +157,96 @@ 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 en event eller 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}
</>
)}
</p>
<>
{readMoreText && <p className="moreinfo">{readMoreText}</p>}
{!overrideReadMoreUrl && url && (
<span className="look-like-link">{getUrlDomain(url)}</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>
{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 +273,8 @@ Poster.propTypes = {
overrideReadMoreUrl: PropTypes.string,
hideTime: PropTypes.bool,
readMoreText: PropTypes.string,
posterType: PropTypes.string,
singleSelectedOccurrence: PropTypes.string
}),
}),
feedData: PropTypes.arrayOf(
Expand Down

0 comments on commit 33c8f22

Please sign in to comment.