MM-58451 Add/Update Shared Channel indicator locations (#28130)

* update shared channel sidebar

* implement for direct channels

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2024-09-11 15:10:46 -06:00
коммит произвёл GitHub
родитель af503d9d45
Коммит 1d6eb20a71
9 изменённых файлов: 34 добавлений и 32 удалений

Просмотреть файл

@@ -129,14 +129,6 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
if (isArchivedChannel(channel)) { if (isArchivedChannel(channel)) {
channelTypeIcon = <ArchiveOutlineIcon size={18}/>; channelTypeIcon = <ArchiveOutlineIcon size={18}/>;
} else if (channel.shared) {
channelTypeIcon = (
<SharedChannelIndicator
className='shared-channel-icon'
channelType={channel.type}
withTooltip={true}
/>
);
} else if (isPrivateChannel(channel)) { } else if (isPrivateChannel(channel)) {
channelTypeIcon = <LockOutlineIcon size={18}/>; channelTypeIcon = <LockOutlineIcon size={18}/>;
} else { } else {
@@ -206,6 +198,14 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
</button> </button>
); );
const sharedChannelIcon = channel.shared ? (
<SharedChannelIndicator
className='shared-channel-icon'
channelType={channel.type}
withTooltip={true}
/>
) : null;
return ( return (
<div <div
className='more-modal__row' className='more-modal__row'
@@ -220,6 +220,7 @@ export class SearchableChannelList extends React.PureComponent<Props, State> {
<div className='style--none more-modal__name'> <div className='style--none more-modal__name'>
{channelTypeIcon} {channelTypeIcon}
<span id='channelName'>{channel.display_name}</span> <span id='channelName'>{channel.display_name}</span>
{sharedChannelIcon}
</div> </div>
{channelPurposeContainer} {channelPurposeContainer}
</div> </div>

Просмотреть файл

@@ -26,7 +26,6 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn
icon={ icon={
<SidebarBaseChannelIcon <SidebarBaseChannelIcon
channelType="O" channelType="O"
isSharedChannel={false}
/> />
} }
label="channel_display_name" label="channel_display_name"
@@ -60,7 +59,6 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn
icon={ icon={
<SidebarBaseChannelIcon <SidebarBaseChannelIcon
channelType="P" channelType="P"
isSharedChannel={false}
/> />
} }
label="channel_display_name" label="channel_display_name"
@@ -95,9 +93,9 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn
icon={ icon={
<SidebarBaseChannelIcon <SidebarBaseChannelIcon
channelType="O" channelType="O"
isSharedChannel={true}
/> />
} }
isSharedChannel={true}
label="channel_display_name" label="channel_display_name"
link="/team_name/channels/" link="/team_name/channels/"
/> />
@@ -130,9 +128,9 @@ exports[`components/sidebar/sidebar_channel/sidebar_base_channel should match sn
icon={ icon={
<SidebarBaseChannelIcon <SidebarBaseChannelIcon
channelType="P" channelType="P"
isSharedChannel={true}
/> />
} }
isSharedChannel={true}
label="channel_display_name" label="channel_display_name"
link="/team_name/channels/" link="/team_name/channels/"
/> />

Просмотреть файл

@@ -50,7 +50,6 @@ const SidebarBaseChannel = ({
const channelIcon = ( const channelIcon = (
<SidebarBaseChannelIcon <SidebarBaseChannelIcon
isSharedChannel={Boolean(channel.shared)}
channelType={channel.type} channelType={channel.type}
/> />
); );
@@ -70,6 +69,7 @@ const SidebarBaseChannel = ({
ariaLabelPrefix={ariaLabelPrefix} ariaLabelPrefix={ariaLabelPrefix}
channelLeaveHandler={channelLeaveHandler!} channelLeaveHandler={channelLeaveHandler!}
icon={channelIcon} icon={channelIcon}
isSharedChannel={channel.shared}
/> />
); );
}; };

Просмотреть файл

@@ -5,28 +5,15 @@ import React from 'react';
import type {ChannelType} from '@mattermost/types/channels'; import type {ChannelType} from '@mattermost/types/channels';
import SharedChannelIndicator from 'components/shared_channel_indicator';
import Constants from 'utils/constants'; import Constants from 'utils/constants';
type Props = { type Props = {
isSharedChannel: boolean;
channelType: ChannelType; channelType: ChannelType;
} }
const SidebarBaseChannelIcon = ({ const SidebarBaseChannelIcon = ({
isSharedChannel,
channelType, channelType,
}: Props) => { }: Props) => {
if (isSharedChannel) {
return (
<SharedChannelIndicator
className='icon'
channelType={channelType}
withTooltip={true}
/>
);
}
if (channelType === Constants.OPEN_CHANNEL) { if (channelType === Constants.OPEN_CHANNEL) {
return ( return (
<i className='icon icon-globe'/> <i className='icon icon-globe'/>

Просмотреть файл

@@ -10,6 +10,7 @@ import type {Channel} from '@mattermost/types/channels';
import {mark, trackEvent} from 'actions/telemetry_actions'; import {mark, trackEvent} from 'actions/telemetry_actions';
import CustomStatusEmoji from 'components/custom_status/custom_status_emoji'; import CustomStatusEmoji from 'components/custom_status/custom_status_emoji';
import SharedChannelIndicator from 'components/shared_channel_indicator';
import {ChannelsAndDirectMessagesTour} from 'components/tours/onboarding_tour'; import {ChannelsAndDirectMessagesTour} from 'components/tours/onboarding_tour';
import WithTooltip from 'components/with_tooltip'; import WithTooltip from 'components/with_tooltip';
@@ -61,6 +62,7 @@ type Props = {
hasUrgent: boolean; hasUrgent: boolean;
rhsState?: RhsState; rhsState?: RhsState;
rhsOpen?: boolean; rhsOpen?: boolean;
isSharedChannel?: boolean;
actions: { actions: {
markMostRecentPostInChannelAsUnread: (channelId: string) => void; markMostRecentPostInChannelAsUnread: (channelId: string) => void;
@@ -223,6 +225,14 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
/> />
) : null; ) : null;
const sharedChannelIcon = this.props.isSharedChannel ? (
<SharedChannelIndicator
className='icon'
channelType={channel.type}
withTooltip={true}
/>
) : null;
const content = ( const content = (
<> <>
<SidebarChannelIcon <SidebarChannelIcon
@@ -238,6 +248,7 @@ export default class SidebarChannelLink extends React.PureComponent<Props, State
pluggableName='SidebarChannelLinkLabel' pluggableName='SidebarChannelLinkLabel'
channel={this.props.channel} channel={this.props.channel}
/> />
{sharedChannelIcon}
</div> </div>
<ChannelPencilIcon id={channel.id}/> <ChannelPencilIcon id={channel.id}/>
<ChannelMentionBadge <ChannelMentionBadge

Просмотреть файл

@@ -31,6 +31,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match
wrapperClass="DirectChannel__profile-picture" wrapperClass="DirectChannel__profile-picture"
/> />
} }
isSharedChannel={false}
label="channel_display_name" label="channel_display_name"
link="/team_name/messages/@some-user" link="/team_name/messages/@some-user"
teammateId="user_id" teammateId="user_id"
@@ -69,6 +70,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match
wrapperClass="DirectChannel__profile-picture" wrapperClass="DirectChannel__profile-picture"
/> />
} }
isSharedChannel={false}
label="channel_display_name" label="channel_display_name"
link="/team_name/messages/@some-user" link="/team_name/messages/@some-user"
teammateId="user_id" teammateId="user_id"
@@ -106,6 +108,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match
wrapperClass="DirectChannel__profile-picture" wrapperClass="DirectChannel__profile-picture"
/> />
} }
isSharedChannel={false}
label="channel_display_name (you)" label="channel_display_name (you)"
link="/team_name/messages/@some-user" link="/team_name/messages/@some-user"
teammateId="user_id" teammateId="user_id"
@@ -139,6 +142,7 @@ exports[`components/sidebar/sidebar_channel/sidebar_direct_channel should match
className="icon icon-archive-outline" className="icon icon-archive-outline"
/> />
} }
isSharedChannel={false}
label="channel_display_name" label="channel_display_name"
link="/team_name/messages/@some-user" link="/team_name/messages/@some-user"
teammateId="user_id" teammateId="user_id"

Просмотреть файл

@@ -110,6 +110,7 @@ class SidebarDirectChannel extends React.PureComponent<Props> {
label={displayName} label={displayName}
channelLeaveHandler={this.handleLeaveChannel} channelLeaveHandler={this.handleLeaveChannel}
icon={this.getIcon()} icon={this.getIcon()}
isSharedChannel={teammate.remote_id !== undefined}
/> />
); );
} }

