diff --git a/app/soapbox/components/ui/text/text.tsx b/app/soapbox/components/ui/text/text.tsx index 221c070fc..bd3d0e86f 100644 --- a/app/soapbox/components/ui/text/text.tsx +++ b/app/soapbox/components/ui/text/text.tsx @@ -51,7 +51,7 @@ const families = { }; export type Sizes = keyof typeof sizes -type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' +type Tags = 'abbr' | 'p' | 'span' | 'pre' | 'time' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'div' type Directions = 'ltr' | 'rtl' interface IText extends Pick, 'dangerouslySetInnerHTML' | 'tabIndex' | 'lang'> { diff --git a/app/soapbox/features/status/components/detailed-status.tsx b/app/soapbox/features/status/components/detailed-status.tsx index a1fdc5434..8405f5bed 100644 --- a/app/soapbox/features/status/components/detailed-status.tsx +++ b/app/soapbox/features/status/components/detailed-status.tsx @@ -127,7 +127,7 @@ const DetailedStatus: React.FC = ({ - + diff --git a/app/soapbox/features/status/components/status-interaction-bar.tsx b/app/soapbox/features/status/components/status-interaction-bar.tsx index a0abcf98e..f888cb059 100644 --- a/app/soapbox/features/status/components/status-interaction-bar.tsx +++ b/app/soapbox/features/status/components/status-interaction-bar.tsx @@ -1,11 +1,11 @@ import classNames from 'clsx'; -import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; +import { List as ImmutableList } from 'immutable'; import React from 'react'; -import { FormattedNumber } from 'react-intl'; +import { FormattedMessage, FormattedNumber } from 'react-intl'; import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; -import { HStack, IconButton, Text, Emoji } from 'soapbox/components/ui'; +import { HStack, Text, Emoji } from 'soapbox/components/ui'; import { useAppSelector, useSoapboxConfig, useFeatures } from 'soapbox/hooks'; import { reduceEmoji } from 'soapbox/utils/emoji-reacts'; @@ -42,11 +42,10 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. })); }; - const onOpenReactionsModal = (username: string, statusId: string, reaction: string): void => { + const onOpenReactionsModal = (username: string, statusId: string): void => { dispatch(openModal('REACTIONS', { username, statusId, - reaction, })); }; @@ -56,7 +55,7 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. status.favourites_count, status.favourited, allowedEmoji, - ).reverse(); + ); }; const handleOpenReblogsModal: React.EventHandler = (e) => { @@ -69,22 +68,17 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. const getReposts = () => { if (status.reblogs_count) { return ( - - + - - - - - + ); } - return ''; + return null; }; const handleOpenFavouritesModal: React.EventHandler> = (e) => { @@ -97,31 +91,25 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. const getFavourites = () => { if (status.favourites_count) { return ( - - + - - - - - + ); } - return ''; + return null; }; - const handleOpenReactionsModal = (reaction: ImmutableMap) => () => { - if (!me) onOpenUnauthorizedModal(); - else onOpenReactionsModal(account.acct, status.id, String(reaction.get('name'))); + const handleOpenReactionsModal = () => { + if (!me) { + return onOpenUnauthorizedModal(); + } + + onOpenReactionsModal(account.acct, status.id); }; const getEmojiReacts = () => { @@ -130,43 +118,67 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. acc + cur.get('count') ), 0); - if (count > 0) { + if (count) { return ( - -
- {emojiReacts.map((e, i) => { + + + {emojiReacts.take(3).map((e, i) => { return ( - - - - - - + ); })} -
- - - - -
+
+ ); } - return ''; + return null; }; return ( {getReposts()} - {features.emojiReacts ? getEmojiReacts() : getFavourites()} ); }; +interface IInteractionCounter { + count: number, + onClick?: React.MouseEventHandler, + children: React.ReactNode, +} + +const InteractionCounter: React.FC = ({ count, onClick, children }) => { + const features = useFeatures(); + + return ( + + ); +}; + export default StatusInteractionBar; diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index bac5c3ea6..6cda575a6 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -994,6 +994,8 @@ "status.in_review_summary.summary": "This post has been sent to Moderation for review and is only visible to you.", "status.in_review_summary.contact": "If you believe this is in error please {link}.", "status.in_review_summary.link": "Contact Support", + "status.interactions.reblogs": "{count, plural, one {Repost} other {Reposts}}", + "status.interactions.favourites": "{count, plural, one {Like} other {Likes}}", "status.load_more": "Load more", "status.media_hidden": "Media hidden", "status.mention": "Mention @{name}", diff --git a/tailwind.config.js b/tailwind.config.js index 7d562327b..1e2625c6f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -42,6 +42,9 @@ module.exports = { 'mono', ], }, + spacing: { + '4.5': '1.125rem', + }, colors: parseColorMatrix({ // Define color matrix (of available colors) // Colors are configured at runtime with CSS variables in soapbox.json