Changeset View
Changeset View
Standalone View
Standalone View
native/chat/settings/thread-settings-member.react.js
Show All 10 Lines | |||||
} from 'react-native'; | } from 'react-native'; | ||||
import { | import { | ||||
removeUsersFromThreadActionTypes, | removeUsersFromThreadActionTypes, | ||||
changeThreadMemberRolesActionTypes, | changeThreadMemberRolesActionTypes, | ||||
} from 'lib/actions/thread-actions.js'; | } from 'lib/actions/thread-actions.js'; | ||||
import { useENSNames } from 'lib/hooks/ens-cache.js'; | import { useENSNames } from 'lib/hooks/ens-cache.js'; | ||||
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; | import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; | ||||
import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; | |||||
import { | import { | ||||
memberIsAdmin, | memberIsAdmin, | ||||
memberHasAdminPowers, | memberHasAdminPowers, | ||||
getAvailableThreadMemberActions, | getAvailableThreadMemberActions, | ||||
} from 'lib/shared/thread-utils.js'; | } from 'lib/shared/thread-utils.js'; | ||||
import { stringForUser } from 'lib/shared/user-utils.js'; | import { stringForUser } from 'lib/shared/user-utils.js'; | ||||
import type { LoadingStatus } from 'lib/types/loading-types.js'; | import type { LoadingStatus } from 'lib/types/loading-types.js'; | ||||
import { | import { | ||||
type ThreadInfo, | type ThreadInfo, | ||||
type RelativeMemberInfo, | type RelativeMemberInfo, | ||||
} from 'lib/types/thread-types.js'; | } from 'lib/types/thread-types.js'; | ||||
import type { ThreadSettingsNavigate } from './thread-settings.react.js'; | import type { ThreadSettingsNavigate } from './thread-settings.react.js'; | ||||
import Avatar from '../../components/avatar.react.js'; | |||||
import PencilIcon from '../../components/pencil-icon.react.js'; | import PencilIcon from '../../components/pencil-icon.react.js'; | ||||
import { SingleLine } from '../../components/single-line.react.js'; | import { SingleLine } from '../../components/single-line.react.js'; | ||||
import UserAvatar from '../../components/user-avatar.react.js'; | |||||
import { | import { | ||||
type KeyboardState, | type KeyboardState, | ||||
KeyboardContext, | KeyboardContext, | ||||
} from '../../keyboard/keyboard-state.js'; | } from '../../keyboard/keyboard-state.js'; | ||||
import { | import { | ||||
OverlayContext, | OverlayContext, | ||||
type OverlayContextType, | type OverlayContextType, | ||||
} from '../../navigation/overlay-context.js'; | } from '../../navigation/overlay-context.js'; | ||||
Show All 26 Lines | type Props = { | ||||
+overlayContext: ?OverlayContextType, | +overlayContext: ?OverlayContextType, | ||||
+shouldRenderAvatars: boolean, | +shouldRenderAvatars: boolean, | ||||
}; | }; | ||||
class ThreadSettingsMember extends React.PureComponent<Props> { | class ThreadSettingsMember extends React.PureComponent<Props> { | ||||
editButton: ?React.ElementRef<typeof View>; | editButton: ?React.ElementRef<typeof View>; | ||||
render() { | render() { | ||||
const userText = stringForUser(this.props.memberInfo); | const userText = stringForUser(this.props.memberInfo); | ||||
const avatarInfo = getAvatarForUser(this.props.memberInfo); | |||||
const marginLeftStyle = { | const marginLeftStyle = { | ||||
marginLeft: this.props.shouldRenderAvatars ? 8 : 0, | marginLeft: this.props.shouldRenderAvatars ? 8 : 0, | ||||
}; | }; | ||||
let usernameInfo = null; | let usernameInfo = null; | ||||
if (this.props.memberInfo.username) { | if (this.props.memberInfo.username) { | ||||
usernameInfo = ( | usernameInfo = ( | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | render() { | ||||
const lastItem = this.props.lastListItem | const lastItem = this.props.lastListItem | ||||
? this.props.styles.lastInnerContainer | ? this.props.styles.lastInnerContainer | ||||
: null; | : null; | ||||
return ( | return ( | ||||
<View style={this.props.styles.container}> | <View style={this.props.styles.container}> | ||||
<View style={[this.props.styles.innerContainer, firstItem, lastItem]}> | <View style={[this.props.styles.innerContainer, firstItem, lastItem]}> | ||||
<View style={this.props.styles.row}> | <View style={this.props.styles.row}> | ||||
<View style={this.props.styles.userInfoContainer}> | <View style={this.props.styles.userInfoContainer}> | ||||
<Avatar size="small" avatarInfo={avatarInfo} /> | <UserAvatar size="small" userID={this.props.memberInfo.id} /> | ||||
{usernameInfo} | {usernameInfo} | ||||
</View> | </View> | ||||
{editButton} | {editButton} | ||||
</View> | </View> | ||||
{roleInfo} | {roleInfo} | ||||
</View> | </View> | ||||
</View> | </View> | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |