From 5ff6d712250241d4e292bce8ea228b862a893133 Mon Sep 17 00:00:00 2001 From: louis Date: Sun, 16 Oct 2022 13:19:51 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20Icons=20to=20Message=20when?= =?UTF-8?q?=20Bridge=20was=20used?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Message.ts | 5 +- src/components/message/Message.tsx | 67 +++++++++++++++++------ src/components/message/mastodon_icon.png | Bin 0 -> 3279 bytes src/components/ticker/MastodonForm.tsx | 3 + 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 src/components/message/mastodon_icon.png 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 0000000000000000000000000000000000000000..1c3b251f2ecc0a6cc076447987cac601343758ea GIT binary patch literal 3279 zcmZ{mc{tQ<7sr1j`#P3vS+dI*Gh-PO6~=BXV{DOP7DjeM3=d+EWY3m;Bulb{l9UV? zPl$|ci6UF2LJRfCJH6NYNAG)G?;q!!>)hvazUSP3-FLd9y`=!JG%o-E0@hY23@e7P zERmaop9^sw|EQ06%{7>i`g`0|4*N0|2rZ z0FH!~bvqfc3hchNmMGvLEqkPwmGOjHc|-t!;J|NVD>yDF!#d<5TcgdnR`?|NRTMDM z!j}Pnmu!tP!A8$*mR|_OGQ=4PKR;9Uy?S+aO+xzwB{da>E^)|mxOk$RRcIPk=wm+= zU2f=OYU1mERJ}{HaZ##m^mkEl@oKj%zg&{G9u zT${EQGuS~OkO-a1BdTcEk+U(YQGGRBGwcoBTtGnA(ekjMEK>~Z&X&He+o@n8x1DJ6 z5&jh46aD$M5?S`Z#l6f(D-EL7PW@KyBZL{h=T@`AeGFwYueZv^U!bN6MPF<@=+bw$l=&JS7b;=GbE1cI)(i(? zC}A?_F$+uWtlb{1T27w6lV3ze zlWEaXxMCBFE#bkNvwDY1&QldFijO5096QSv0j?>tiMJDPOB8Z%ajF^+t_)3G=6|h7 zJX|^7$AmE-G9o#MiXM0d(k_jV1D zRBT3d$ss8YAtud)9w5LLU+ngFuHH6zMQ*xE`ZQl1M!9UoDHG%xVeQ^~2r+RB^7hL4 z6{jeFtiXBE?{zBtJLX40k49RnQr$>aEj?LI)s3Lu3GrahS<%Wp+Yc{P`Ud4pAjk^C zo=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eyguI-pWOZ6FrzFm1EqB?7X*yeLbO_^cuK#KX3c-_zG5^0oEHmQ)t3l!SgoqF# z`Jzua0q`f2LnDw72r0A$JPFSbkJB91wi%T26_lxeLWbIf9W#|5&c8QnM7d`Py+x8X4CUY{{o##vY!9| literal 0 HcmV?d00001 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 +