Skip to content

Commit

Permalink
Merge pull request #54 from whogurdevil/main
Browse files Browse the repository at this point in the history
ui is responsible for home page
  • Loading branch information
whogurdevil authored Apr 8, 2023
2 parents fcd1f09 + 8fb405c commit 8704c35
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 196 deletions.
Binary file added code/Assets/images/no_tasks_clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 50 additions & 14 deletions code/MyComp/AddTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import FontAwesome5 from 'react-native-vector-icons/FontAwesome';

// following line includes database functions
import { addNewTask, resetAIjson, resetHIjson, removeTaskByID, editTaskByID, TaskArray, organiseTask } from '../brain/testing';

import ViewTask from './ViewTask';

//responsiveness
const { scale } = Dimensions.get("window")
const { width, height } = Dimensions.get("window")
const { width, height } = Dimensions.get("screen")

let x = 3.5 / scale
Scale = scale * x
Expand All @@ -22,7 +22,7 @@ Width = width * y
let z = 804.5714285714286 / height

Height = height * z
const iconSize = Scale * 9
const iconSize = Scale * 8


//colors and modes
Expand Down Expand Up @@ -112,27 +112,41 @@ const styles = StyleSheet.create({
fontSize: Scale * 8,
fontWeight: 'bold',
color: 'white'
}
},
addBtnPos: {
position: 'absolute',
bottom: 20,
right: 20,
zIndex: 999,
},
addBtn: {
width: Width*0.16,
height: Width*0.16,
borderRadius: scale*22,
backgroundColor: colors[3],
},

});

//main function starts here

function AddTask() {
function AddTask(props) {
//hooks for storing input values
const [date, setDate] = useState(new Date())
const [dateVisible, setDateVisible] = useState(false)
const [title, setTitle] = useState('')
const [desc, setDesc] = useState('')
const [priorVisible, setPriorVisible] = useState(false);
const [priority, setPrior] = useState("");
const [modalVisible, setModalVisible] = useState(false);







return (

<>

<View>
<TextInput
style={styles.title}
Expand Down Expand Up @@ -251,13 +265,19 @@ function AddTask() {

{/* save task btn */}
<TouchableOpacity

style={styles.inputBtns}
onPress={() => {
addNewTask(title, desc, date , priority, '0')
ToastAndroid.show('Task saved successfully', ToastAndroid.LONG);
setTitle('')
setDesc('')
onPress={() => {

if (title.length === 0 || desc.length === 0) {
ToastAndroid.show('Title and Description can not be empty', ToastAndroid.SHORT)
}
else {
addNewTask(title, desc, date, priority, '0')
ToastAndroid.show('Task saved successfully', ToastAndroid.SHORT);
setTitle('')
setDesc('')
}
}}
><View
style={{ flexDirection: 'row', padding: scale * 3 }}
Expand All @@ -277,6 +297,22 @@ function AddTask() {
</TouchableOpacity>
</View>
</View>
<View style={styles.addBtnPos}>
<TouchableOpacity
style={styles.addBtn}
onPress={()=>{props.navigation.navigate(ViewTask)}}
>
<View
style={{
alignItems:'center',
marginVertical:height*0.028
}}
>
<FontAwesome5 name={'list'} size={iconSize*0.65} color={colors[4]} />
</View>
</TouchableOpacity>
</View>
</>


);
Expand Down
124 changes: 70 additions & 54 deletions code/MyComp/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let temps = scale
let x = 3.5/scale
Scale = scale*x

const iconSize = Scale*9
const iconSize = 39

const colorscheme = Appearance.getColorScheme()

Expand Down Expand Up @@ -69,19 +69,27 @@ const Home = ({navigation}) => {
});

} else {
console.log('Camera permission denied');
console.log('Storage permission denied');
}
} catch (err) {
console.warn(err);
}
};
requestStoragePermission()
return (
<View style={{backgroundColor:colors[3], flex:1, alignItems:'center'}}>
<View style={{
backgroundColor: colors[3],
alignItems: 'center',
padding: 10,
flexWrap:'wrap'
}}>

{/* <View style={{backgroundColor:'#fff',height:Scale*200}}>
</View> */}
<View style={{flex:1,flexWrap:'wrap'}}>
{/* <View style={{
flex:1,flexWrap:'wrap',
}}> */}
<TouchableOpacity
style={styles.TouchableOpacity1}
onPress={()=>{navigation.navigate(AddTask)}}
Expand Down Expand Up @@ -170,82 +178,90 @@ const Home = ({navigation}) => {
</TouchableOpacity>


</View>
{/* </View> */}
</View>
)
}
const styles = StyleSheet.create({
TouchableOpacity1:{
backgroundColor:'#e4def2',
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},
TouchableOpacity2:{
backgroundColor:colors[1],
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
backgroundColor: colors[1],
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},
TouchableOpacity3:{
backgroundColor:colors[2],
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
backgroundColor: colors[2],
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},
TouchableOpacity4:{
backgroundColor:colors[1],
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
backgroundColor: colors[2],
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},
TouchableOpacity5:{
backgroundColor:colors[2],
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
backgroundColor: colors[0],
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},
TouchableOpacity6:{
backgroundColor:'#e4def2',
width:Scale*45,
height:Scale*53,
margin:Scale*3,
marginVertical:Scale*9,
borderRadius:Scale*8,
marginBottom:Scale*1,
backgroundColor: colors[1],
width: '45%',
height:'30%',
margin: 10,
borderRadius: 35,
marginBottom: 5,
justifyContent: 'center',
alignItems: 'center',
},



TouchableOpacityView:{
height:Scale*15,
width:Scale*15,
// height:Scale*15,
// width:Scale*15,
backgroundColor:'#fff',
margin:Scale*5,
borderRadius:Scale*5,
alignItems:'center',
padding:Scale*3,
aspectRatio: 1
},
TouchableOpacityText1:{
marginHorizontal:Scale*7,
fontSize:Scale*6,
fontWeight:'bold',
color: colors[4],
},
TouchableOpacityText1: {
fontSize: 17,
fontWeight: 'bold',
color: colors[3],
marginTop: 10,
},
})

export default Home
Loading

0 comments on commit 8704c35

Please sign in to comment.