diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx
index cfbc1e2..d4744a8 100644
--- a/app/(tabs)/_layout.tsx
+++ b/app/(tabs)/_layout.tsx
@@ -1,12 +1,12 @@
-import { Tabs } from 'expo-router';
-import React from 'react';
-import { Platform } from 'react-native';
+import { Tabs } from "expo-router";
+import React from "react";
+import { Platform } from "react-native";
-import { HapticTab } from '@/components/HapticTab';
-import { IconSymbol } from '@/components/ui/IconSymbol';
-import TabBarBackground from '@/components/ui/TabBarBackground';
-import { Colors } from '@/constants/Colors';
-import { useColorScheme } from '@/hooks/useColorScheme';
+import { HapticTab } from "@/components/HapticTab";
+import { IconSymbol } from "@/components/ui/IconSymbol";
+import TabBarBackground from "@/components/ui/TabBarBackground";
+import { Colors } from "@/constants/Colors";
+import { useColorScheme } from "@/hooks/useColorScheme";
export default function TabLayout() {
const colorScheme = useColorScheme();
@@ -14,30 +14,35 @@ export default function TabLayout() {
return (
+ }}
+ >
,
+ title: "Home",
+ tabBarIcon: ({ color }) => (
+
+ ),
}}
/>
,
+ title: "Kalender",
+ tabBarIcon: ({ color }) => (
+
+ ),
}}
/>
diff --git a/app/(tabs)/calendar.tsx b/app/(tabs)/calendar.tsx
index d7f40d5..719dfca 100644
--- a/app/(tabs)/calendar.tsx
+++ b/app/(tabs)/calendar.tsx
@@ -1,11 +1,15 @@
+import { Ionicons } from "@expo/vector-icons";
import * as Calendar from "expo-calendar";
import * as SQLite from "expo-sqlite";
import React, { useEffect, useState } from "react";
import {
+ Button,
FlatList,
+ Modal,
SafeAreaView,
StyleSheet,
Text,
+ TextInput,
TouchableOpacity,
View,
} from "react-native";
@@ -30,6 +34,10 @@ export default function CalendarTab() {
const [calendarType, setCalendarType] = useState<"calendar" | "reminder">(
"calendar"
);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [newTitle, setNewTitle] = useState("");
+ const [newStart, setNewStart] = useState("");
+ const [newEnd, setNewEnd] = useState("");
useEffect(() => {
if (source === "sqlite") {
@@ -129,6 +137,21 @@ export default function CalendarTab() {
}
};
+ const addEventToDB = async () => {
+ if (!newTitle || !newStart || !newEnd) return;
+ await db.execAsync(
+ `INSERT INTO events (id, title, startDate, endDate) VALUES ('${Date.now()}', '${newTitle.replace(
+ /'/g,
+ "''"
+ )}', '${newStart}', '${newEnd}');`
+ );
+ setModalVisible(false);
+ setNewTitle("");
+ setNewStart("");
+ setNewEnd("");
+ await loadEventsFromDB();
+ };
+
const renderItem = ({ item }: { item: EventItem }) => (
{item.title}
@@ -141,6 +164,20 @@ export default function CalendarTab() {
return (
+
+ setModalVisible(true)}
+ style={{ padding: 10 }}
+ >
+
+
+
+ setModalVisible(false)}
+ >
+
+
+ Neuer SQLite-Eintrag
+
+
+
+
+
+
+
+
);
}
@@ -237,4 +317,25 @@ const styles = StyleSheet.create({
},
activeButton: { backgroundColor: "#007AFF" },
switchText: { color: "#333", fontWeight: "bold" },
+ modalOverlay: {
+ flex: 1,
+ backgroundColor: "rgba(0,0,0,0.2)",
+ justifyContent: "center",
+ alignItems: "center",
+ },
+ modalContent: {
+ width: 320,
+ backgroundColor: "#fff",
+ borderRadius: 12,
+ padding: 20,
+ elevation: 8,
+ },
+ input: {
+ borderWidth: 1,
+ borderColor: "#ccc",
+ borderRadius: 8,
+ padding: 10,
+ marginBottom: 12,
+ fontSize: 16,
+ },
});
diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 9ad59ce..eca288f 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -1,5 +1,6 @@
import AsyncStorage from "@react-native-async-storage/async-storage";
import * as LocalAuthentication from "expo-local-authentication";
+import { useRouter } from "expo-router";
import * as SQLite from "expo-sqlite";
import React, { useEffect, useState } from "react";
import {
@@ -14,7 +15,6 @@ import {
TouchableOpacity,
View,
} from "react-native";
-import CalendarSync from "../../components/CalendarSync";
// Types
interface User {
@@ -42,6 +42,7 @@ export default function AuthScreen() {
// Database
const [db, setDb] = useState(null);
+ const router = useRouter();
useEffect(() => {
initApp();
@@ -267,14 +268,10 @@ export default function AuthScreen() {
setShowCalendar((prev) => !prev)}
+ onPress={() => router.push("/calendar")}
>
-
- {showCalendar ? "Kalender ausblenden" : "Kalender anzeigen"}
-
+ Zum Kalender
-
- {showCalendar && }
);