import { decodeHtmlEntities } from 'common/string';
import { Fragment } from 'inferno';
import { useBackend } from '../../backend';
import { Box, Button, Section } from '../../components';
// Stolen wholesale from communicators. TGUITODO: Merge PDA & Communicator shared code once both are in
/* News */
export const pda_news = (props, context) => {
const { act, data } = useBackend(context);
const { feeds, target_feed } = data;
return (
{(!feeds.length && Error: No newsfeeds available. Please try again later.) ||
(target_feed && ) || }
);
};
const NewsTargetFeed = (props, context) => {
const { act, data } = useBackend(context);
const { target_feed } = data;
return (
act('newsfeed', { newsfeed: null })} />}>
{(target_feed.messages.length &&
target_feed.messages.map((message) => (
- {decodeHtmlEntities(message.body)}
{!!message.img && (
{decodeHtmlEntities(message.caption) || null}
)}
[{message.message_type} by {decodeHtmlEntities(message.author)} - {message.time_stamp}]
))) || No stories found in {target_feed.name}.}
);
};
const NewsFeed = (props, context) => {
const { act, data } = useBackend(context);
const { feeds, latest_news } = data;
return (
{(latest_news.length && (
{latest_news.map((news) => (
{decodeHtmlEntities(news.channel)}
- {decodeHtmlEntities(news.body)}
{!!news.img && (
[image omitted, view story for more details]
{news.caption || null}
)}
[{news.message_type} by{' '}
{news.author}
{' '}
- {news.time_stamp}]
))}
)) || No recent stories found.}
{feeds.map((feed) => (
);
};