[Glitch] fix: Fix various UI text wrapping and overflow issues

Port 5dda094daa to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion
2025-05-23 09:07:05 +02:00
committed by Claire
parent 4c67a70159
commit 964e8f7cf8
5 changed files with 60 additions and 34 deletions

View File

@@ -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 }) => (
<div
className={classNames('avatar-group', { 'avatar-group--compact': compact })}
style={
avatarHeight
? ({ '--avatar-height': `${avatarHeight}px` } as React.CSSProperties)
: undefined
}
>
{children}
</div>

View File

@@ -1,17 +0,0 @@
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { IconLogo } from 'flavours/glitch/components/logo';
import { AuthorLink } from 'flavours/glitch/features/explore/components/author_link';
export const MoreFromAuthor = ({ accountId }) => (
<div className='more-from-author'>
<IconLogo />
<FormattedMessage id='link_preview.more_from_author' defaultMessage='More from {name}' values={{ name: <AuthorLink accountId={accountId} /> }} />
</div>
);
MoreFromAuthor.propTypes = {
accountId: PropTypes.string.isRequired,
};

View File

@@ -0,0 +1,21 @@
import { FormattedMessage } from 'react-intl';
import { IconLogo } from 'flavours/glitch/components/logo';
import { AuthorLink } from 'flavours/glitch/features/explore/components/author_link';
export const MoreFromAuthor: React.FC<{ accountId: string }> = ({
accountId,
}) => (
<FormattedMessage
id='link_preview.more_from_author'
defaultMessage='More from {name}'
values={{ name: <AuthorLink accountId={accountId} /> }}
>
{(chunks) => (
<div className='more-from-author'>
<IconLogo />
{chunks}
</div>
)}
</FormattedMessage>
);

View File

@@ -18,12 +18,14 @@ import { useAppSelector, useAppDispatch } from 'flavours/glitch/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 <Avatar withLink account={account} size={28} />;
return <Avatar withLink account={account} size={AVATAR_SIZE} />;
};
export type LabelRenderer = (
@@ -108,7 +110,7 @@ export const NotificationGroupWithStatus: React.FC<{
<div className='notification-group__main'>
<div className='notification-group__main__header'>
<div className='notification-group__main__header__wrapper'>
<AvatarGroup>
<AvatarGroup avatarHeight={AVATAR_SIZE}>
{accountIds
.slice(0, NOTIFICATIONS_GROUP_MAX_AVATARS)
.map((id) => (
@@ -123,7 +125,14 @@ export const NotificationGroupWithStatus: React.FC<{
<div className='notification-group__main__header__label'>
{label}
{timestamp && <RelativeTimestamp timestamp={timestamp} />}
{timestamp && (
<>
<span className='notification-group__main__header__label-separator'>
&middot;
</span>
<RelativeTimestamp timestamp={timestamp} />
</>
)}
</div>
</div>

View File

@@ -2235,14 +2235,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;
}
@@ -10643,7 +10647,8 @@ noscript {
padding: 15px;
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
gap: 4px 8px;
.logo {
width: 16px;
@@ -10737,12 +10742,6 @@ noscript {
overflow: hidden;
container-type: inline-size;
@container (width < 350px) {
&__header time {
display: none;
}
}
&__header {
display: flex;
flex-direction: column;
@@ -10755,7 +10754,8 @@ noscript {
&__label {
display: flex;
gap: 8px;
flex-wrap: wrap;
gap: 2px 8px;
font-size: 15px;
line-height: 22px;
color: $darker-text-color;
@@ -10773,6 +10773,13 @@ noscript {
time {
color: $dark-text-color;
}
@container (width < 350px) {
time,
&-separator {
display: none;
}
}
}
}