From 5dda094daa56dc13d50ac0734957ac5f6a9482de Mon Sep 17 00:00:00 2001 From: diondiondion Date: Fri, 23 May 2025 09:07:05 +0200 Subject: [PATCH] fix: Fix various UI text wrapping and overflow issues (#34774) --- .../mastodon/components/avatar_group.tsx | 8 ++++- .../mastodon/components/more_from_author.jsx | 17 ---------- .../mastodon/components/more_from_author.tsx | 21 ++++++++++++ .../notification_group_with_status.tsx | 15 +++++++-- .../styles/mastodon/components.scss | 33 +++++++++++-------- 5 files changed, 60 insertions(+), 34 deletions(-) delete mode 100644 app/javascript/mastodon/components/more_from_author.jsx create mode 100644 app/javascript/mastodon/components/more_from_author.tsx diff --git a/app/javascript/mastodon/components/avatar_group.tsx b/app/javascript/mastodon/components/avatar_group.tsx index 2420728542..a629568693 100644 --- a/app/javascript/mastodon/components/avatar_group.tsx +++ b/app/javascript/mastodon/components/avatar_group.tsx @@ -7,10 +7,16 @@ import classNames from 'classnames'; export const AvatarGroup: React.FC<{ compact?: boolean; + avatarHeight?: number; children: React.ReactNode; -}> = ({ children, compact = false }) => ( +}> = ({ children, compact = false, avatarHeight }) => (
{children}
diff --git a/app/javascript/mastodon/components/more_from_author.jsx b/app/javascript/mastodon/components/more_from_author.jsx deleted file mode 100644 index 719f4dda86..0000000000 --- a/app/javascript/mastodon/components/more_from_author.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import PropTypes from 'prop-types'; - -import { FormattedMessage } from 'react-intl'; - -import { IconLogo } from 'mastodon/components/logo'; -import { AuthorLink } from 'mastodon/features/explore/components/author_link'; - -export const MoreFromAuthor = ({ accountId }) => ( -
- - }} /> -
-); - -MoreFromAuthor.propTypes = { - accountId: PropTypes.string.isRequired, -}; diff --git a/app/javascript/mastodon/components/more_from_author.tsx b/app/javascript/mastodon/components/more_from_author.tsx new file mode 100644 index 0000000000..5075a29d3d --- /dev/null +++ b/app/javascript/mastodon/components/more_from_author.tsx @@ -0,0 +1,21 @@ +import { FormattedMessage } from 'react-intl'; + +import { IconLogo } from 'mastodon/components/logo'; +import { AuthorLink } from 'mastodon/features/explore/components/author_link'; + +export const MoreFromAuthor: React.FC<{ accountId: string }> = ({ + accountId, +}) => ( + }} + > + {(chunks) => ( +
+ + {chunks} +
+ )} +
+); diff --git a/app/javascript/mastodon/features/notifications_v2/components/notification_group_with_status.tsx b/app/javascript/mastodon/features/notifications_v2/components/notification_group_with_status.tsx index b0b86eead1..e7ed8792f6 100644 --- a/app/javascript/mastodon/features/notifications_v2/components/notification_group_with_status.tsx +++ b/app/javascript/mastodon/features/notifications_v2/components/notification_group_with_status.tsx @@ -18,12 +18,14 @@ import { useAppSelector, useAppDispatch } from 'mastodon/store'; import { DisplayedName } from './displayed_name'; import { EmbeddedStatus } from './embedded_status'; +const AVATAR_SIZE = 28; + export const AvatarById: React.FC<{ accountId: string }> = ({ accountId }) => { const account = useAppSelector((state) => state.accounts.get(accountId)); if (!account) return null; - return ; + return ; }; export type LabelRenderer = ( @@ -108,7 +110,7 @@ export const NotificationGroupWithStatus: React.FC<{
- + {accountIds .slice(0, NOTIFICATIONS_GROUP_MAX_AVATARS) .map((id) => ( @@ -123,7 +125,14 @@ export const NotificationGroupWithStatus: React.FC<{
{label} - {timestamp && } + {timestamp && ( + <> + + · + + + + )}
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index dd513af737..b68edcae69 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -2253,14 +2253,18 @@ a .account__avatar { .avatar-group { display: flex; - gap: 8px; - flex-wrap: wrap; + + --avatar-height: 28px; + + &:not(.avatar-group--compact) { + gap: 8px; + flex-wrap: wrap; + height: var(--avatar-height); + overflow-y: clip; + } } .avatar-group--compact { - gap: 0; - flex-wrap: nowrap; - & > :not(:first-child) { margin-inline-start: -12px; } @@ -10412,7 +10416,8 @@ noscript { padding: 15px; display: flex; align-items: center; - gap: 8px; + flex-wrap: wrap; + gap: 4px 8px; .logo { width: 16px; @@ -10506,12 +10511,6 @@ noscript { overflow: hidden; container-type: inline-size; - @container (width < 350px) { - &__header time { - display: none; - } - } - &__header { display: flex; flex-direction: column; @@ -10524,7 +10523,8 @@ noscript { &__label { display: flex; - gap: 8px; + flex-wrap: wrap; + gap: 2px 8px; font-size: 15px; line-height: 22px; color: $darker-text-color; @@ -10542,6 +10542,13 @@ noscript { time { color: $dark-text-color; } + + @container (width < 350px) { + time, + &-separator { + display: none; + } + } } }