Files
calchat/apps/client/src/components/ProposedEventCard.tsx
Linus Waldowsky 43d40b46d7 feat: add theme system with light/dark mode support
- Add ThemeStore (Zustand) for reactive theme switching
- Add Themes.tsx with THEMES object (defaultLight, defaultDark)
- Add Settings screen with theme switcher and logout button
- Add BaseButton component for reusable themed buttons
- Migrate all components from static currentTheme to useThemeStore()
- Add shadowColor to theme (iOS only, Android uses elevation)
- All text elements now use theme colors (textPrimary, textSecondary, etc.)
- Update tab navigation to include Settings tab
- Move logout from Header to Settings screen
2026-01-24 16:57:33 +01:00

95 lines
2.4 KiB
TypeScript

import { View, Text, Pressable } from "react-native";
import { ProposedEventChange } from "@calchat/shared";
import { useThemeStore } from "../stores/ThemeStore";
import { EventCardBase } from "./EventCardBase";
type ProposedEventCardProps = {
proposedChange: ProposedEventChange;
onConfirm: () => void;
onReject: () => void;
};
const ConfirmRejectButtons = ({
isDisabled,
respondedAction,
onConfirm,
onReject,
}: {
isDisabled: boolean;
respondedAction?: "confirm" | "reject";
onConfirm: () => void;
onReject: () => void;
}) => {
const { theme } = useThemeStore();
return (
<View className="flex-row mt-3 gap-2">
<Pressable
onPress={onConfirm}
disabled={isDisabled}
className="flex-1 py-2 rounded-lg items-center"
style={{
backgroundColor: isDisabled
? theme.disabledButton
: theme.confirmButton,
borderWidth: respondedAction === "confirm" ? 2 : 0,
borderColor: theme.confirmButton,
}}
>
<Text style={{ color: theme.buttonText }} className="font-medium">
Annehmen
</Text>
</Pressable>
<Pressable
onPress={onReject}
disabled={isDisabled}
className="flex-1 py-2 rounded-lg items-center"
style={{
backgroundColor: isDisabled
? theme.disabledButton
: theme.rejectButton,
borderWidth: respondedAction === "reject" ? 2 : 0,
borderColor: theme.rejectButton,
}}
>
<Text style={{ color: theme.buttonText }} className="font-medium">
Ablehnen
</Text>
</Pressable>
</View>
);
};
export const ProposedEventCard = ({
proposedChange,
onConfirm,
onReject,
}: ProposedEventCardProps) => {
const event = proposedChange.event;
// respondedAction is now part of the proposedChange
const isDisabled = !!proposedChange.respondedAction;
if (!event) {
return null;
}
return (
<View className="mt-2">
<EventCardBase
className="m-2"
title={event.title}
startTime={event.startTime}
endTime={event.endTime}
description={event.description}
isRecurring={event.isRecurring}
>
<ConfirmRejectButtons
isDisabled={isDisabled}
respondedAction={proposedChange.respondedAction}
onConfirm={onConfirm}
onReject={onReject}
/>
</EventCardBase>
</View>
);
};