From cc6c30a64b7583ba592b2dee0c89ea2f80478a48 Mon Sep 17 00:00:00 2001 From: Raghav Jit <98019979+RaghavJit@users.noreply.github.com> Date: Sun, 12 Feb 2023 09:11:07 +0530 Subject: [PATCH] added new components --- code/App.js | 12 ++ code/MyComp/AddTask.js | 230 +++++++++++++++++++----------------- code/MyComp/Home.js | 15 ++- code/MyComp/MyProfile.js | 56 +++++++++ code/MyComp/QuickTasker.js | 115 ++++++++++++++++++ code/MyComp/SetWallpaper.js | 6 +- code/brain/testing.js | 13 +- 7 files changed, 325 insertions(+), 122 deletions(-) create mode 100644 code/MyComp/MyProfile.js create mode 100644 code/MyComp/QuickTasker.js diff --git a/code/App.js b/code/App.js index 3901f75f..1753b360 100644 --- a/code/App.js +++ b/code/App.js @@ -6,6 +6,8 @@ import AddTask from "./MyComp/AddTask"; import ViewTask from "./MyComp/ViewTask"; import Settings from "./MyComp/Settings"; import SetWallpaper from "./MyComp/SetWallpaper" +import MyProfile from "./MyComp/MyProfile"; +import QuickTasker from "./MyComp/QuickTasker"; const colors = ['#e4def2', '#e2ddd8','#eef8ef','#2d414e','#E0DFE3'] function App() { @@ -35,6 +37,16 @@ function App() { name="SetWallpaper" component={SetWallpaper} /> + + ); diff --git a/code/MyComp/AddTask.js b/code/MyComp/AddTask.js index d20bd18b..ab8842ca 100644 --- a/code/MyComp/AddTask.js +++ b/code/MyComp/AddTask.js @@ -63,12 +63,12 @@ const styles = StyleSheet.create({ borderRadius: input.borderRadius, fontSize: input.fontSize, }, - inputBtns:{ - backgroundColor:colors[3], - width: Width*0.97, - height:Height*0.07, - borderRadius: Scale*6, - margin:Scale*2 + inputBtns: { + backgroundColor: colors[3], + width: Width * 0.97, + height: Height * 0.07, + borderRadius: Scale * 6, + margin: Scale * 2 }, ModalOuter: { @@ -121,149 +121,157 @@ function AddTask() { const [desc, setDesc] = useState('Desc') const [priorVisible, setPriorVisible] = useState(false); const [priority, setPrior] = useState(""); - + const RNFS = require('react-native-fs') // const filePath = `${RNFS.DocumentDirectoryPath}/Avalible_ID.json`; + function testing() { + const date1 = new Date('2023-02-11'); + const date2 = new Date('2023-02-01'); + + const diffInMs = date1.getTime() - date2.getTime(); + console.log(diffInMs) + } + return ( {setTitle(e)}} + onChangeText={(e) => { setTitle(e) }} >{title} {setDesc(e)}} + onChangeText={(e) => { setDesc(e) }} >{desc} - + - {/* datebtn */} - setDateVisible(true)} - > - - - - - - Choose Date and Time - - - { - setDateVisible(false) - setDate(date) - console.log(date) - }} - onCancel={() => { - setDateVisible(false) - }} - /> -{/* priorityBtn */} + {/* datebtn */} {setPriorVisible(true)}} - > - setDateVisible(true)} > - - - - + + + + + Choose Date and Time + + + { + setDateVisible(false) + setDate(date) + console.log(date) }} - >Choose Priority - - {/* priority modal */} - { + setDateVisible(false) + }} + /> + {/* priorityBtn */} + { setPriorVisible(true) }} > + + + + Choose Priority + + {/* priority modal */} + - { - setPrior("High"); - setPriorVisible(false); - }} - >High - { - setPrior("Moderate"); - setPriorVisible(false); - }} - >Moderate - { - setPrior("Low"); - setPriorVisible(false); - }} - >Low + + { + setPrior("High"); + setPriorVisible(false); + }} + >High + { + setPrior("Moderate"); + setPriorVisible(false); + }} + >Moderate + { + setPrior("Low"); + setPriorVisible(false); + }} + >Low + - - + -{/* save task btn */} + {/* save task btn */} {addNewTask(title, desc, date, priority, 0)}} + onPress={() => { addNewTask(title, desc, '00', priority, '0') }} > - - - - Save - - - + + + + Save + + + diff --git a/code/MyComp/Home.js b/code/MyComp/Home.js index 057ff32f..b9a6dfc2 100644 --- a/code/MyComp/Home.js +++ b/code/MyComp/Home.js @@ -6,6 +6,8 @@ import ViewTask from './ViewTask'; import {Appearance} from 'react-native'; import Settings from './Settings'; import SetWallpaper from './SetWallpaper'; +import QuickTasker from './QuickTasker'; +import MyProfile from './MyProfile'; const {scale} = Dimensions.get("window") const {width, height} = Dimensions.get("screen") @@ -48,19 +50,24 @@ const Home = ({navigation}) => { - + {navigation.navigate(QuickTasker)}} + > - - How To Use + + Zap Tasker - + {navigation.navigate(MyProfile)}} + > diff --git a/code/MyComp/MyProfile.js b/code/MyComp/MyProfile.js new file mode 100644 index 00000000..f5934497 --- /dev/null +++ b/code/MyComp/MyProfile.js @@ -0,0 +1,56 @@ +import React from 'react'; +import { StyleSheet, View, Text, Image } from 'react-native'; + +const MyProfile = () => { + return ( + + + + + Username + Achievements + Sign in + + + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + + alignItems: 'center', + }, + image: { + marginTop:12, + width: 150, + height: 150, + borderRadius: 75, + marginBottom: 20, + color:'black', + }, + info: { + alignItems: 'center', + color:'black', + }, + name: { + fontSize: 24, + fontWeight: 'bold', + marginBottom: 5, + color:'black', + }, + achievements: { + fontSize: 18, + marginBottom: 5, + color:'black', + }, + phone: { + fontSize: 18,color:'black', + }, +}); + +export default MyProfile; \ No newline at end of file diff --git a/code/MyComp/QuickTasker.js b/code/MyComp/QuickTasker.js new file mode 100644 index 00000000..cd8c2969 --- /dev/null +++ b/code/MyComp/QuickTasker.js @@ -0,0 +1,115 @@ +import React, { useState } from 'react'; +import { StyleSheet, Text, View, TextInput, Button, TouchableOpacity, Alert } from 'react-native'; + +export default function QuickTasker() { +const [task, setTask] = useState(''); +const [taskList, setTaskList] = useState([]); +const [prevTaskList, setPrevTaskList] = useState([]); + +const checkValidation = () => { +if (task === '') { +Alert.alert('Error', 'Please Enter a valid Task'); +} else { +addTask(); +} +}; + +const addTask = () => { +setPrevTaskList(taskList); +setTaskList([...taskList, task]); +setTask(''); +}; + +const deleteTask = (index) => { +setPrevTaskList(taskList); +const newTaskList = [...taskList]; +newTaskList.splice(index, 1); +setTaskList(newTaskList); +}; + +const undo = () => { +setTaskList(prevTaskList); +}; + +return ( + + setTask(text)} +value={task} +/> + +