Skip to content

Commit c761778

Browse files
authored
[MM-66419] Playbooks on mobile UX fixes (#9250) (#9264)
* [MM-66419] Playbooks on mobile UX fixes * Address UX feedback
1 parent 981daa8 commit c761778

File tree

14 files changed

+88
-41
lines changed

14 files changed

+88
-41
lines changed

app/components/floating_input/floating_autocomplete_selector/floating_autocomplete_selector.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ function AutoCompleteSelector({
219219
</Text>
220220
<CompassIcon
221221
name='chevron-down'
222+
size={20}
222223
color={changeOpacity(theme.centerChannelColor, 0.5)}
223224
/>
224225
</View>

app/components/floating_input/floating_input_container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const FloatingInputContainer = ({
123123
testID,
124124
}: Props) => {
125125
const styles = getStyleSheet(theme);
126-
const positions = useMemo(() => getLabelPositions(styles.textInput, styles.label, styles.smallLabel), [styles]);
126+
const positions = useMemo(() => getLabelPositions(styles.textInput, styles.bigLabel, styles.smallLabel), [styles]);
127127
const errorIcon = 'alert-outline';
128128
const shouldShowError = !focused && error;
129129

app/components/floating_input/floating_text_input_label.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import React, {useState, useRef, useImperativeHandle, forwardRef, useMemo, useCa
77
import {type LayoutChangeEvent, type NativeSyntheticEvent, type StyleProp, type TargetedEvent, TextInput, type TextInputFocusEventData, type TextInputProps, type TextStyle} from 'react-native';
88

99
import {changeOpacity, getKeyboardAppearanceFromTheme, makeStyleSheetFromTheme} from '@utils/theme';
10+
import {typography} from '@utils/typography';
1011

1112
import FloatingInputContainer from './floating_input_container';
1213
import {onExecution} from './utils';
@@ -22,11 +23,10 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
2223
paddingTop: 0,
2324
paddingBottom: 0,
2425
flexDirection: 'row',
25-
fontFamily: 'OpenSans',
26-
fontSize: 16,
2726
color: theme.centerChannelColor,
2827
borderColor: changeOpacity(theme.centerChannelColor, 0.16),
2928
borderRadius: 4,
29+
...typography('Body', 200),
3030
},
3131
}));
3232

app/components/floating_input/utils.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,27 @@ describe('getLabelPositions', () => {
99
paddingTop: 10,
1010
paddingBottom: 10,
1111
height: 50,
12-
fontSize: 14,
1312
padding: 20,
1413
};
1514
const labelStyle = {fontSize: 15};
1615
const smallLabelStyle = {fontSize: 11};
1716

1817
const result = getLabelPositions(style, labelStyle, smallLabelStyle);
19-
expect(result).toEqual([24.4, -6.5]);
18+
expect(result).toEqual([25, -6.5]);
2019
});
2120

2221
test('should return correct positions when label and smallLabels styles are missing', () => {
2322
const style = {
2423
paddingTop: 15,
2524
paddingBottom: 15,
2625
height: 50,
27-
fontSize: 14,
2826
padding: 25,
2927
};
3028
const labelStyle = {};
3129
const smallLabelStyle = {};
3230

3331
const result = getLabelPositions(style, labelStyle, smallLabelStyle);
34-
expect(result).toEqual([23.8, -6.5]);
32+
expect(result).toEqual([23.2, -6.5]);
3533
});
3634

