Commit a5e8f1e0 by tungnq

TODO: Đã hoàn thiện xong giao diện soạn email

parent 6bb07a98
...@@ -7,6 +7,9 @@ const colors = { ...@@ -7,6 +7,9 @@ const colors = {
gray: 'rgba(217, 217, 217, 1)', gray: 'rgba(217, 217, 217, 1)',
gray1: 'rgba(204, 204, 204, 1)', gray1: 'rgba(204, 204, 204, 1)',
gray2:'rgba(196, 196, 196, 1)', gray2:'rgba(196, 196, 196, 1)',
gray3:'#6F6F6F',
gray4:'rgba(80, 80, 80, 1)',
grayBorderInputTextHeader:'rgba(204, 204, 204, 0.36)', grayBorderInputTextHeader:'rgba(204, 204, 204, 0.36)',
grayButton:'rgba(217, 217, 217, 0.56)', grayButton:'rgba(217, 217, 217, 0.56)',
......
...@@ -51,7 +51,7 @@ export const EDITSENDDOCUMENT = 'EDITSENDDOCUMENT'; ...@@ -51,7 +51,7 @@ export const EDITSENDDOCUMENT = 'EDITSENDDOCUMENT';
export const DETAILSENDDOCUMENT = 'DETAILDOCUMENT'; export const DETAILSENDDOCUMENT = 'DETAILDOCUMENT';
export const STATUSSENDDOCUMENT ='STATUSSENDDOCUMENT'; export const STATUSSENDDOCUMENT ='STATUSSENDDOCUMENT';
export const DRAWERTABEMAIL = 'DRAWERTABEMAIL'; export const SENDEDEMAIL = 'SENDEDEMAIL';
export const EMAIL = 'EMAIL'; export const EMAIL = 'EMAIL';
export const SENDEMAIL = 'SENDEMAIL'; export const SENDEMAIL = 'SENDEMAIL';
export const DETAILEMAIL = 'DETAILEMAIL'; export const DETAILEMAIL = 'DETAILEMAIL';
......
...@@ -30,6 +30,7 @@ import StatusSendDocument from '../screens/list_send_document/status'; ...@@ -30,6 +30,7 @@ import StatusSendDocument from '../screens/list_send_document/status';
import ListWork from '../screens/list_work'; import ListWork from '../screens/list_work';
import DetailListWork from '../screens/list_work/detail'; import DetailListWork from '../screens/list_work/detail';
import DrawerEmailView from '../routers/drawer_email/drawerView'; import DrawerEmailView from '../routers/drawer_email/drawerView';
import SendEmail from '../screens/email/send';
const Stack = createStackNavigator(); const Stack = createStackNavigator();
function MyStack(props) { function MyStack(props) {
...@@ -68,6 +69,7 @@ function MyStack(props) { ...@@ -68,6 +69,7 @@ function MyStack(props) {
<Stack.Screen name={ScreenName.LISTWORK} component={ListWork}/> <Stack.Screen name={ScreenName.LISTWORK} component={ListWork}/>
<Stack.Screen name={ScreenName.DETAILWORK} component={DetailListWork}/> <Stack.Screen name={ScreenName.DETAILWORK} component={DetailListWork}/>
<Stack.Screen name={ScreenName.EMAIL} component={DrawerEmailView}/> <Stack.Screen name={ScreenName.EMAIL} component={DrawerEmailView}/>
<Stack.Screen name={ScreenName.SENDEMAIL} component={SendEmail}/>
</Stack.Navigator> </Stack.Navigator>
); );
} }
......
...@@ -108,7 +108,7 @@ const DrawerNavigatorEmailView = (props) =>{ ...@@ -108,7 +108,7 @@ const DrawerNavigatorEmailView = (props) =>{
} }
/> />
<Drawer.Screen <Drawer.Screen
name={ScreenName.SENDEMAIL} name={ScreenName.SENDEDEMAIL}
component={SendEmail} component={SendEmail}
options={ options={
{ {
......
...@@ -71,6 +71,11 @@ const styles = StyleSheet.create({ ...@@ -71,6 +71,11 @@ const styles = StyleSheet.create({
}, },
label:{ label:{
marginLeft:8 marginLeft:8
},
labelSel:{
color:R.colors.white,
fontWeight:'600',
fontFamily:R.fonts.fontMedium
} }
}) })
......
import { StyleSheet, Text, View } from 'react-native'
import R from '../../../assets/R'
const styles = StyleSheet.create({
container:{
flex:1,
backgroundColor:R.colors.white
},
body:{
flex:1,
backgroundColor:R.colors.white
},
header:{
flexDirection:'row',
backgroundColor:R.colors.blue,
height:50,
alignItems:'center',
justifyContent:'space-between',
paddingHorizontal:15
},
icon:{
width:25,
height:20
},
sendButton:{
backgroundColor:R.colors.orange,
borderRadius:5,
width:90,
paddingHorizontal:5,
height:35,
alignItems:'center',
justifyContent:'space-around',
flexDirection:'row'
},
sendText:{
color:R.colors.white,
fontSize:R.fontsize.fontSizeSubTitle,
fontFamily:R.fonts.fontRegular,
fontWeight:'400',
},
iconSend:{
width:20,
height:20
},
title:{
fontSize:R.fontsize.fontSizeSubTitle,
fontFamily:R.fonts.fontMedium,
fontWeight:'600',
color:R.colors.white
}
})
export default styles
\ No newline at end of file
import React from 'react'; import React from 'react';
import {Text, View, TouchableOpacity, StyleSheet} from 'react-native'; import {Text, View, TouchableOpacity, StyleSheet, Image} from 'react-native';
import styles from './style';
import R from '../../../assets/R';
import Button from '../../../components/Button';
import { useNavigation } from '@react-navigation/native';
const SendEmailView = (props) => { const SendEmailView = (props) => {
const { } = props; const { } = props;
const navigation = useNavigation();
const renderHeader = () => {
return (
<View style={styles.header}>
<TouchableOpacity onPress={() => navigation.goBack()}>
<Image source={R.images.icBack} style={styles.icon}/>
</TouchableOpacity>
<Text style={styles.title}>Son email</Text>
<TouchableOpacity onPress={() => (navigation.goBack())} style={styles.sendButton}>
<Text style={styles.sendText}>Gi Đi</Text>
<Image source={R.images.icSend} style={styles.iconSend} tintColor={R.colors.white}/>
</TouchableOpacity>
</View>
);
}
return ( return (
<View <View
style={{ style={styles.container}>
flex: 1, <View style={styles.body}>
justifyContent: 'center', {renderHeader()}
alignItems: 'center',
}}> </View>
<TouchableOpacity>
<Text>SendEmail</Text>
</TouchableOpacity>
</View> </View>
); );
}; };
export default SendEmailView; export default SendEmailView;
const styles = StyleSheet.create({})
\ No newline at end of file
...@@ -39,7 +39,6 @@ const styles = StyleSheet.create({ ...@@ -39,7 +39,6 @@ const styles = StyleSheet.create({
alignItems: 'flex-start' alignItems: 'flex-start'
}, },
unreadEmail: { unreadEmail: {
backgroundColor: R.colors.grayBorderInputTextHeader
}, },
avatarContainer: { avatarContainer: {
marginRight: 10, marginRight: 10,
...@@ -69,7 +68,9 @@ const styles = StyleSheet.create({ ...@@ -69,7 +68,9 @@ const styles = StyleSheet.create({
}, },
senderName: { senderName: {
fontSize: R.fontsize.fontsSizeTitle, fontSize: R.fontsize.fontsSizeTitle,
color: R.colors.black, fontWeight:'400',
fontFamily: R.fonts.fontRegular,
color: R.colors.gray4,
flex: 1, flex: 1,
marginRight: 10 marginRight: 10
}, },
...@@ -78,31 +79,37 @@ const styles = StyleSheet.create({ ...@@ -78,31 +79,37 @@ const styles = StyleSheet.create({
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.fontMedium,
color: R.colors.black color: R.colors.black
}, },
unreadEmail: {
fontWeight: '600',
fontFamily: R.fonts.fontMedium,
color: R.colors.gray3
},
emailDate: { emailDate: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
color: R.colors.gray2 color: R.colors.gray2
}, },
emailSubject: { emailSubject: {
fontSize: R.fontsize.fontSizeBtn, fontSize: R.fontsize.fontSizeBtn,
color: R.colors.black, color: R.colors.gray4,
}, },
emailPreview: { emailPreview: {
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
color: R.colors.gray2, color: R.colors.gray4,
}, },
attachmentIndicator: { attachmentIndicator: {
width: 20, width: 20,
height: 20, height: 20,
borderRadius: 10, borderRadius: 10,
backgroundColor: R.colors.blue, backgroundColor: R.colors.blue3,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
marginTop: 4 marginTop: 4
}, },
attachmentCount: { attachmentCount: {
color: R.colors.white, color: R.colors.blue,
fontWeight: '600',
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontSizeContent, fontSize: R.fontsize.fontSizeContent,
fontWeight: 'bold'
} }
}) })
......
...@@ -9,10 +9,25 @@ import { ...@@ -9,10 +9,25 @@ import {
RefreshControl, RefreshControl,
} from 'react-native'; } from 'react-native';
import styles from './style'; import styles from './style';
import FAB from '../../components/FAB/fab';
import SubButton from '../../components/FAB/sub_button';
import R from '../../assets/R';
import * as SCREENNAME from '../../routers/ScreenNames';
import { useNavigation } from '@react-navigation/native';
const EmailHomeView = props => { const EmailHomeView = props => {
const {groupedEmails, loading, onEmailPress, onRefresh, formatEmailDate} = const {groupedEmails, loading, onEmailPress, onRefresh, formatEmailDate} = props;
props;
const navigation = useNavigation();
if (loading) {
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color="#007AFF" />
<Text style={styles.loadingText}>Đang ti email...</Text>
</View>
);
}
const renderEmailItem = ({item}) => ( const renderEmailItem = ({item}) => (
<TouchableOpacity <TouchableOpacity
...@@ -31,7 +46,6 @@ const EmailHomeView = props => { ...@@ -31,7 +46,6 @@ const EmailHomeView = props => {
<Text style={[styles.senderName, !item.isRead && styles.unreadText]}> <Text style={[styles.senderName, !item.isRead && styles.unreadText]}>
{item.sender} {item.sender}
</Text> </Text>
</View> </View>
<Text <Text
...@@ -40,20 +54,33 @@ const EmailHomeView = props => { ...@@ -40,20 +54,33 @@ const EmailHomeView = props => {
{item.subject} {item.subject}
</Text> </Text>
<Text style={styles.emailPreview} numberOfLines={2}> <Text
style={[styles.emailPreview, !item.isRead && styles.unreadEmail]}
numberOfLines={2}>
{item.preview} {item.preview}
</Text> </Text>
</View> </View>
<View style={{justifyContent: 'center', alignItems: 'flex-end', position:'absolute', right:15, top:10 }}> <View
<Text style={styles.emailDate}> style={{
{`${item.date.getDate().toString().padStart(2, '0')}/${(item.date.getMonth() + 1).toString().padStart(2, '0')}/${item.date.getFullYear()}`} justifyContent: 'center',
</Text> alignItems: 'flex-end',
{item.hasAttachment && ( position: 'absolute',
<View style={styles.attachmentIndicator}> right: 15,
<Text style={styles.attachmentCount}>2</Text> top: 10,
</View> }}>
)} <Text style={styles.emailDate}>
{`${item.date.getDate().toString().padStart(2, '0')}/${(
item.date.getMonth() + 1
)
.toString()
.padStart(2, '0')}/${item.date.getFullYear()}`}
</Text>
{item.hasAttachment && (
<View style={styles.attachmentIndicator}>
<Text style={styles.attachmentCount}>2</Text>
</View>
)}
</View> </View>
</TouchableOpacity> </TouchableOpacity>
); );
...@@ -67,33 +94,36 @@ const EmailHomeView = props => { ...@@ -67,33 +94,36 @@ const EmailHomeView = props => {
</View> </View>
); );
if (loading) {
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color="#007AFF" />
<Text style={styles.loadingText}>Đang ti email...</Text>
</View>
);
}
return ( return (
<View style={styles.container}> <View style={styles.container}>
<FlatList <View style={styles.body}>
data={Object.keys(groupedEmails)} <FlatList
keyExtractor={item => item} data={Object.keys(groupedEmails)}
renderItem={({item: dateLabel}) => keyExtractor={item => item}
renderDateSection(dateLabel, groupedEmails[dateLabel]) renderItem={({item: dateLabel}) =>
} renderDateSection(dateLabel, groupedEmails[dateLabel])
refreshControl={ }
<RefreshControl refreshControl={
refreshing={loading} <RefreshControl
onRefresh={onRefresh} refreshing={loading}
colors={['#007AFF']} onRefresh={onRefresh}
/> colors={['#007AFF']}
} />
showsVerticalScrollIndicator={false} }
contentContainerStyle={styles.listContainer} showsVerticalScrollIndicator={false}
/> contentContainerStyle={styles.listContainer}
/>
</View>
<FAB>
<SubButton
onPress={() => navigation.navigate(SCREENNAME.SENDEMAIL)}
label="Soạn email"
images={R.images.icEdit}
backgroundColor={R.colors.orange}
/>
</FAB>
</View> </View>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment