generated from Real-Dev-Squad/website-template
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from Real-Dev-Squad/staging
Staging to check forked PR's locally
- Loading branch information
Showing
38 changed files
with
1,425 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { Modal, StyleSheet, View, Text } from 'react-native'; | ||
|
||
const ErrorScreen = ({ error }: string) => { | ||
return ( | ||
<Modal transparent={true}> | ||
<View style={styles.container}> | ||
<Text>{error}</Text> | ||
</View> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ErrorScreen; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
flex: 1, | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
position: 'absolute', | ||
zIndex: 1, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
import Images from '../../constants/images/Image'; | ||
import { | ||
StyleSheet, | ||
TextInput, | ||
View, | ||
Alert, | ||
TouchableOpacity, | ||
Text, | ||
Pressable, | ||
Image, | ||
} from 'react-native'; | ||
import React from 'react'; | ||
import { OOOFormType } from './OOOFormType'; | ||
import DatePicker from './OOOFormDatePicker'; | ||
|
||
const OOOForm = ({ | ||
fromDate, | ||
toDate, | ||
description, | ||
setToDate, | ||
setFromDate, | ||
setDescription, | ||
handleFormSubmit, | ||
isLoading, | ||
setIsFormVisible, | ||
}: OOOFormType) => { | ||
const isFormValid = () => { | ||
// Check if fromDate and toDate are not null or undefined | ||
if (!fromDate || !toDate) { | ||
Alert.alert('Error', 'Please select both From Date and To Date.'); | ||
return false; | ||
} | ||
|
||
// Check if fromDate is less than toDate | ||
if (fromDate >= toDate) { | ||
Alert.alert('Error', 'From Date must be less than To Date.'); | ||
return false; | ||
} | ||
|
||
// Check if description is not empty | ||
if (!description) { | ||
Alert.alert('Error', 'Description is required.'); | ||
return false; | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
return ( | ||
<View style={styles.formContainer}> | ||
<Pressable onPress={(prev) => setIsFormVisible(!prev)}> | ||
<Image style={styles.close} source={Images.closeIcon} /> | ||
</Pressable> | ||
<DatePicker | ||
title={`From date: ${fromDate.toLocaleString('en-US')}`} | ||
onDateChange={(date) => setFromDate(date)} | ||
selectedDate={fromDate} | ||
/> | ||
<DatePicker | ||
title={`To date: ${toDate.toLocaleString('en-US')}`} | ||
onDateChange={(date) => setToDate(date)} | ||
selectedDate={toDate} | ||
/> | ||
<TextInput | ||
style={[styles.input, styles.textArea, styles.text]} | ||
value={description} | ||
onChangeText={setDescription} | ||
multiline | ||
numberOfLines={4} | ||
/> | ||
<TouchableOpacity | ||
onPress={() => { | ||
isFormValid() && handleFormSubmit(); | ||
}} | ||
style={styles.SubmitButtonContainer} | ||
disabled={isLoading} | ||
> | ||
<Text style={styles.SubmitButtonText}>Submit</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
export default OOOForm; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
padding: 20, | ||
}, | ||
formContainer: { | ||
backgroundColor: '#f9f9f9', | ||
paddingHorizontal: 35, | ||
paddingVertical: 20, | ||
borderRadius: 8, | ||
marginTop: -30, | ||
marginLeft: 30, | ||
marginRight: 30, | ||
}, | ||
input: { | ||
height: 40, | ||
borderColor: '#ccc', | ||
borderWidth: 1, | ||
borderRadius: 4, | ||
marginBottom: 10, | ||
marginTop: 20, | ||
paddingHorizontal: 10, | ||
}, | ||
textArea: { | ||
height: 80, | ||
}, | ||
close: { | ||
height: 20, | ||
width: 20, | ||
marginLeft: 'auto', | ||
marginBottom: 10, | ||
}, | ||
text: { | ||
color: '#000000', | ||
}, | ||
SubmitButtonContainer: { | ||
backgroundColor: '#808080', | ||
paddingVertical: 10, | ||
paddingHorizontal: 12, | ||
width: '30%', | ||
borderRadius: 10, | ||
marginLeft: 'auto', | ||
marginRight: 'auto', | ||
}, | ||
SubmitButtonText: { | ||
color: '#fff', | ||
alignSelf: 'center', | ||
borderWidth: 1, | ||
borderColor: '#808080', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import React, { useState } from 'react'; | ||
import { Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native'; | ||
import DatePicker from 'react-native-date-picker'; | ||
|
||
type DatePickerProps = { | ||
title: string; | ||
onDateChange: (date: Date) => void; | ||
selectedDate: Date; | ||
}; | ||
|
||
const DeadLineDatePicker = (props: DatePickerProps) => { | ||
const [open, setOpen] = useState(false); | ||
const { onDateChange, selectedDate, title } = props; | ||
return ( | ||
<ScrollView> | ||
<TouchableOpacity | ||
style={styles.buttonStyle} | ||
onPress={() => { | ||
setOpen(true); | ||
}} | ||
> | ||
<Text style={styles.buttonTextStyle}>{title}</Text> | ||
</TouchableOpacity> | ||
<DatePicker | ||
modal | ||
mode="date" | ||
open={open} | ||
date={selectedDate || new Date()} | ||
onConfirm={(date) => { | ||
setOpen(false); | ||
console.log('date', date); | ||
onDateChange(date); | ||
}} | ||
onCancel={() => { | ||
setOpen(false); | ||
}} | ||
/> | ||
</ScrollView> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
buttonStyle: { | ||
width: '100%', | ||
height: 50, | ||
elevation: 5, | ||
borderRadius: 10, | ||
borderWidth: 1, | ||
backgroundColor: 'white', | ||
alignSelf: 'center', | ||
marginTop: 10, | ||
flexDirection: 'row', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
paddingLeft: 15, | ||
paddingRight: 15, | ||
}, | ||
buttonTextStyle: { | ||
fontWeight: '600', | ||
color: 'black', | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
|
||
export default DeadLineDatePicker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export type OOOFormType = { | ||
toDate: Date; | ||
fromDate: Date; | ||
description: string; | ||
setToDate: () => void; | ||
setFromDate: () => void; | ||
setDescription: () => void; | ||
handleFormSubmit: () => void; | ||
isLoading: boolean; | ||
setIsFormVisible: () => void; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const HomeApi = { | ||
GET_USER_STATUS: 'https://api.realdevsquad.com/users/status/self', | ||
UPDATE_STATUS: | ||
'https://api.realdevsquad.com/users/status/self?userStatusFlag=true', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.