Review fixes
This commit is contained in:
parent
0164c1b1f1
commit
9c6ae712a9
6 changed files with 28 additions and 33 deletions
|
|
@ -70,9 +70,7 @@ const ConvertGMToChannel = ({
|
|||
work();
|
||||
|
||||
return () => {
|
||||
if (loadingAnimationTimeoutRef.current) {
|
||||
clearTimeout(loadingAnimationTimeoutRef.current);
|
||||
}
|
||||
clearTimeout(loadingAnimationTimeoutRef.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import {Text, View} from 'react-native';
|
|||
|
||||
import {convertGroupMessageToPrivateChannel, switchToChannelById} from '@actions/remote/channel';
|
||||
import {isErrorWithMessage} from '@app/utils/errors';
|
||||
import {preventDoubleTap} from '@app/utils/tap';
|
||||
import Button from '@components/button';
|
||||
import {useServerUrl} from '@context/server';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {preventDoubleTap} from '@utils/tap';
|
||||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {displayUsername} from '@utils/user';
|
||||
|
||||
|
|
@ -59,13 +59,9 @@ export const ConvertGMToChannelForm = ({
|
|||
const [newChannelName, setNewChannelName] = useState<string>('');
|
||||
const [errorMessage, setErrorMessage] = useState<string>('');
|
||||
|
||||
const submitButtonEnabled = selectedTeam && newChannelName.trim();
|
||||
|
||||
const {formatMessage} = useIntl();
|
||||
const confirmButtonText = formatMessage({
|
||||
id: 'channel_info.convert_gm_to_channel.button_text',
|
||||
defaultMessage: 'Convert to Private Channel',
|
||||
});
|
||||
const userDisplayNames = useMemo(() => profiles.map((profile) => displayUsername(profile, locale, teammateNameDisplay)), [profiles]);
|
||||
const submitButtonEnabled = selectedTeam && newChannelName.trim();
|
||||
|
||||
useEffect(() => {
|
||||
if (commonTeams.length > 0) {
|
||||
|
|
@ -98,12 +94,22 @@ export const ConvertGMToChannelForm = ({
|
|||
switchToChannelById(serverUrl, updatedChannel.id, selectedTeam.id);
|
||||
}), [selectedTeam, newChannelName, submitButtonEnabled]);
|
||||
|
||||
if (commonTeams.length === 0) {
|
||||
return (
|
||||
<NoCommonTeamForm containerStyles={styles.container}/>
|
||||
);
|
||||
}
|
||||
|
||||
const messageBoxHeader = intl.formatMessage({
|
||||
id: 'channel_info.convert_gm_to_channel.warning.header',
|
||||
defaultMessage: 'Conversation history will be visible to any channel members',
|
||||
});
|
||||
|
||||
const userDisplayNames = useMemo(() => profiles.map((profile) => displayUsername(profile, locale, teammateNameDisplay)), [profiles]);
|
||||
const confirmButtonText = formatMessage({
|
||||
id: 'channel_info.convert_gm_to_channel.button_text',
|
||||
defaultMessage: 'Convert to Private Channel',
|
||||
});
|
||||
|
||||
const defaultUserDisplayNames = intl.formatMessage({id: 'channel_info.convert_gm_to_channel.warning.body.yourself', defaultMessage: 'yourself'});
|
||||
const memberNames = profiles.length > 0 ? intl.formatList(userDisplayNames) : defaultUserDisplayNames;
|
||||
const messageBoxBody = intl.formatMessage({
|
||||
|
|
@ -113,12 +119,6 @@ export const ConvertGMToChannelForm = ({
|
|||
memberNames,
|
||||
});
|
||||
|
||||
if (commonTeams.length === 0) {
|
||||
return (
|
||||
<NoCommonTeamForm containerStyles={styles.container}/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<MessageBox
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import React, {useCallback} from 'react';
|
|||
import {useIntl} from 'react-intl';
|
||||
import {View, type ViewStyle} from 'react-native';
|
||||
|
||||
import {preventDoubleTap} from '@app/utils/tap';
|
||||
import Button from '@components/button';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {popTopScreen} from '@screens/navigation';
|
||||
import {preventDoubleTap} from '@utils/tap';
|
||||
|
||||
import MessageBox from '../message_box/message_box';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import React from 'react';
|
||||
import {Text, View} from 'react-native';
|
||||
|
||||
import CompassIcon from '@app/components/compass_icon';
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {typography} from '@utils/typography';
|
||||
|
|
@ -97,9 +97,7 @@ const getStyleFromTheme = (theme: Theme, kind: MessageBoxTypes | undefined) => {
|
|||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...kindStyles,
|
||||
};
|
||||
return kindStyles;
|
||||
};
|
||||
|
||||
const MessageBox = ({
|
||||
|
|
|
|||
|
|
@ -38,13 +38,6 @@ export const TeamSelector = ({commonTeams, onSelectTeam, selectedTeamId}: Props)
|
|||
const label = formatMessage({id: 'channel_into.convert_gm_to_channel.team_selector.label', defaultMessage: 'Team'});
|
||||
const placeholder = formatMessage({id: 'channel_into.convert_gm_to_channel.team_selector.placeholder', defaultMessage: 'Select a Team'});
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTeamId && !selectedTeam) {
|
||||
const team = commonTeams.find((t) => t.id === selectedTeamId);
|
||||
setSelectedTeam(team);
|
||||
}
|
||||
}, [selectedTeamId]);
|
||||
|
||||
const selectTeam = useCallback((teamId: string) => {
|
||||
const team = commonTeams.find((t) => t.id === teamId);
|
||||
if (team) {
|
||||
|
|
@ -53,12 +46,18 @@ export const TeamSelector = ({commonTeams, onSelectTeam, selectedTeamId}: Props)
|
|||
}
|
||||
}, []);
|
||||
|
||||
const goToTeamSelectorList = preventDoubleTap(async () => {
|
||||
const goToTeamSelectorList = useCallback(preventDoubleTap(async () => {
|
||||
await dismissBottomSheet();
|
||||
|
||||
const title = formatMessage({id: 'channel_info.convert_gm_to_channel.team_selector_list.title', defaultMessage: 'Select Team'});
|
||||
goToScreen(Screens.TEAM_SELECTOR_LIST, title, {teams: commonTeams, selectTeam, selectedTeamId});
|
||||
});
|
||||
}), [commonTeams, selectTeam, selectedTeamId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTeamId && !selectedTeam) {
|
||||
const team = commonTeams.find((t) => t.id === selectedTeamId);
|
||||
setSelectedTeam(team);
|
||||
}
|
||||
}, [selectedTeamId]);
|
||||
|
||||
return (
|
||||
<OptionItem
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
import React, {useCallback, useMemo, useState} from 'react';
|
||||
import {StyleSheet, View} from 'react-native';
|
||||
|
||||
import {preventDoubleTap} from '@app/utils/tap';
|
||||
import SearchBar from '@components/search';
|
||||
import TeamList from '@components/team_list';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {popTopScreen} from '@screens/navigation';
|
||||
import {preventDoubleTap} from '@utils/tap';
|
||||
import {changeOpacity, getKeyboardAppearanceFromTheme} from '@utils/theme';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
|
|
|||
Loading…
Reference in a new issue