diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index 2464474..e51a2bc 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -1,9 +1,8 @@ import { supabase } from "@/lib/supabase"; import { Session } from "@supabase/supabase-js"; -import { Tabs } from "expo-router"; +import { Redirect, Tabs } from "expo-router"; import { useEffect, useState } from "react"; - export default function TabLayout() { const [session, SetSession] = useState(null) const [loading, SetLoading] = useState(true); @@ -28,9 +27,9 @@ export default function TabLayout() { return null; } -// if (!session) { -// return ; -// } + if (!session) { + return ; + } return ( @@ -38,6 +37,19 @@ export default function TabLayout() { + + + + + + + + + + + + + ); } \ No newline at end of file diff --git a/app/assignment/createAssignment.tsx b/app/(tabs)/assignment/createAssignment.tsx similarity index 100% rename from app/assignment/createAssignment.tsx rename to app/(tabs)/assignment/createAssignment.tsx diff --git a/app/assignment/editAssignment.tsx b/app/(tabs)/assignment/editAssignment.tsx similarity index 100% rename from app/assignment/editAssignment.tsx rename to app/(tabs)/assignment/editAssignment.tsx diff --git a/app/assignment/viewDetailsAssignment.tsx b/app/(tabs)/assignment/viewDetailsAssignment.tsx similarity index 100% rename from app/assignment/viewDetailsAssignment.tsx rename to app/(tabs)/assignment/viewDetailsAssignment.tsx diff --git a/app/subject/createSubject.tsx b/app/(tabs)/subject/createSubject.tsx similarity index 100% rename from app/subject/createSubject.tsx rename to app/(tabs)/subject/createSubject.tsx diff --git a/app/subject/editSubject.tsx b/app/(tabs)/subject/editSubject.tsx similarity index 100% rename from app/subject/editSubject.tsx rename to app/(tabs)/subject/editSubject.tsx diff --git a/app/subject/viewDetailsSubject.tsx b/app/(tabs)/subject/viewDetailsSubject.tsx similarity index 100% rename from app/subject/viewDetailsSubject.tsx rename to app/(tabs)/subject/viewDetailsSubject.tsx diff --git a/app/task/createTask.tsx b/app/(tabs)/task/createTask.tsx similarity index 100% rename from app/task/createTask.tsx rename to app/(tabs)/task/createTask.tsx diff --git a/app/task/editTask.tsx b/app/(tabs)/task/editTask.tsx similarity index 100% rename from app/task/editTask.tsx rename to app/(tabs)/task/editTask.tsx diff --git a/app/task/viewDetailsTask.tsx b/app/(tabs)/task/viewDetailsTask.tsx similarity index 100% rename from app/task/viewDetailsTask.tsx rename to app/(tabs)/task/viewDetailsTask.tsx diff --git a/app/(tabs)/timer.tsx b/app/(tabs)/timer.tsx new file mode 100644 index 0000000..eacca7d --- /dev/null +++ b/app/(tabs)/timer.tsx @@ -0,0 +1,180 @@ +import * as React from 'react'; +import { + Animated, + Dimensions, + StatusBar, + StyleSheet, + TouchableOpacity, + View +} from 'react-native'; +const { width, height } = Dimensions.get('window'); + +const colors = { + black: '#323F4E', + red: '#F76A6A', + text: '#ffffff', +}; + +const timers = [...Array(13).keys()].map((i) => (i === 0 ? 1 : i * 5)); +const ITEM_SIZE = width * 0.38; +const ITEM_SPACING = (width - ITEM_SIZE) / 2; + +/* +Har bare skrevet timeren som en egen tab til å begynne med. +Planen er at når bruker starter en task så vil de få opp denne timeren +som viser TaskName og Description der tallene står nå +Kanskje en animert figur hvis vi får tid +*/ +export default function App() { + const scrollX = React.useRef(new Animated.Value(0)).current; + const [duration, setDuration] = React.useState(timers[0]) + const timerAnimation = React.useRef(new Animated.Value(height)).current + const buttonAnimation = React.useRef(new Animated.Value(0)).current + const animation = React.useCallback(() => { + Animated.sequence([ + Animated.timing(buttonAnimation, { + toValue: 1, + duration: 300, + useNativeDriver: true + }), + Animated.timing(timerAnimation, { + toValue: 0, + duration: 300, + useNativeDriver: true + }), + Animated.timing(timerAnimation, { + toValue: height, + duration: duration * 1000, + useNativeDriver: true + }), + ]) .start(() => { + Animated.timing(buttonAnimation, { + toValue: 0, + duration: 300, + useNativeDriver: true + }).start() + }) + }, [duration]) + + const opacity = buttonAnimation.interpolate({ + inputRange: [0, 1], + outputRange: [1, 0] + }) + const translateY = buttonAnimation.interpolate({ + inputRange: [0, 1], + outputRange: [0, 200] + }) + + return ( + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + backgroundColor: colors.black, + }, + roundButton: { + width: 80, + height: 80, + borderRadius: 80, + backgroundColor: colors.red, + }, + text: { + fontSize: ITEM_SIZE * 0.8, + fontFamily: 'Menlo', + color: colors.text, + fontWeight: '900', + } +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 2f35dd4..573ab12 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,10 +2,9 @@ "extends": "expo/tsconfig.base", "compilerOptions": { "strict": true, + "jsx": "react-native", "paths": { - "@/*": [ - "./*" - ] + "@/*": ["./*"] } }, "include": [