mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-05 01:10:49 +00:00
Further tweaks for media gallery
This commit is contained in:
@@ -6856,6 +6856,10 @@
|
|||||||
"messageformat": "No Links",
|
"messageformat": "No Links",
|
||||||
"description": "Title of the empty state view of media gallery for links tab"
|
"description": "Title of the empty state view of media gallery for links tab"
|
||||||
},
|
},
|
||||||
|
"icu:MediaGallery__EmptyState__description--links-2": {
|
||||||
|
"messageformat": "Links that you send and receive will appear here",
|
||||||
|
"description": "Description of the empty state view of media gallery for links tab"
|
||||||
|
},
|
||||||
"icu:MediaGallery__EmptyState__description--documents": {
|
"icu:MediaGallery__EmptyState__description--documents": {
|
||||||
"messageformat": "Links that you send and receive will appear here",
|
"messageformat": "Links that you send and receive will appear here",
|
||||||
"description": "Description of the empty state view of media gallery for links tab"
|
"description": "Description of the empty state view of media gallery for links tab"
|
||||||
@@ -6864,6 +6868,10 @@
|
|||||||
"messageformat": "No Files",
|
"messageformat": "No Files",
|
||||||
"description": "Title of the empty state view of media gallery for files tab"
|
"description": "Title of the empty state view of media gallery for files tab"
|
||||||
},
|
},
|
||||||
|
"icu:MediaGallery__EmptyState__description--documents-2": {
|
||||||
|
"messageformat": "Files that you send and receive will appear here",
|
||||||
|
"description": "Description of the empty state view of media gallery for files tab"
|
||||||
|
},
|
||||||
"icu:MediaGallery__EmptyState__description--links": {
|
"icu:MediaGallery__EmptyState__description--links": {
|
||||||
"messageformat": "Files that you send and receive will appear here",
|
"messageformat": "Files that you send and receive will appear here",
|
||||||
"description": "Description of the empty state view of media gallery for files tab"
|
"description": "Description of the empty state view of media gallery for files tab"
|
||||||
|
|||||||
@@ -2464,44 +2464,6 @@ button.ConversationDetails__action-button {
|
|||||||
margin-inline-start: 16px;
|
margin-inline-start: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module: Media Gallery
|
|
||||||
|
|
||||||
.module-media-gallery {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-grow: 1;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.module-media-gallery__content {
|
|
||||||
flex-grow: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.module-media-gallery__scroll-observer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
height: 30px;
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
content: '';
|
|
||||||
height: 1px; // Always show the element to not mess with the height of the scroll area
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.module-media-gallery__sections {
|
|
||||||
min-width: 0;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
flex-grow: 1;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Module: Message Request Actions
|
// Module: Message Request Actions
|
||||||
|
|
||||||
.module-message-request-actions {
|
.module-message-request-actions {
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ export function AttachmentSection({
|
|||||||
case 'audio':
|
case 'audio':
|
||||||
case 'link':
|
case 'link':
|
||||||
return (
|
return (
|
||||||
<section className={tw('mx-4 mb-3 border-b-border-primary px-2 pb-3')}>
|
<section>
|
||||||
<h2 className={tw('pt-1.5 pb-2 type-body-medium')}>{header}</h2>
|
<h2 className={tw('px-6 pt-1.5 pb-2 type-body-medium')}>{header}</h2>
|
||||||
<div>
|
<div>
|
||||||
{verified.entries.map(mediaItem => {
|
{verified.entries.map(mediaItem => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ export function EmptyState({ i18n, tab }: Props): JSX.Element {
|
|||||||
case TabViews.Documents:
|
case TabViews.Documents:
|
||||||
title = i18n('icu:MediaGallery__EmptyState__title--documents');
|
title = i18n('icu:MediaGallery__EmptyState__title--documents');
|
||||||
description = i18n(
|
description = i18n(
|
||||||
'icu:MediaGallery__EmptyState__description--documents'
|
'icu:MediaGallery__EmptyState__description--documents-2'
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case TabViews.Links:
|
case TabViews.Links:
|
||||||
title = i18n('icu:MediaGallery__EmptyState__title--links');
|
title = i18n('icu:MediaGallery__EmptyState__title--links');
|
||||||
description = i18n('icu:MediaGallery__EmptyState__description--links');
|
description = i18n('icu:MediaGallery__EmptyState__description--links-2');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw missingCaseError(tab);
|
throw missingCaseError(tab);
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ export function LinkPreviewItem({
|
|||||||
<div
|
<div
|
||||||
className={tw(
|
className={tw(
|
||||||
'flex size-9 items-center justify-center',
|
'flex size-9 items-center justify-center',
|
||||||
'overflow-hidden rounded-sm bg-label-secondary'
|
'overflow-hidden rounded-sm',
|
||||||
|
'bg-elevated-background-tertiary text-label-secondary'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<AxoSymbol.Icon symbol="link" size={20} label={null} />
|
<AxoSymbol.Icon symbol="link" size={20} label={null} />
|
||||||
|
|||||||
@@ -124,7 +124,10 @@ export function ListItem({
|
|||||||
return (
|
return (
|
||||||
<AriaClickable.Root
|
<AriaClickable.Root
|
||||||
className={tw(
|
className={tw(
|
||||||
'flex w-full flex-row gap-3 py-2',
|
'mx-2.5 flex flex-row gap-3 rounded-lg px-3.5 py-2',
|
||||||
|
'data-hovered:bg-fill-secondary',
|
||||||
|
'data-focused:bg-fill-secondary',
|
||||||
|
'data-pressed:bg-fill-secondary-pressed',
|
||||||
mediaItem.type === 'link' ? undefined : 'items-center'
|
mediaItem.type === 'link' ? undefined : 'items-center'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2018 Signal Messenger, LLC
|
// Copyright 2018 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React, { useEffect, useRef, useCallback } from 'react';
|
import React, { Fragment, useEffect, useRef, useCallback } from 'react';
|
||||||
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
@@ -133,7 +133,12 @@ function MediaSection({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const sections = groupMediaItemsByDate(now, mediaItems).map(section => {
|
const groupedItems = groupMediaItemsByDate(now, mediaItems);
|
||||||
|
|
||||||
|
const isGrid = mediaItems.at(0)?.type === 'media';
|
||||||
|
|
||||||
|
const sections = groupedItems.map((section, index) => {
|
||||||
|
const isLast = index === groupedItems.length - 1;
|
||||||
const first = section.mediaItems[0];
|
const first = section.mediaItems[0];
|
||||||
const { message } = first;
|
const { message } = first;
|
||||||
const date = moment(message.receivedAtMs || message.receivedAt);
|
const date = moment(message.receivedAtMs || message.receivedAt);
|
||||||
@@ -158,25 +163,24 @@ function MediaSection({
|
|||||||
const header = getHeader();
|
const header = getHeader();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AttachmentSection
|
<Fragment key={header}>
|
||||||
key={header}
|
<AttachmentSection
|
||||||
header={header}
|
header={header}
|
||||||
mediaItems={section.mediaItems}
|
mediaItems={section.mediaItems}
|
||||||
onItemClick={onItemClick}
|
onItemClick={onItemClick}
|
||||||
renderMediaItem={renderMediaItem}
|
renderMediaItem={renderMediaItem}
|
||||||
/>
|
/>
|
||||||
|
{!isGrid && !isLast && (
|
||||||
|
<hr
|
||||||
|
className={tw('mx-4 my-3 border-[0.5px] border-border-primary')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const isGrid = mediaItems.at(0)?.type === 'media';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className={tw('flex max-w-[660px] min-w-[360px] grow flex-col')}>
|
||||||
className={tw(
|
|
||||||
'flex min-w-0 grow flex-col',
|
|
||||||
isGrid ? undefined : 'divide-y'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{sections}
|
{sections}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -308,7 +312,11 @@ export function MediaGallery({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="module-media-gallery" tabIndex={-1} ref={focusRef}>
|
<div
|
||||||
|
className={tw('flex size-full grow flex-col outline-none')}
|
||||||
|
tabIndex={-1}
|
||||||
|
ref={focusRef}
|
||||||
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
initialSelectedTab={TabViews.Media}
|
initialSelectedTab={TabViews.Media}
|
||||||
tabs={[
|
tabs={[
|
||||||
@@ -352,7 +360,14 @@ export function MediaGallery({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{renderMiniPlayer()}
|
{renderMiniPlayer()}
|
||||||
<div className="module-media-gallery__content">
|
<div
|
||||||
|
className={tw(
|
||||||
|
'grow',
|
||||||
|
'flex flex-col justify-center-safe',
|
||||||
|
'overflow-x-hidden overflow-y-auto',
|
||||||
|
'p-5'
|
||||||
|
)}
|
||||||
|
>
|
||||||
<MediaSection
|
<MediaSection
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
@@ -365,15 +380,12 @@ export function MediaGallery({
|
|||||||
playAudio={playAudio}
|
playAudio={playAudio}
|
||||||
renderMediaItem={renderMediaItem}
|
renderMediaItem={renderMediaItem}
|
||||||
/>
|
/>
|
||||||
|
<div ref={scrollObserverRef} className={tw('h-px')} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<div
|
|
||||||
ref={scrollObserverRef}
|
|
||||||
className="module-media-gallery__scroll-observer"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user