Merge remote-tracking branch 'soapbox/develop' into update-emoji-mart-2
This commit is contained in:
commit
d6732955de
5 changed files with 37 additions and 9 deletions
|
@ -152,7 +152,14 @@ const Item: React.FC<IItem> = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('media-gallery__item', { standalone })} key={attachment.id} style={{ position, float, left, top, right, bottom, height, width: `${width}%` }}>
|
<div
|
||||||
|
className={clsx('media-gallery__item', {
|
||||||
|
standalone,
|
||||||
|
'rounded-md': total > 1,
|
||||||
|
})}
|
||||||
|
key={attachment.id}
|
||||||
|
style={{ position, float, left, top, right, bottom, height, width: `${width}%` }}
|
||||||
|
>
|
||||||
<a className='media-gallery__item-thumbnail' href={attachment.url} target='_blank' style={{ cursor: 'pointer' }}>
|
<a className='media-gallery__item-thumbnail' href={attachment.url} target='_blank' style={{ cursor: 'pointer' }}>
|
||||||
<Blurhash hash={attachment.blurhash} className='media-gallery__preview' />
|
<Blurhash hash={attachment.blurhash} className='media-gallery__preview' />
|
||||||
<span className='media-gallery__item__icons'>{attachmentIcon}</span>
|
<span className='media-gallery__item__icons'>{attachmentIcon}</span>
|
||||||
|
@ -245,7 +252,14 @@ const Item: React.FC<IItem> = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('media-gallery__item', `media-gallery__item--${attachment.type}`, { standalone })} key={attachment.id} style={{ position, float, left, top, right, bottom, height, width: `${width}%` }}>
|
<div
|
||||||
|
className={clsx('media-gallery__item', `media-gallery__item--${attachment.type}`, {
|
||||||
|
standalone,
|
||||||
|
'rounded-md': total > 1,
|
||||||
|
})}
|
||||||
|
key={attachment.id}
|
||||||
|
style={{ position, float, left, top, right, bottom, height, width: `${width}%` }}
|
||||||
|
>
|
||||||
{last && total > ATTACHMENT_LIMIT && (
|
{last && total > ATTACHMENT_LIMIT && (
|
||||||
<div className='media-gallery__item-overflow'>
|
<div className='media-gallery__item-overflow'>
|
||||||
+{total - ATTACHMENT_LIMIT + 1}
|
+{total - ATTACHMENT_LIMIT + 1}
|
||||||
|
@ -260,7 +274,7 @@ const Item: React.FC<IItem> = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IMediaGallery {
|
export interface IMediaGallery {
|
||||||
sensitive?: boolean
|
sensitive?: boolean
|
||||||
media: ImmutableList<Attachment>
|
media: ImmutableList<Attachment>
|
||||||
height?: number
|
height?: number
|
||||||
|
@ -270,13 +284,15 @@ interface IMediaGallery {
|
||||||
visible?: boolean
|
visible?: boolean
|
||||||
onToggleVisibility?: () => void
|
onToggleVisibility?: () => void
|
||||||
displayMedia?: string
|
displayMedia?: string
|
||||||
compact: boolean
|
compact?: boolean
|
||||||
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const MediaGallery: React.FC<IMediaGallery> = (props) => {
|
const MediaGallery: React.FC<IMediaGallery> = (props) => {
|
||||||
const {
|
const {
|
||||||
media,
|
media,
|
||||||
defaultWidth = 0,
|
defaultWidth = 0,
|
||||||
|
className,
|
||||||
onOpenMedia,
|
onOpenMedia,
|
||||||
cacheWidth,
|
cacheWidth,
|
||||||
compact,
|
compact,
|
||||||
|
@ -546,7 +562,11 @@ const MediaGallery: React.FC<IMediaGallery> = (props) => {
|
||||||
}, [node.current]);
|
}, [node.current]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={clsx('media-gallery', { 'media-gallery--compact': compact })} style={sizeData.style} ref={node}>
|
<div
|
||||||
|
className={clsx(className, 'media-gallery', { 'media-gallery--compact': compact })}
|
||||||
|
style={sizeData.style}
|
||||||
|
ref={node}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import ChatMessageReaction from './chat-message-reaction';
|
||||||
import ChatMessageReactionWrapper from './chat-message-reaction-wrapper/chat-message-reaction-wrapper';
|
import ChatMessageReactionWrapper from './chat-message-reaction-wrapper/chat-message-reaction-wrapper';
|
||||||
|
|
||||||
import type { Menu as IMenu } from 'soapbox/components/dropdown-menu';
|
import type { Menu as IMenu } from 'soapbox/components/dropdown-menu';
|
||||||
|
import type { IMediaGallery } from 'soapbox/components/media-gallery';
|
||||||
import type { ChatMessage as ChatMessageEntity } from 'soapbox/types/entities';
|
import type { ChatMessage as ChatMessageEntity } from 'soapbox/types/entities';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -112,8 +113,12 @@ const ChatMessage = (props: IChatMessage) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Bundle fetchComponent={MediaGallery}>
|
<Bundle fetchComponent={MediaGallery}>
|
||||||
{(Component: any) => (
|
{(Component: React.FC<IMediaGallery>) => (
|
||||||
<Component
|
<Component
|
||||||
|
className={clsx({
|
||||||
|
'rounded-br-sm': isMyMessage && content,
|
||||||
|
'rounded-bl-sm': !isMyMessage && content,
|
||||||
|
})}
|
||||||
media={chatMessage.media_attachments}
|
media={chatMessage.media_attachments}
|
||||||
onOpenMedia={onOpenMedia}
|
onOpenMedia={onOpenMedia}
|
||||||
visible
|
visible
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
$media-compact-size: 50px;
|
$media-compact-size: 50px;
|
||||||
|
|
||||||
.media-gallery {
|
.media-gallery {
|
||||||
|
@apply rounded-lg;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 10px;
|
|
||||||
isolation: isolate;
|
isolation: isolate;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
|
@apply rounded-sm;
|
||||||
border: 0;
|
border: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: block;
|
display: block;
|
||||||
float: left;
|
float: left;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 10px;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
&__icons {
|
&__icons {
|
||||||
|
|
|
@ -15,7 +15,9 @@ NODE_ENV=development
|
||||||
- `yarn build` - Compile without a dev server, into `/static` directory.
|
- `yarn build` - Compile without a dev server, into `/static` directory.
|
||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
- `yarn manage:translations` - Normalizes translation files. Should always be run after editing i18n strings.
|
- `yarn i18n` - Rebuilds app and updates English locale to prepare for translations in other languages. Should always be run after editing i18n strings.
|
||||||
|
|
||||||
|
- `yarn manage:translations` - A low-level translations manager utility.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
- `yarn test:all` - Runs all tests and linters.
|
- `yarn test:all` - Runs all tests and linters.
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"build": "npx webpack",
|
"build": "npx webpack",
|
||||||
"audit:fix": "npx yarn-audit-fix",
|
"audit:fix": "npx yarn-audit-fix",
|
||||||
"manage:translations": "npx ts-node ./scripts/translationRunner.ts",
|
"manage:translations": "npx ts-node ./scripts/translationRunner.ts",
|
||||||
|
"i18n": "rm -rf build tmp && npx cross-env NODE_ENV=production ${npm_execpath} run build && ${npm_execpath} manage:translations en",
|
||||||
"test": "npx cross-env NODE_ENV=test npx jest",
|
"test": "npx cross-env NODE_ENV=test npx jest",
|
||||||
"test:coverage": "${npm_execpath} run test --coverage",
|
"test:coverage": "${npm_execpath} run test --coverage",
|
||||||
"test:all": "${npm_execpath} run test:coverage && ${npm_execpath} run lint",
|
"test:all": "${npm_execpath} run test:coverage && ${npm_execpath} run lint",
|
||||||
|
|
Loading…
Reference in a new issue