Skip to content

Commit

Permalink
showed category type default
Browse files Browse the repository at this point in the history
  • Loading branch information
doljko committed Jul 4, 2024
1 parent ca8a943 commit 8c207af
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 51 deletions.
29 changes: 11 additions & 18 deletions src/features/Core/screens/ChatsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,18 @@ const ChatsScreen = () => {

return (
<View style={tailwind('w-full h-full bg-gray-800')}>
{isCreatingChat && (
<View style={[tailwind('flex flex-1 items-center justify-center bg-gray-800')]}>
<ActivityIndicator size="large" color="#FFFFFF" />
</View>
)}
{!isCreatingChat && (
<>
<View style={tailwind('p-4')}>
<View style={tailwind('flex flex-row items-center justify-center')}>
<TouchableOpacity style={tailwind('flex-1')} onPress={() => navigation.navigate('ChannelScreen')}>
<View style={tailwind('btn bg-gray-900 border border-gray-700')}>
<Text style={tailwind('font-semibold text-gray-50 text-base')}>{translate('Core.ChatsScreen.create-channel')}</Text>
</View>
</TouchableOpacity>
</View>
<>
<View style={tailwind('p-4')}>
<View style={tailwind('flex flex-row items-center justify-center')}>
<TouchableOpacity style={tailwind('flex-1')} onPress={() => navigation.navigate('ChannelScreen')}>
<View style={tailwind('btn bg-gray-900 border border-gray-700')}>
<Text style={tailwind('font-semibold text-gray-50 text-base')}>{translate('Core.ChatsScreen.create-channel')}</Text>
</View>
</TouchableOpacity>
</View>
<SwipeListView data={channels} renderItem={renderItem} renderHiddenItem={renderHiddenItem} rightOpenValue={-75} />
</>
)}
</View>
<SwipeListView data={channels} renderItem={renderItem} renderHiddenItem={renderHiddenItem} rightOpenValue={-75} />
</>
</View>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/features/Core/screens/IssueScreen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
import { IssuePriority, IssueType, Status } from 'constant/Enum';
import { IssuePriority, IssueType, Status, IssueCategory } from 'constant/Enum';
import { useDriver, useFleetbase } from 'hooks';
import React, { useEffect, useState } from 'react';
import { ActivityIndicator, Alert, Keyboard, KeyboardAvoidingView, Pressable, Text, TextInput, TouchableOpacity, View } from 'react-native';
Expand All @@ -19,7 +19,7 @@ const IssueScreen = ({ navigation, route }) => {
const [driverId] = useState(driver.getAttribute('id'));

const [type, setType] = useState(issue.type);
const [categories, setCategories] = useState([]);
const [categories, setCategories] = useState(getIssueCategories('VEHICLE'));
const [category, setCategory] = useState();
const [priority, setPriority] = useState();
const [status, setStatus] = useState();
Expand Down Expand Up @@ -130,7 +130,7 @@ const IssueScreen = ({ navigation, route }) => {
};

const validateInputs = () => {
if (!type || !category || !priority || !status ||!report?.trim()) {
if (!type || !category || !priority || !status || !report?.trim()) {
setError('Please enter a required value.');
return false;
} else if (report.trim().length === 0) {
Expand Down
52 changes: 22 additions & 30 deletions src/features/Core/screens/IssuesScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const IssuesScreen = () => {
<View style={tailwind('flex-1')}>
<Text style={tailwind('text-gray-100 font-semibold')}>{translate('Core.IssueScreen.createdAt')}:</Text>
</View>
<Text style={tailwind('text-gray-100')}>{format(new Date(item.created_at), 'MM/dd/yyyy-- HH:mm')}</Text>
<Text style={tailwind('text-gray-100')}>{format(new Date(item.created_at), 'MM/dd/yyyy HH:mm')}</Text>
</View>
<View style={tailwind('flex flex-row items-center justify-between mb-2')}>
<View style={tailwind('flex-1')}>
Expand Down Expand Up @@ -92,36 +92,28 @@ const IssuesScreen = () => {
</View>
</View>

{isCreatingIssue && (
<View style={[tailwind('flex flex-1 items-center justify-center bg-gray-800')]}>
<ActivityIndicator size="large" color="#FFFFFF" />
</View>
)}

{!isCreatingIssue && (
<>
<FlatList
refreshControl={<RefreshControl refreshing={isRefreshing} onRefresh={fetchIssues} tintColor={getColorCode('text-blue-200')} />}
data={issues}
keyExtractor={item => item.id}
renderItem={renderItem}
/>
<View style={tailwind('p-4')}>
<View style={tailwind('flex flex-row items-center justify-center')}>
<TouchableOpacity
style={tailwind('flex-1')}
onPress={() => {
setIsCreatingIssue(true);
navigation.navigate('IssueScreen');
}}>
<View style={tailwind('btn bg-gray-900 border border-gray-700')}>
<Text style={tailwind('font-semibold text-gray-50 text-base')}>{translate('Core.IssueScreen.createIssue')}</Text>
</View>
</TouchableOpacity>
</View>
<>
<FlatList
refreshControl={<RefreshControl refreshing={isRefreshing} onRefresh={fetchIssues} tintColor={getColorCode('text-blue-200')} />}
data={issues}
keyExtractor={item => item.id}
renderItem={renderItem}
/>
<View style={tailwind('p-4')}>
<View style={tailwind('flex flex-row items-center justify-center')}>
<TouchableOpacity
style={tailwind('flex-1')}
onPress={() => {
setIsCreatingIssue(true);
navigation.navigate('IssueScreen');
}}>
<View style={tailwind('btn bg-gray-900 border border-gray-700')}>
<Text style={tailwind('font-semibold text-gray-50 text-base')}>{translate('Core.IssueScreen.createIssue')}</Text>
</View>
</TouchableOpacity>
</View>
</>
)}
</View>
</>
</View>
);
};
Expand Down

0 comments on commit 8c207af

Please sign in to comment.