diff --git a/app/assignment/createAssignment.tsx b/app/assignment/createAssignment.tsx index df4630a..fc7df63 100644 --- a/app/assignment/createAssignment.tsx +++ b/app/assignment/createAssignment.tsx @@ -1,7 +1,8 @@ +import { defaultStyles } from '@/constants/defaultStyles'; import { supabase } from '@/lib/supabase'; import { router, Stack, useLocalSearchParams } from 'expo-router'; import { useState } from 'react'; -import { ActivityIndicator, Alert, Button, Keyboard, KeyboardAvoidingView, Platform, Pressable, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native'; +import { ActivityIndicator, Alert, Keyboard, KeyboardAvoidingView, Platform, Pressable, ScrollView, Text, TextInput, TouchableWithoutFeedback, View } from 'react-native'; export default function CreateAssignment() { const sId = (useLocalSearchParams().sId as string) ?? null; @@ -12,20 +13,17 @@ export default function CreateAssignment() { const [isSaving, SetIsSaving] = useState(false); const CreateAssignment = async () => { - if(title.trim() === '' || deadline.trim() === '') { - Alert.alert("Title and deadline are required!"); + if(title.trim() === '') { + Alert.alert("Title is required!"); return; } + + const { data, error: userError } = await supabase.auth.getUser(); - setIsSaving(true); - - try { - const { data: userData, error: userError } = await supabase.auth.getUser(); - - if (userError || !userData.user) { - router.replace('../createUser'); - return; - } + if(userError || !data.user) { + router.replace("../createUser"); + return; + } SetIsSaving(true); @@ -48,7 +46,6 @@ export default function CreateAssignment() { SetTitle(''); SetDescription(''); - SetDeadline(''); SetIsCompleted(false); SetIsSaving(false); @@ -67,46 +64,120 @@ export default function CreateAssignment() { Create New Assignment - + - - - - - SetIsCompleted(state => !state)} - style={defaultStyles.checkboxContainer} - > - - {isCompleted && } + + + + + Title + + - {isCompleted ? 'Completed' : 'Not completed'} - -