Profile: Fix styles for status background (#6636)
This commit is contained in:
parent
7c00f507ae
commit
184c2a88e8
@ -88,6 +88,7 @@ type OwnProps = {
|
|||||||
loopIndefinitely?: boolean;
|
loopIndefinitely?: boolean;
|
||||||
noPersonalPhoto?: boolean;
|
noPersonalPhoto?: boolean;
|
||||||
asMessageBubble?: boolean;
|
asMessageBubble?: boolean;
|
||||||
|
storyCircleStyle?: string;
|
||||||
observeIntersection?: ObserveFn;
|
observeIntersection?: ObserveFn;
|
||||||
onClick?: (e: ReactMouseEvent<HTMLDivElement, MouseEvent>, hasMedia: boolean) => void;
|
onClick?: (e: ReactMouseEvent<HTMLDivElement, MouseEvent>, hasMedia: boolean) => void;
|
||||||
onContextMenu?: (e: React.MouseEvent) => void;
|
onContextMenu?: (e: React.MouseEvent) => void;
|
||||||
@ -118,6 +119,7 @@ const Avatar = ({
|
|||||||
loopIndefinitely,
|
loopIndefinitely,
|
||||||
noPersonalPhoto,
|
noPersonalPhoto,
|
||||||
asMessageBubble,
|
asMessageBubble,
|
||||||
|
storyCircleStyle,
|
||||||
onClick,
|
onClick,
|
||||||
onContextMenu,
|
onContextMenu,
|
||||||
onMouseMove,
|
onMouseMove,
|
||||||
@ -334,6 +336,7 @@ const Avatar = ({
|
|||||||
size={pxSize}
|
size={pxSize}
|
||||||
withExtraGap={withStoryGap}
|
withExtraGap={withStoryGap}
|
||||||
colors={storyColors}
|
colors={storyColors}
|
||||||
|
style={storyCircleStyle}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import type { ThemeKey } from '../../types';
|
|||||||
|
|
||||||
import { selectPeerStories, selectTheme } from '../../global/selectors';
|
import { selectPeerStories, selectTheme } from '../../global/selectors';
|
||||||
import buildClassName from '../../util/buildClassName';
|
import buildClassName from '../../util/buildClassName';
|
||||||
|
import buildStyle from '../../util/buildStyle';
|
||||||
import { REM } from './helpers/mediaDimensions';
|
import { REM } from './helpers/mediaDimensions';
|
||||||
|
|
||||||
import useDevicePixelRatio from '../../hooks/window/useDevicePixelRatio';
|
import useDevicePixelRatio from '../../hooks/window/useDevicePixelRatio';
|
||||||
@ -18,6 +19,7 @@ interface OwnProps {
|
|||||||
size: number;
|
size: number;
|
||||||
withExtraGap?: boolean;
|
withExtraGap?: boolean;
|
||||||
colors?: string[];
|
colors?: string[];
|
||||||
|
style?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StateProps {
|
interface StateProps {
|
||||||
@ -52,6 +54,7 @@ function AvatarStoryCircle({
|
|||||||
withExtraGap,
|
withExtraGap,
|
||||||
appTheme,
|
appTheme,
|
||||||
colors,
|
colors,
|
||||||
|
style,
|
||||||
}: OwnProps & StateProps) {
|
}: OwnProps & StateProps) {
|
||||||
const ref = useRef<HTMLCanvasElement>();
|
const ref = useRef<HTMLCanvasElement>();
|
||||||
|
|
||||||
@ -113,7 +116,7 @@ function AvatarStoryCircle({
|
|||||||
<canvas
|
<canvas
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={buildClassName('story-circle', className)}
|
className={buildClassName('story-circle', className)}
|
||||||
style={`max-width: ${adaptedSize}px; max-height: ${adaptedSize}px;`}
|
style={buildStyle(`max-width: ${adaptedSize}px`, `max-height: ${adaptedSize}px`, style)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -405,6 +405,10 @@
|
|||||||
grid-area: 1 / -1;
|
grid-area: 1 / -1;
|
||||||
|
|
||||||
@include mixins.with-vt-type('profileAvatar');
|
@include mixins.with-vt-type('profileAvatar');
|
||||||
|
|
||||||
|
:global(.story-circle) {
|
||||||
|
@include mixins.with-vt-type('profileAvatar');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.activeProfilePhoto {
|
.activeProfilePhoto {
|
||||||
@ -449,6 +453,14 @@
|
|||||||
&::view-transition-group(.photoDashes) {
|
&::view-transition-group(.photoDashes) {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&::view-transition-group(.avatarStoryCircle) {
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::view-transition-group(.profileInfo) {
|
||||||
|
z-index: -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@include mixins.on-active-vt('profileExpand') {
|
@include mixins.on-active-vt('profileExpand') {
|
||||||
|
|||||||
@ -585,6 +585,7 @@ const ProfileInfo = ({
|
|||||||
size="jumbo"
|
size="jumbo"
|
||||||
peer={peer}
|
peer={peer}
|
||||||
style={createVtnStyle('avatar', true)}
|
style={createVtnStyle('avatar', true)}
|
||||||
|
storyCircleStyle={createVtnStyle('avatarStoryCircle', true)}
|
||||||
onClick={hasAvatar ? handleMinimizedAvatarClick : undefined}
|
onClick={hasAvatar ? handleMinimizedAvatarClick : undefined}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { getHasAdminRight, isChatAdmin, isChatChannel, isDeletedUser } from '../
|
|||||||
import { selectChat, selectChatFullInfo, selectIsMonoforumAdmin } from './chats';
|
import { selectChat, selectChatFullInfo, selectIsMonoforumAdmin } from './chats';
|
||||||
import { type ProfileCollectionKey } from './payments';
|
import { type ProfileCollectionKey } from './payments';
|
||||||
import { selectTabState } from './tabs';
|
import { selectTabState } from './tabs';
|
||||||
|
import { selectPeerProfileColor } from './ui';
|
||||||
import { selectBot, selectUser, selectUserFullInfo } from './users';
|
import { selectBot, selectUser, selectUserFullInfo } from './users';
|
||||||
|
|
||||||
export function selectPeer<T extends GlobalState>(global: T, peerId: string): ApiPeer | undefined {
|
export function selectPeer<T extends GlobalState>(global: T, peerId: string): ApiPeer | undefined {
|
||||||
@ -72,10 +73,12 @@ export function selectPeerPaidMessagesStars<T extends GlobalState>(
|
|||||||
|
|
||||||
export function selectPeerHasProfileBackground<T extends GlobalState>(global: T, peerId: string) {
|
export function selectPeerHasProfileBackground<T extends GlobalState>(global: T, peerId: string) {
|
||||||
const peer = selectPeer(global, peerId);
|
const peer = selectPeer(global, peerId);
|
||||||
const profileColor = peer?.profileColor;
|
if (!peer) return false;
|
||||||
if (profileColor?.type === 'collectible') return true;
|
const profileColor = selectPeerProfileColor(global, peer);
|
||||||
if (profileColor?.type === 'regular') return profileColor.color !== undefined;
|
|
||||||
return peer?.emojiStatus?.type === 'collectible';
|
if (peer.profileColor?.type === 'collectible') return true;
|
||||||
|
if (peer.emojiStatus?.type === 'collectible') return true;
|
||||||
|
return Boolean(profileColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectCanUpdateMainTab<T extends GlobalState>(global: T, peerId: string) {
|
export function selectCanUpdateMainTab<T extends GlobalState>(global: T, peerId: string) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user