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

News feed template #161

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

All notable changes to this project will be documented in this file.

- [#TODO](https://github.com/os2display/display-templates/pull/TODO)
- [#161](https://github.com/os2display/display-templates/pull/161)
- Added social news template.
- [#160](https://github.com/os2display/display-templates/pull/160)
- Added option to set image size contain instead of cover.
- [#159](https://github.com/os2display/display-templates/pull/159)
- Fixed issue where slideshow flickered first image before transitioning to next slide.
Expand Down
70 changes: 70 additions & 0 deletions build/news-feed-admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[
{
"key": "news-feed-form-1",
"input": "header",
"text": "Skabelon: Instagram feed",
"name": "header1",
"formGroupClasses": "h4 mb-3"
},
{
"key": "news-feed-form-2",
"input": "header-h3",
"text": "Opsæt feed",
"name": "header2",
"formGroupClasses": "h5 mb-3"
},
{
"key": "news-feed-form-3",
"input": "feed",
"text": "Opsæt feed",
"name": "feeds",
"supportedFeedOutputType": "rss",
"formGroupClasses": "mb-3",
"singleSelect": true
},
{
"key": "news-feed-form-entry-duration",
"input": "input",
"name": "entryDuration",
"type": "number",
"label": "Varighed pr. nyhed (i sekunder)",
"helpText": "Her skal du skrive varigheden pr. nyhed.",
"formGroupClasses": "mb-3",
"required": true
},
{
"key": "news-feed-form-readmore",
"input": "input",
"label": "Læs mere tekst",
"helpText": "Hvis den ikke overskrives, står der \"Læs hele nyheden\"",
"name": "readMore",
"formGroupClasses": "mb-3"
},
{
"key": "news-feed-max-entries",
"input": "input",
"name": "maxEntries",
"type": "number",
"min": 1,
"label": "Maksimalt antal nyheder",
"helpText": "Her kan du skrive maksimalt antal nyheder, der skal vises.",
"formGroupClasses": "mb-3"
},
{
"key": "rss-form-4",
"multipleImages": false,
"input": "image",
"name": "fallbackImage",
"label": "Fallback-billede",
"helpText": "Dette billede kan vises, hvis nyheden mangler et billede.",
"formGroupClasses": "mb-3"
},
{
"key": "form-media-contain",
"input": "checkbox",
"name": "mediaContain",
"label": "Deaktivér billedbeskæring",
"helpText": "Billedet vil blive vist ubeskåret med tomme områder omkring",
"formGroupClasses": "mb-3"
}
]
14 changes: 14 additions & 0 deletions build/news-feed-config-develop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Nyheder",
"icon": "",
"id": "01JEWPAFF93YSF418TH72W1SBA",
"description": "Mulighed for at vise nyhedsindhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/news-feed.js?ts=1734244724142",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/news-feed-admin.json?ts=1734244724142",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
14 changes: 14 additions & 0 deletions build/news-feed-config-main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Nyheder",
"icon": "",
"id": "01JEWPAFF93YSF418TH72W1SBA",
"description": "Mulighed for at vise nyhedsindhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/news-feed.js?ts=1734244724142",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/news-feed-admin.json?ts=1734244724142",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
2 changes: 2 additions & 0 deletions build/news-feed.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"os2display-grid-generator": "^1.0.9",
"postcss-loader": "^5.3.0",
"prop-types": "^15.7.2",
"qrcode": "^1.5.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "^5.20.12",
Expand All @@ -52,13 +53,13 @@
"styled-components": "^5.3.1"
},
"devDependencies": {
"enzyme": "^3.11.0",
"@svgr/webpack": "^5.5.0",
"@testing-library/react": "^12.1.2",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
"@svgr/webpack": "^5.5.0",
"babel-eslint": "^10.1.0",
"clean-webpack-plugin": "^4.0.0-alpha.0",
"copy-webpack-plugin": "^9.0.0",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
Expand Down
Binary file added src/fixtures/images/sunset-full-hd.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Video from "./video/video";
import Travel from "./travel/travel";
import VimeoPlayer from "./vimeo-player/vimeo-player";
import "./index.css";
import NewsFeed from "./news-feed/news-feed";

export const renderScreen = (screen) => {
const gridTemplateAreas = {
Expand Down Expand Up @@ -158,6 +159,16 @@ export const renderSlide = (slide) => {
executionId="SLIDE_ID"
/>
);
case "news-feed":
return (
<NewsFeed
content={slide.content}
slide={slide}
run="1234"
slideDone={slideDone}
executionId="SLIDE_ID"
/>
);
case "table":
return (
<Table
Expand Down
69 changes: 69 additions & 0 deletions src/news-feed/news-feed-admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[
{
"key": "news-feed-form-1",
"input": "header",
"text": "Skabelon: Nyheder",
"name": "header1",
"formGroupClasses": "h4 mb-3"
},
{
"key": "news-feed-form-2",
"input": "header-h3",
"text": "Opsæt feed",
"name": "header2",
"formGroupClasses": "h5 mb-3"
},
{
"key": "news-feed-form-3",
"input": "feed",
"text": "Opsæt feed",
"name": "feeds",
"supportedFeedOutputType": "rss",
"formGroupClasses": "mb-3"
},
{
"key": "news-feed-form-entry-duration",
"input": "input",
"name": "entryDuration",
"type": "number",
"label": "Varighed pr. nyhed (i sekunder)",
"helpText": "Her skal du skrive varigheden pr. nyhed.",
"formGroupClasses": "mb-3",
"required": true
},
{
"key": "news-feed-form-readmore",
"input": "input",
"label": "Læs mere tekst",
"helpText": "Hvis den ikke overskrives, står der \"Læs hele nyheden\"",
"name": "readMore",
"formGroupClasses": "mb-3"
},
{
"key": "news-feed-max-entries",
"input": "input",
"name": "maxEntries",
"type": "number",
"min": 1,
"label": "Maksimalt antal nyheder",
"helpText": "Her kan du skrive maksimalt antal nyheder, der skal vises.",
"formGroupClasses": "mb-3"
},
{
"key": "rss-form-4",
"multipleImages": false,
"input": "image",
"name": "fallbackImage",
"label": "Fallback-billede",
"helpText": "Dette billede kan vises, hvis nyheden mangler et billede.",
"formGroupClasses": "mb-3"
},
{
"key": "form-media-contain",
"input": "checkbox",
"name": "mediaContain",
"label": "Deaktivér billedbeskæring",
"helpText": "Billedet vil blive vist ubeskåret med tomme områder omkring",
"formGroupClasses": "mb-3"
}
]
14 changes: 14 additions & 0 deletions src/news-feed/news-feed-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Nyheder",
"icon": "",
"id": "01JEWPAFF93YSF418TH72W1SBA",
"description": "Mulighed for at vise nyhedsindhold.",
"resources": {
"component": "https://display-templates.local.itkdev.dk/build/news-feed.js",
"admin": "https://display-templates.local.itkdev.dk/build/news-feed-admin.json",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
Loading
Loading