3735
test('should return correct positions when all values are empty are provided', () => {
@@ -49,7 +47,6 @@ describe('getLabelPositions', () => {
4947
paddingTop: 0,
5048
paddingBottom: 0,
5149
height: 0,
52-
fontSize: 0,
5350
padding: 0,
5451
};
5552
const labelStyle = {fontSize: 0};

app/components/floating_input/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const getLabelPositions = (style: TextStyle, labelStyle: TextStyle, small
1717
const bottom: number = style.paddingBottom as number || 0;
1818

1919
const height: number = (style.height as number || (top + bottom) || style.padding as number) || 0;
20-
const textInputFontSize = style.fontSize || 13;
20+
const textInputFontSize = labelStyle.fontSize || 13;
2121
const labelFontSize = labelStyle.fontSize || 16;
2222
const smallLabelFontSize = smallLabelStyle.fontSize || 10;
2323
const fontSizeDiff = textInputFontSize - labelFontSize;

app/products/playbooks/screens/navigation.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ export async function goToSelectDate(
120120
export async function goToSelectPlaybook(
121121
intl: IntlShape,
122122
theme: Theme,
123+
channelId?: string,
123124
) {
124125
const title = intl.formatMessage({id: 'playbooks.select_playbook.title', defaultMessage: 'Start a run'});
125-
goToScreen(Screens.PLAYBOOKS_SELECT_PLAYBOOK, title, {}, {
126+
goToScreen(Screens.PLAYBOOKS_SELECT_PLAYBOOK, title, {channelId}, {
126127
topBar: {
127128
subtitle: {
128129
text: intl.formatMessage({id: 'playbooks.select_playbook.subtitle', defaultMessage: 'Select a playbook'}),
@@ -132,10 +133,10 @@ export async function goToSelectPlaybook(
132133
});
133134
}
134135

135-
export async function goToStartARun(intl: IntlShape, theme: Theme, playbook: Playbook, onRunCreated: (run: PlaybookRun) => void) {
136+
export async function goToStartARun(intl: IntlShape, theme: Theme, playbook: Playbook, onRunCreated: (run: PlaybookRun) => void, channelId?: string) {
136137
const title = intl.formatMessage({id: 'playbooks.start_a_run.title', defaultMessage: 'Start a run'});
137138
const subtitle = playbook.title;
138-
goToScreen(Screens.PLAYBOOKS_START_A_RUN, title, {playbook, onRunCreated}, {
139+
goToScreen(Screens.PLAYBOOKS_START_A_RUN, title, {playbook, onRunCreated, channelId}, {
139140
topBar: {
140141
subtitle: {
141142
text: subtitle,

app/products/playbooks/screens/participant_playbooks/participant_playbooks.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {defineMessages, useIntl} from 'react-intl';
77
import {View} from 'react-native';
88

99
import Loading from '@components/loading';
10-
import MenuDivider from '@components/menu_divider';
1110
import SectionNotice from '@components/section_notice';
1211
import {useServerUrl} from '@context/server';
1312
import {useTheme} from '@context/theme';
@@ -83,6 +82,14 @@ const tabs: Array<TabDefinition<TabsNames>> = [
8382
},
8483
];
8584

85+
const itemSeparatorStyle = {
86+
height: 12,
87+
};
88+
89+
const ItemSeparator = () => {
90+
return <View style={itemSeparatorStyle}/>;
91+
};
92+
8693
const ParticipantPlaybooks = ({
8794
currentUserId,
8895
componentId,
@@ -202,7 +209,7 @@ const ParticipantPlaybooks = ({
202209
data={data}
203210
renderItem={renderItem}
204211
contentContainerStyle={styles.container}
205-
ItemSeparatorComponent={MenuDivider}
212+
ItemSeparatorComponent={ItemSeparator}
206213
estimatedItemSize={CARD_HEIGHT}
207214
onEndReached={loadMore}
208215
onEndReachedThreshold={0.1}

app/products/playbooks/screens/playbook_run/status_update_indicator.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('StatusUpdateIndicator', () => {
3737
/>,
3838
);
3939

40-
const text = getByText(/Status update due/);
40+
const text = getByText(/Update due/);
4141
expect(text).toHaveStyle({color: changeOpacity(Preferences.THEMES.denim.centerChannelColor, 0.72)});
4242

4343
const icon = getByTestId('compass-icon');
@@ -55,7 +55,7 @@ describe('StatusUpdateIndicator', () => {
5555
/>,
5656
);
5757

58-
const text = getByText(/Status update overdue/);
58+
const text = getByText(/Update overdue/);
5959
expect(text).toHaveStyle({color: Preferences.THEMES.denim.dndIndicator});
6060

6161
const icon = getByTestId('compass-icon');

app/products/playbooks/screens/playbook_run/status_update_indicator.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,23 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => ({
5555
overdueText: {
5656
color: theme.dndIndicator,
5757
},
58+
bold: {
59+
...typography('Body', 300, 'SemiBold'),
60+
},
5861
}));
5962

6063
const messages = defineMessages({
6164
updateOverdue: {
6265
id: 'playbooks.playbook_run.status_update_overdue',
63-
defaultMessage: 'Status update overdue {time}',
66+
defaultMessage: 'Update overdue\n{time}',
6467
},
6568
updateDue: {
6669
id: 'playbooks.playbook_run.status_update_due',
67-
defaultMessage: 'Status update due {time}',
70+
defaultMessage: 'Update due\n{time}',
6871
},
6972
finished: {
7073
id: 'playbooks.playbook_run.status_update_finished',
71-
defaultMessage: 'Run finished {time}',
74+
defaultMessage: 'Run finished\n{time}',
7275
},
7376
update: {
7477
id: 'playbooks.playbook_run.status_update',
@@ -86,13 +89,20 @@ const StatusUpdateIndicator = ({
8689
const styles = getStyleSheet(theme);
8790
const intl = useIntl();
8891

89-
const values = {time: <FriendlyDate value={timestamp}/>};
92+
const values = useMemo(() => ({time: (
93+
<FriendlyDate
94+
style={styles.bold}
95+
value={timestamp}
96+
/>
97+
)}), [timestamp, styles]);
98+
9099
const readOnly = !isParticipant || isFinished;
100+
const isOverdue = timestamp < Date.now();
91101

92102
let message = messages.updateDue;
93103
if (isFinished) {
94104
message = messages.finished;
95-
} else if (timestamp < Date.now()) {
105+
} else if (isOverdue) {
96106
message = messages.updateOverdue;
97107
}
98108

@@ -137,6 +147,7 @@ const StatusUpdateIndicator = ({
137147
theme={theme}
138148
size='lg'
139149
disabled={readOnly}
150+
isDestructive={isOverdue && !isFinished}
140151
/>
141152
</View>
142153
);

app/products/playbooks/screens/playbooks_runs/playbook_runs.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ const PlaybookRuns = ({
140140
}, []);
141141

142142
const startANewRun = useCallback(() => {
143-
goToSelectPlaybook(intl, theme);
144-
}, [intl, theme]);
143+
goToSelectPlaybook(intl, theme, channelId);
144+
}, [intl, theme, channelId]);
145145

146146
let content = (<EmptyState tab={activeTab}/>);
147147
if (!isEmpty) {
@@ -162,6 +162,7 @@ const PlaybookRuns = ({
162162
text={intl.formatMessage({id: 'playbooks.runs.start_a_new_run', defaultMessage: 'Start a new run'})}
163163
size='lg'
164164
theme={theme}
165+
iconName='play-outline'
165166
/>
166167
</View>
167168
</>

0 commit comments

Comments
 (0)