format codebase with prettier
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
type Theme = {
|
||||
chatBot: string,
|
||||
primeFg: string,
|
||||
primeBg: string,
|
||||
messageBorderBg: string,
|
||||
placeholderBg: string,
|
||||
calenderBg: string,
|
||||
confirmButton: string,
|
||||
rejectButton: string,
|
||||
disabledButton: string,
|
||||
buttonText: string,
|
||||
textSecondary: string,
|
||||
textMuted: string,
|
||||
}
|
||||
chatBot: string;
|
||||
primeFg: string;
|
||||
primeBg: string;
|
||||
messageBorderBg: string;
|
||||
placeholderBg: string;
|
||||
calenderBg: string;
|
||||
confirmButton: string;
|
||||
rejectButton: string;
|
||||
disabledButton: string;
|
||||
buttonText: string;
|
||||
textSecondary: string;
|
||||
textMuted: string;
|
||||
};
|
||||
|
||||
const defaultLight: Theme = {
|
||||
chatBot: "#DE6C20",
|
||||
@@ -26,7 +26,7 @@ const defaultLight: Theme = {
|
||||
buttonText: "#fff",
|
||||
textSecondary: "#666",
|
||||
textMuted: "#888",
|
||||
}
|
||||
};
|
||||
|
||||
let currentTheme: Theme = defaultLight;
|
||||
export default currentTheme;
|
||||
|
||||
@@ -4,24 +4,30 @@ import theme from "../../Themes";
|
||||
|
||||
export default function TabLayout() {
|
||||
return (
|
||||
<Tabs screenOptions={{
|
||||
headerShown: false,
|
||||
tabBarActiveTintColor: theme.chatBot,
|
||||
tabBarInactiveTintColor: theme.primeFg,
|
||||
tabBarStyle: { backgroundColor: theme.primeBg },
|
||||
}}>
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
headerShown: false,
|
||||
tabBarActiveTintColor: theme.chatBot,
|
||||
tabBarInactiveTintColor: theme.primeFg,
|
||||
tabBarStyle: { backgroundColor: theme.primeBg },
|
||||
}}
|
||||
>
|
||||
<Tabs.Screen
|
||||
name="chat"
|
||||
options={{
|
||||
title: 'Chat',
|
||||
tabBarIcon: ({ color }) => <Ionicons size={28} name="chatbubble" color={color} />,
|
||||
title: "Chat",
|
||||
tabBarIcon: ({ color }) => (
|
||||
<Ionicons size={28} name="chatbubble" color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="calendar"
|
||||
options={{
|
||||
title: 'Calendar',
|
||||
tabBarIcon: ({ color }) => <Ionicons size={28} name="calendar" color={color} />,
|
||||
title: "Calendar",
|
||||
tabBarIcon: ({ color }) => (
|
||||
<Ionicons size={28} name="calendar" color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
|
||||
@@ -40,13 +40,13 @@ const Chat = () => {
|
||||
action: "confirm" | "reject",
|
||||
messageId: string,
|
||||
conversationId: string,
|
||||
proposedChange?: ProposedEventChange
|
||||
proposedChange?: ProposedEventChange,
|
||||
) => {
|
||||
// Mark message as responded (optimistic update)
|
||||
setMessages((prev) =>
|
||||
prev.map((msg) =>
|
||||
msg.id === messageId ? { ...msg, respondedAction: action } : msg
|
||||
)
|
||||
msg.id === messageId ? { ...msg, respondedAction: action } : msg,
|
||||
),
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -58,7 +58,7 @@ const Chat = () => {
|
||||
proposedChange.action,
|
||||
proposedChange.event,
|
||||
proposedChange.eventId,
|
||||
proposedChange.updates
|
||||
proposedChange.updates,
|
||||
)
|
||||
: await ChatService.rejectEvent(conversationId, messageId);
|
||||
|
||||
@@ -74,8 +74,8 @@ const Chat = () => {
|
||||
// Revert on error
|
||||
setMessages((prev) =>
|
||||
prev.map((msg) =>
|
||||
msg.id === messageId ? { ...msg, respondedAction: undefined } : msg
|
||||
)
|
||||
msg.id === messageId ? { ...msg, respondedAction: undefined } : msg,
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -119,7 +119,12 @@ const Chat = () => {
|
||||
proposedChange={item.proposedChange}
|
||||
respondedAction={item.respondedAction}
|
||||
onConfirm={() =>
|
||||
handleEventResponse("confirm", item.id, item.conversationId!, item.proposedChange)
|
||||
handleEventResponse(
|
||||
"confirm",
|
||||
item.id,
|
||||
item.conversationId!,
|
||||
item.proposedChange,
|
||||
)
|
||||
}
|
||||
onReject={() =>
|
||||
handleEventResponse("reject", item.id, item.conversationId!)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { View, Text, TextInput, Pressable } from 'react-native';
|
||||
import { useLocalSearchParams } from 'expo-router';
|
||||
import BaseBackground from '../../components/BaseBackground';
|
||||
import { View, Text, TextInput, Pressable } from "react-native";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import BaseBackground from "../../components/BaseBackground";
|
||||
|
||||
const EventDetailScreen = () => {
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
@@ -12,7 +12,7 @@ const EventDetailScreen = () => {
|
||||
// TODO: Delete button -> EventService.delete()
|
||||
// TODO: Link to NoteScreen for this event
|
||||
// TODO: Loading and error states
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<BaseBackground>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { View, Text, TextInput, Pressable } from 'react-native';
|
||||
import BaseBackground from '../components/BaseBackground';
|
||||
import { View, Text, TextInput, Pressable } from "react-native";
|
||||
import BaseBackground from "../components/BaseBackground";
|
||||
|
||||
const LoginScreen = () => {
|
||||
// TODO: Email input field
|
||||
@@ -8,7 +8,7 @@ const LoginScreen = () => {
|
||||
// TODO: Link to RegisterScreen
|
||||
// TODO: Error handling and display
|
||||
// TODO: Navigate to Calendar on success
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<BaseBackground>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { View, Text, TextInput, Pressable } from 'react-native';
|
||||
import { useLocalSearchParams } from 'expo-router';
|
||||
import BaseBackground from '../../components/BaseBackground';
|
||||
import { View, Text, TextInput, Pressable } from "react-native";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import BaseBackground from "../../components/BaseBackground";
|
||||
|
||||
const NoteScreen = () => {
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
@@ -10,7 +10,7 @@ const NoteScreen = () => {
|
||||
// TODO: Auto-save or manual save button
|
||||
// TODO: Save changes -> EventService.update({ note: ... })
|
||||
// TODO: Loading and error states
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<BaseBackground>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { View, Text, TextInput, Pressable } from 'react-native';
|
||||
import BaseBackground from '../components/BaseBackground';
|
||||
import { View, Text, TextInput, Pressable } from "react-native";
|
||||
import BaseBackground from "../components/BaseBackground";
|
||||
|
||||
const RegisterScreen = () => {
|
||||
// TODO: Email input field
|
||||
@@ -10,7 +10,7 @@ const RegisterScreen = () => {
|
||||
// TODO: Link to LoginScreen
|
||||
// TODO: Error handling and display
|
||||
// TODO: Navigate to Calendar on success
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<BaseBackground>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { View } from "react-native"
|
||||
import currentTheme from "../Themes"
|
||||
import { View } from "react-native";
|
||||
import currentTheme from "../Themes";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
type BaseBackgroundProps = {
|
||||
children?: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const BaseBackground = (props: BaseBackgroundProps) => {
|
||||
return (
|
||||
@@ -17,7 +17,7 @@ const BaseBackground = (props: BaseBackgroundProps) => {
|
||||
>
|
||||
{props.children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export default BaseBackground;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { View, Text, Pressable } from 'react-native';
|
||||
import { CalendarEvent } from '@caldav/shared';
|
||||
import { View, Text, Pressable } from "react-native";
|
||||
import { CalendarEvent } from "@caldav/shared";
|
||||
|
||||
type EventCardProps = {
|
||||
event: CalendarEvent;
|
||||
@@ -10,7 +10,7 @@ const EventCard = ({ event: _event, onPress: _onPress }: EventCardProps) => {
|
||||
// TODO: Display event title, time, and description preview
|
||||
// TODO: Handle onPress to navigate to EventDetailScreen
|
||||
// TODO: Style based on event type or time of day
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<Pressable>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { View, Text, Modal, Pressable } from 'react-native';
|
||||
import { CreateEventDTO } from '@caldav/shared';
|
||||
import { View, Text, Modal, Pressable } from "react-native";
|
||||
import { CreateEventDTO } from "@caldav/shared";
|
||||
|
||||
type EventConfirmDialogProps = {
|
||||
visible: boolean;
|
||||
@@ -20,7 +20,7 @@ const EventConfirmDialog = ({
|
||||
// TODO: Confirm button calls onConfirm and closes dialog
|
||||
// TODO: Reject button calls onReject and closes dialog
|
||||
// TODO: Close button or backdrop tap calls onClose
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
|
||||
return (
|
||||
<Modal visible={false} transparent animationType="fade">
|
||||
|
||||
@@ -41,7 +41,10 @@ export const ProposedEventCard = ({
|
||||
{formatDateTime(event?.startTime)}
|
||||
</Text>
|
||||
{event?.description && (
|
||||
<Text style={{ color: currentTheme.textSecondary }} className="text-sm mt-1">
|
||||
<Text
|
||||
style={{ color: currentTheme.textSecondary }}
|
||||
className="text-sm mt-1"
|
||||
>
|
||||
{event.description}
|
||||
</Text>
|
||||
)}
|
||||
@@ -65,7 +68,10 @@ export const ProposedEventCard = ({
|
||||
borderColor: currentTheme.confirmButton,
|
||||
}}
|
||||
>
|
||||
<Text style={{ color: currentTheme.buttonText }} className="font-medium">
|
||||
<Text
|
||||
style={{ color: currentTheme.buttonText }}
|
||||
className="font-medium"
|
||||
>
|
||||
Annehmen
|
||||
</Text>
|
||||
</Pressable>
|
||||
@@ -81,7 +87,10 @@ export const ProposedEventCard = ({
|
||||
borderColor: currentTheme.rejectButton,
|
||||
}}
|
||||
>
|
||||
<Text style={{ color: currentTheme.buttonText }} className="font-medium">
|
||||
<Text
|
||||
style={{ color: currentTheme.buttonText }}
|
||||
className="font-medium"
|
||||
>
|
||||
Ablehnen
|
||||
</Text>
|
||||
</Pressable>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { LoginDTO, CreateUserDTO, AuthResponse } from '@caldav/shared';
|
||||
import { LoginDTO, CreateUserDTO, AuthResponse } from "@caldav/shared";
|
||||
|
||||
export const AuthService = {
|
||||
login: async (_credentials: LoginDTO): Promise<AuthResponse> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
register: async (_data: CreateUserDTO): Promise<AuthResponse> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
logout: async (): Promise<void> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
refresh: async (): Promise<AuthResponse> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,27 +28,32 @@ export const ChatService = {
|
||||
action: EventAction,
|
||||
event?: CreateEventDTO,
|
||||
eventId?: string,
|
||||
updates?: UpdateEventDTO
|
||||
updates?: UpdateEventDTO,
|
||||
): Promise<ChatResponse> => {
|
||||
const body: ConfirmEventRequest = { action, event, eventId, updates };
|
||||
return ApiClient.post<ChatResponse>(`/chat/confirm/${conversationId}/${messageId}`, body);
|
||||
return ApiClient.post<ChatResponse>(
|
||||
`/chat/confirm/${conversationId}/${messageId}`,
|
||||
body,
|
||||
);
|
||||
},
|
||||
|
||||
rejectEvent: async (
|
||||
conversationId: string,
|
||||
messageId: string
|
||||
messageId: string,
|
||||
): Promise<ChatResponse> => {
|
||||
return ApiClient.post<ChatResponse>(`/chat/reject/${conversationId}/${messageId}`);
|
||||
return ApiClient.post<ChatResponse>(
|
||||
`/chat/reject/${conversationId}/${messageId}`,
|
||||
);
|
||||
},
|
||||
|
||||
getConversations: async (): Promise<ConversationSummary[]> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
getConversation: async (
|
||||
_id: string,
|
||||
_options?: GetMessagesOptions
|
||||
_options?: GetMessagesOptions,
|
||||
): Promise<ChatMessage[]> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
import { CalendarEvent, CreateEventDTO, UpdateEventDTO } from '@caldav/shared';
|
||||
import { CalendarEvent, CreateEventDTO, UpdateEventDTO } from "@caldav/shared";
|
||||
|
||||
export const EventService = {
|
||||
getAll: async (): Promise<CalendarEvent[]> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
getById: async (_id: string): Promise<CalendarEvent> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
getByDateRange: async (_start: Date, _end: Date): Promise<CalendarEvent[]> => {
|
||||
throw new Error('Not implemented');
|
||||
getByDateRange: async (
|
||||
_start: Date,
|
||||
_end: Date,
|
||||
): Promise<CalendarEvent[]> => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
create: async (_data: CreateEventDTO): Promise<CalendarEvent> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
update: async (_id: string, _data: UpdateEventDTO): Promise<CalendarEvent> => {
|
||||
throw new Error('Not implemented');
|
||||
update: async (
|
||||
_id: string,
|
||||
_data: UpdateEventDTO,
|
||||
): Promise<CalendarEvent> => {
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
|
||||
delete: async (_id: string): Promise<void> => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { ApiClient, API_BASE_URL } from './ApiClient';
|
||||
export { AuthService } from './AuthService';
|
||||
export { EventService } from './EventService';
|
||||
export { ChatService } from './ChatService';
|
||||
export { ApiClient, API_BASE_URL } from "./ApiClient";
|
||||
export { AuthService } from "./AuthService";
|
||||
export { EventService } from "./EventService";
|
||||
export { ChatService } from "./ChatService";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { create } from 'zustand';
|
||||
import { User } from '@caldav/shared';
|
||||
import { create } from "zustand";
|
||||
import { User } from "@caldav/shared";
|
||||
|
||||
interface AuthState {
|
||||
user: User | null;
|
||||
@@ -15,12 +15,12 @@ export const useAuthStore = create<AuthState>((set) => ({
|
||||
token: null,
|
||||
isAuthenticated: false,
|
||||
login: (_user: User, _token: string) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
logout: () => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
setToken: (_token: string) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { create } from 'zustand';
|
||||
import { CalendarEvent } from '@caldav/shared';
|
||||
import { create } from "zustand";
|
||||
import { CalendarEvent } from "@caldav/shared";
|
||||
|
||||
interface EventsState {
|
||||
events: CalendarEvent[];
|
||||
@@ -12,15 +12,15 @@ interface EventsState {
|
||||
export const useEventsStore = create<EventsState>((set) => ({
|
||||
events: [],
|
||||
setEvents: (_events: CalendarEvent[]) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
addEvent: (_event: CalendarEvent) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
updateEvent: (_id: string, _event: Partial<CalendarEvent>) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
deleteEvent: (_id: string) => {
|
||||
throw new Error('Not implemented');
|
||||
throw new Error("Not implemented");
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { useAuthStore } from './AuthStore';
|
||||
export { useEventsStore } from './EventsStore';
|
||||
export { useAuthStore } from "./AuthStore";
|
||||
export { useEventsStore } from "./EventsStore";
|
||||
|
||||
Reference in New Issue
Block a user