diff --git a/src/api/Message.ts b/src/api/Message.ts index 666dd897..77188ad3 100644 --- a/src/api/Message.ts +++ b/src/api/Message.ts @@ -13,8 +13,9 @@ export interface Message { ticker: number text: string creation_date: Date - tweet_id: string - tweet_user: string + twitter_url?: string + telegram_url?: string + mastodon_url?: string geo_information: string // TODO attachments: any[] diff --git a/src/components/message/Message.tsx b/src/components/message/Message.tsx index 891121d6..848de1d4 100644 --- a/src/components/message/Message.tsx +++ b/src/components/message/Message.tsx @@ -8,6 +8,7 @@ import { replaceMagic } from '../../lib/replaceLinksHelper' import MessageModalDelete from './MessageModalDelete' import MessageMap from './MessageMap' import { Ticker } from '../../api/Ticker' +import MastodonIcon from './mastodon_icon.png' interface Props { message: MessageType @@ -21,6 +22,52 @@ const Message: FC = ({ message, ticker }) => { const openImageLightbox = useCallback(() => setImageLightboxOpen(true), []) const closeImageLightbox = useCallback(() => setImageLightboxOpen(false), []) + const twitterIcon = useCallback(() => { + if (message.twitter_url) { + return ( + + + + ) + } + + return null + }, [message.twitter_url]) + + const telegramIcon = useCallback(() => { + if (message.telegram_url) { + return ( + + + + ) + } + + return null + }, [message.telegram_url]) + + const mastodonIcon = useCallback(() => { + if (message.mastodon_url) { + return ( + + + + + + ) + } + + return null + }, [message.mastodon_url]) + const renderAttachments = () => { const attachments = message.attachments @@ -63,22 +110,6 @@ const Message: FC = ({ message, ticker }) => { ) } - const renderTwitterIcon = () => { - if (message.tweet_id === '') { - return - } - - return ( - - - - ) - } - return ( @@ -103,7 +134,9 @@ const Message: FC = ({ message, ticker }) => { {renderAttachments()} - {renderTwitterIcon()} + {twitterIcon()} + {telegramIcon()} + {mastodonIcon()} {message.creation_date} diff --git a/src/components/message/mastodon_icon.png b/src/components/message/mastodon_icon.png new file mode 100644 index 00000000..1c3b251f Binary files /dev/null and b/src/components/message/mastodon_icon.png differ diff --git a/src/components/ticker/MastodonForm.tsx b/src/components/ticker/MastodonForm.tsx index e506d014..f582cddb 100644 --- a/src/components/ticker/MastodonForm.tsx +++ b/src/components/ticker/MastodonForm.tsx @@ -58,6 +58,9 @@ const MastodonForm: FC = ({ callback, ticker }) => { {`"`} where you need to create an Application. After saving you see the required secrets and tokens. + + Required Scopes: read write write:media write:statuses +