WebPage: Show user background icon (#4128)

This commit is contained in:
Alexander Zinchuk 2024-01-12 12:59:57 +01:00
parent 44cbadb383
commit 1f029966ae
3 changed files with 16 additions and 2 deletions

View File

@ -1204,7 +1204,7 @@ const Message: FC<OwnProps & StateProps> = ({
theme={theme} theme={theme}
story={webPageStory} story={webPageStory}
isConnected={isConnected} isConnected={isConnected}
noUserColors={isOwn} backgroundEmojiId={sender?.color?.backgroundEmojiId}
onMediaClick={handleMediaClick} onMediaClick={handleMediaClick}
onCancelMediaTransfer={handleCancelUpload} onCancelMediaTransfer={handleCancelUpload}
/> />

View File

@ -59,10 +59,16 @@
} }
} }
&--background-icons {
color: var(--accent-color);
}
&-text { &-text {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex-grow: 1;
align-items: flex-start; align-items: flex-start;
position: relative;
} }
.media-inner { .media-inner {

View File

@ -18,6 +18,7 @@ import useEnsureStory from '../../../hooks/useEnsureStory';
import useLang from '../../../hooks/useLang'; import useLang from '../../../hooks/useLang';
import useLastCallback from '../../../hooks/useLastCallback'; import useLastCallback from '../../../hooks/useLastCallback';
import EmojiIconBackground from '../../common/embedded/EmojiIconBackground';
import SafeLink from '../../common/SafeLink'; import SafeLink from '../../common/SafeLink';
import Button from '../../ui/Button'; import Button from '../../ui/Button';
import BaseStory from './BaseStory'; import BaseStory from './BaseStory';
@ -40,7 +41,7 @@ type OwnProps = {
isDownloading?: boolean; isDownloading?: boolean;
isProtected?: boolean; isProtected?: boolean;
isConnected?: boolean; isConnected?: boolean;
noUserColors?: boolean; backgroundEmojiId?: string;
theme: ISettings['theme']; theme: ISettings['theme'];
story?: ApiTypeStory; story?: ApiTypeStory;
onMediaClick?: () => void; onMediaClick?: () => void;
@ -60,6 +61,7 @@ const WebPage: FC<OwnProps> = ({
isConnected, isConnected,
story, story,
theme, theme,
backgroundEmojiId,
onMediaClick, onMediaClick,
onCancelMediaTransfer, onCancelMediaTransfer,
}) => { }) => {
@ -162,6 +164,12 @@ const WebPage: FC<OwnProps> = ({
)} )}
{isArticle && ( {isArticle && (
<div className="WebPage-text"> <div className="WebPage-text">
{backgroundEmojiId && (
<EmojiIconBackground
emojiDocumentId={backgroundEmojiId}
className="WebPage--background-icons"
/>
)}
<SafeLink className="site-name" url={url} text={siteName || displayUrl} /> <SafeLink className="site-name" url={url} text={siteName || displayUrl} />
{!inPreview && title && ( {!inPreview && title && (
<p className="site-title">{renderText(title)}</p> <p className="site-title">{renderText(title)}</p>