Skip to content

Commit d8a2115

Browse files
authored
add helper flag for full action output. add onClick to username (keybase#24952)
1 parent 3e2bffe commit d8a2115

2 files changed

Lines changed: 35 additions & 19 deletions

File tree

‎shared/store/action-logger.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import transformActionForLog from '../logger/action-transformer'
22
import logger from '../logger'
33
import type {TypedDispatch, TypedActions} from 'util/container'
44

5+
const TEMP_FULL_ACTION_OUTPUT = __DEV__ && false
6+
if (TEMP_FULL_ACTION_OUTPUT) {
7+
for (let i = 0; i < 10; ++i) {
8+
console.error('TEMP_FULL_ACTION_OUTPUT enabled in action logger!')
9+
}
10+
}
11+
512
export const actionLogger = () => (next: TypedDispatch) => (action: TypedActions) => {
613
try {
7-
const output = transformActionForLog(action)
14+
const output = TEMP_FULL_ACTION_OUTPUT ? action.payload : transformActionForLog(action)
815
if (output) {
916
const log1 = [`type: ${action.type}: `, output]
1017
logger.action(...log1)

‎shared/teams/team/rows/member-row/index.tsx‎

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react'
22
import * as Kb from '../../../../common-adapters'
33
import * as Styles from '../../../../styles'
4-
import * as Types from '../../../../constants/types/teams'
54
import * as Container from '../../../../util/container'
65
import * as TeamsGen from '../../../../actions/teams-gen'
6+
import type * as Types from '../../../../constants/types/teams'
77
import {typeToLabel} from '../../../../constants/teams'
8-
import {BoolTypeMap, MemberStatus, TeamRoleType} from '../../../../constants/types/teams'
8+
import type {BoolTypeMap, MemberStatus, TeamRoleType} from '../../../../constants/types/teams'
99
import MenuHeader from '../menu-header.new'
1010

1111
export type Props = {
@@ -44,20 +44,21 @@ const showCrown: BoolTypeMap = {
4444
// you're changing one remember to change the other.
4545

4646
export const TeamMemberRow = (props: Props) => {
47-
let crown, fullNameLabel, resetLabel
47+
const {roleType, fullName} = props
4848
const active = props.status === 'active'
49-
if (active && props.roleType && showCrown[props.roleType]) {
50-
crown = (
51-
<Kb.Icon type={('iconfont-crown-' + props.roleType) as any} style={styles.crownIcon} fontSize={10} />
52-
)
53-
}
54-
if (props.fullName && active) {
55-
fullNameLabel = (
49+
const crown =
50+
active && roleType && showCrown[roleType] ? (
51+
<Kb.Icon type={('iconfont-crown-' + roleType) as Kb.IconType} style={styles.crownIcon} fontSize={10} />
52+
) : null
53+
54+
const fullNameLabel =
55+
fullName && active ? (
5656
<Kb.Text style={styles.fullNameLabel} type="BodySmall" lineClamp={1}>
57-
{props.fullName} •
57+
{fullName} •
5858
</Kb.Text>
59-
)
60-
}
59+
) : null
60+
61+
let resetLabel: string | undefined = undefined
6162
if (!active) {
6263
resetLabel = props.youCanManageMembers
6364
? 'Has reset their account'
@@ -69,7 +70,7 @@ export const TeamMemberRow = (props: Props) => {
6970
resetLabel = ' • Needs to update Keybase'
7071
}
7172

72-
const roleLabel = !!active && !!props.roleType && typeToLabel[props.roleType]
73+
const roleLabel = !!active && !!roleType && typeToLabel[roleType]
7374
const isYou = props.you === props.username
7475
const teamID = props.teamID
7576

@@ -83,6 +84,9 @@ export const TeamMemberRow = (props: Props) => {
8384
dispatch(TeamsGen.createTeamSetMemberSelected({selected, teamID, username: props.username}))
8485
}
8586

87+
const canEnterMemberPage = props.youCanManageMembers && active && !props.needsPUK
88+
const onClick = anySelected ? () => onSelect(!selected) : canEnterMemberPage ? props.onClick : undefined
89+
8690
const checkCircle = (
8791
<Kb.CheckCircle
8892
checked={selected}
@@ -97,7 +101,12 @@ export const TeamMemberRow = (props: Props) => {
97101
<Kb.Avatar username={props.username} size={32} />
98102
<Kb.Box2 direction="vertical" style={styles.nameContainer}>
99103
<Kb.Box style={Styles.globalStyles.flexBoxRow}>
100-
<Kb.ConnectedUsernames type="BodyBold" usernames={props.username} colorFollowing={true} />
104+
<Kb.ConnectedUsernames
105+
type="BodyBold"
106+
usernames={props.username}
107+
colorFollowing={true}
108+
onUsernameClicked={onClick}
109+
/>
101110
</Kb.Box>
102111

103112
<Kb.Box2 direction="horizontal" centerChildren={true} alignSelf="flex-start">
@@ -111,7 +120,7 @@ export const TeamMemberRow = (props: Props) => {
111120
/>
112121
)}
113122
<Kb.Text type="BodySmall">
114-
{!!active && !!props.roleType && typeToLabel[props.roleType]}
123+
{!!active && !!roleType && typeToLabel[roleType]}
115124
{resetLabel}
116125
</Kb.Text>
117126
</Kb.Box2>
@@ -211,14 +220,14 @@ export const TeamMemberRow = (props: Props) => {
211220
</Kb.Box2>
212221
)
213222

214-
const canEnterMemberPage = props.youCanManageMembers && active && !props.needsPUK
215223
const massActionsProps = props.youCanManageMembers
216224
? {
217225
containerStyleOverride: styles.listItemMargin,
218226
icon: checkCircle,
219227
iconStyleOverride: styles.checkCircle,
220228
}
221229
: {}
230+
222231
return (
223232
<Kb.ListItem2
224233
{...massActionsProps}
@@ -230,7 +239,7 @@ export const TeamMemberRow = (props: Props) => {
230239
firstItem={props.firstItem}
231240
style={selected ? styles.selected : styles.unselected}
232241
innerStyle={selected ? styles.selected : styles.unselected}
233-
onClick={anySelected ? () => onSelect(!selected) : canEnterMemberPage ? props.onClick : undefined}
242+
onClick={onClick}
234243
/>
235244
)
236245
}

0 commit comments

Comments
 (0)