Chore: Evaluate ForwardLivechatView - TypeScript (#4126)

* Chore: Evaluate ForwardLivechatView - TypeScript

* minor tweaks
This commit is contained in:
Reinaldo Neto 2022-05-02 09:03:55 -03:00 committed by GitHub
parent a27d63c22e
commit f04b15a432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 16 deletions

View File

@ -115,11 +115,7 @@ const ChatsStackNavigator = () => {
component={NotificationPrefView} component={NotificationPrefView}
options={NotificationPrefView.navigationOptions} options={NotificationPrefView.navigationOptions}
/> />
<ChatsStack.Screen <ChatsStack.Screen name='ForwardLivechatView' component={ForwardLivechatView} />
name='ForwardLivechatView'
component={ForwardLivechatView}
options={ForwardLivechatView.navigationOptions}
/>
<ChatsStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} /> <ChatsStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} />
<ChatsStack.Screen name='PickerView' component={PickerView} options={PickerView.navigationOptions} /> <ChatsStack.Screen name='PickerView' component={PickerView} options={PickerView.navigationOptions} />
<ChatsStack.Screen <ChatsStack.Screen

View File

@ -158,11 +158,7 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
component={NotificationPrefView} component={NotificationPrefView}
options={NotificationPrefView.navigationOptions} options={NotificationPrefView.navigationOptions}
/> />
<ModalStack.Screen <ModalStack.Screen name='ForwardLivechatView' component={ForwardLivechatView} />
name='ForwardLivechatView'
component={ForwardLivechatView}
options={ForwardLivechatView.navigationOptions}
/>
<ModalStack.Screen name='CannedResponsesListView' component={CannedResponsesListView} /> <ModalStack.Screen name='CannedResponsesListView' component={CannedResponsesListView} />
<ModalStack.Screen name='CannedResponseDetail' component={CannedResponseDetail} /> <ModalStack.Screen name='CannedResponseDetail' component={CannedResponseDetail} />
<ModalStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} /> <ModalStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} />

View File

@ -4,13 +4,12 @@ import { StyleSheet, View } from 'react-native';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { forwardRoom, ITransferData } from '../actions/room'; import { forwardRoom, ITransferData } from '../actions/room';
import { themes } from '../lib/constants';
import OrSeparator from '../containers/OrSeparator'; import OrSeparator from '../containers/OrSeparator';
import Input from '../containers/UIKit/MultiSelect/Input'; import Input from '../containers/UIKit/MultiSelect/Input';
import { IBaseScreen, IServerRoom } from '../definitions'; import { IBaseScreen, IServerRoom } from '../definitions';
import I18n from '../i18n'; import I18n from '../i18n';
import { ChatsStackParamList } from '../stacks/types'; import { ChatsStackParamList } from '../stacks/types';
import { withTheme } from '../theme'; import { useTheme } from '../theme';
import { IOptionsField } from './NotificationPreferencesView/options'; import { IOptionsField } from './NotificationPreferencesView/options';
import { Services } from '../lib/services'; import { Services } from '../lib/services';
@ -28,14 +27,15 @@ interface IParsedData {
const COUNT_DEPARTMENT = 50; const COUNT_DEPARTMENT = 50;
const ForwardLivechatView = ({ navigation, route, theme }: IBaseScreen<ChatsStackParamList, 'ForwardLivechatView'>) => { const ForwardLivechatView = ({ navigation, route }: IBaseScreen<ChatsStackParamList, 'ForwardLivechatView'>) => {
const [departments, setDepartments] = useState<IParsedData[]>([]); const [departments, setDepartments] = useState<IParsedData[]>([]);
const [departmentId, setDepartment] = useState(''); const [departmentId, setDepartment] = useState('');
const [departmentTotal, setDepartmentTotal] = useState(0); const [departmentTotal, setDepartmentTotal] = useState(0);
const [users, setUsers] = useState<IOptionsField[]>([]); const [users, setUsers] = useState<IOptionsField[]>([]);
const [userId, setUser] = useState(); const [userId, setUser] = useState();
const [room, setRoom] = useState<IServerRoom>({} as IServerRoom); const [room, setRoom] = useState({} as IServerRoom);
const dispatch = useDispatch(); const dispatch = useDispatch();
const { theme, colors } = useTheme();
const rid = route.params?.rid; const rid = route.params?.rid;
@ -149,7 +149,7 @@ const ForwardLivechatView = ({ navigation, route, theme }: IBaseScreen<ChatsStac
}; };
return ( return (
<View style={[styles.container, { backgroundColor: themes[theme].auxiliaryBackground }]}> <View style={[styles.container, { backgroundColor: colors.auxiliaryBackground }]}>
<Input onPress={onPressDepartment} placeholder={I18n.t('Select_a_Department')} theme={theme} /> <Input onPress={onPressDepartment} placeholder={I18n.t('Select_a_Department')} theme={theme} />
<OrSeparator theme={theme} /> <OrSeparator theme={theme} />
<Input onPress={onPressUser} placeholder={I18n.t('Select_a_User')} theme={theme} /> <Input onPress={onPressUser} placeholder={I18n.t('Select_a_User')} theme={theme} />
@ -157,4 +157,4 @@ const ForwardLivechatView = ({ navigation, route, theme }: IBaseScreen<ChatsStac
); );
}; };
export default withTheme(ForwardLivechatView); export default ForwardLivechatView;