Просмотреть файл

@@ -50,10 +50,6 @@ exports[`components/UserProfile should match snapshot, when user is shared 1`] =
> >
nickname nickname
</ProfilePopoverController> </ProfilePopoverController>
<SharedUserIndicator
className="shared-user-icon"
id="sharedUserIndicator-user_id"
/>
</Fragment> </Fragment>
`; `;

Просмотреть файл

@@ -31,7 +31,6 @@ export default function UserProfile({
userId, userId,
channelId, channelId,
overwriteIcon, overwriteIcon,
isShared,
}: Props) { }: Props) {
let name: ReactNode; let name: ReactNode;
if (user && displayUsername) { if (user && displayUsername) {
@@ -62,8 +61,12 @@ export default function UserProfile({
} }
let profileImg = ''; let profileImg = '';
let userIsRemote = false;
if (user) { if (user) {
profileImg = imageURLForUser(user.id, user.last_picture_update); profileImg = imageURLForUser(user.id, user.last_picture_update);
if (user.remote_id) {
userIsRemote = true;
}
} }
return ( return (
@@ -81,10 +84,11 @@ export default function UserProfile({
> >
{name} {name}
</ProfilePopover> </ProfilePopover>
{(isShared) && {userIsRemote &&
<SharedUserIndicator <SharedUserIndicator
id={`sharedUserIndicator-${userId}`} id={`sharedUserIndicator-${userId}`}
className='shared-user-icon' className='shared-user-icon'
withTooltip={true}
/> />
} }
{(user && user.is_bot) && <BotTag/>} {(user && user.is_bot) && <BotTag/>}