mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* feat(companion): add dark mode support using NativeWind system preference - Set userInterfaceStyle to 'automatic' in app.json to follow system preference - Add useColorScheme hook from NativeWind to detect color scheme - Update root layout with dynamic colors for StatusBar, containers, and modals - Update tabs layout with dynamic colors for tab bar and icons - Update all Stack.Screen options to use dynamic background colors and blur effects - Support both iOS and Android with appropriate dark mode colors Co-Authored-By: [email protected] <[email protected]> * fix(companion): use NativeWind dark: variant classes for automatic dark mode Use dark: Tailwind variant classes instead of conditional logic based on useColorScheme for the container background. This ensures NativeWind automatically applies dark mode styles based on system preference. Co-Authored-By: [email protected] <[email protected]> * fix(companion): use darkMode 'media' for automatic dark mode detection - Changed darkMode from 'class' to 'media' in tailwind.config.js - Updated global.css to use @media (prefers-color-scheme: dark) instead of .dark selector - This ensures NativeWind properly detects system color scheme on iOS/Android Co-Authored-By: [email protected] <[email protected]> * dark mode starting * feat(companion): add dark mode support to core infrastructure (Phase 1) * feat(companion): add dark mode support to tab pages (Phase 2) * fix(companion): add dark mode support to booking list components for font visibility * fix(companion): add dark mode support to EventTypeListItem components * event types and bookings page * Availability list page * more page, and some ui fixes * feat(companion): add dark mode support to detail screens and modals - BookingDetailScreen (iOS & Android): dynamic colors for all UI elements - AvailabilityDetailScreen (iOS & Android): dark mode backgrounds and text - profile-sheet (iOS & Android): dark mode support for profile modal - RescheduleScreen (all platforms): dark mode for date/time pickers - EditLocationScreen (iOS & Android): dark mode for location editor - AddGuestsScreen: partial dark mode implementation (in progress) Uses iOS system colors: #000000 (black), #1C1C1E (secondary), #FFFFFF (white), #38383A (border), #8E8E93 (text secondary) * fix typecheck and lint * feat(companion): add dark mode support to remaining screens - ScreenWrapper: Fix hardcoded #800020 color with dynamic destructive color - EditAvailabilityDayScreen: Add dark mode for Android/Web and iOS - EditAvailabilityHoursScreen: Add dark mode for Android/Web and iOS - EditAvailabilityNameScreen: Add dark mode for Android/Web and iOS - EditAvailabilityOverrideScreen: Add dark mode for Web, iOS, and Android - MarkNoShowScreen: Add dark mode with dynamic colors for no-show states - MeetingSessionDetailsScreen: Add dark mode for session details - ViewRecordingsScreen: Add dark mode for recordings list Uses iOS system colors (#000000, #1C1C1E, #38383A, #8E8E93) and useColorScheme hook for automatic theme detection. * fix(companion): fix iOS modal dark mode backgrounds for transparent glass UI * fix(companion): fix dark mode for booking action screens in transparent background mode * fix(companion): fix Android dark mode for transparent background in EditAvailabilityOverrideScreen * refactor(companion): centralize dark mode colors and align with main website - Update tailwind.config.js with centralized color definitions - Create constants/colors.ts for inline style color references - Replace iOS system colors with main website neutral grays: - #1C1C1E -> #171717 (secondary dark background) - #38383A -> #4D4D4D (dark border) - #8E8E93 -> #A3A3A3 (secondary text dark) - Keep pure black (#000000) for main backgrounds (OLED friendly) - Add semantic color mappings for consistent UI styling * feat(companion): complete dark mode implementation across all priority files - Priority 1: Updated SettingsUI.tsx, BasicsTab.tsx, LimitsTab.tsx, AdvancedTab.tsx, RecurringTab.tsx, AvailabilityTab.tsx, event-type-detail.tsx - Priority 2: Updated edit-availability-hours/name/override/day.tsx, oauth/callback.tsx - Priority 3: Updated AvailabilityListScreen.tsx with dark mode for modals and list items - Priority 4: Updated BookingActionsModal.tsx, BookingActionsModal.ios.tsx, GlassModalHeader.tsx, LoginScreen.tsx, LocationsList.tsx, SearchHeader.tsx, toast.tsx Dark mode colors used: - Main bg: #000000 (cal.bg.dark) - Secondary bg: #171717 (cal.bg.secondaryDark) - Muted bg: #262626 (cal.bg.mutedDark) - Borders: #4D4D4D (cal.border.dark) - Secondary text: #A3A3A3 (cal.text.secondaryDark) * fix(companion): add dark mode support to iOS header, GlassView modals, and main content background * fix(companion): add dark mode support to toggle/switch components * fix(companion): use iOS green (#34C759) for toggle ON state in dark mode * fix(companion): use white track + black thumb for dark mode toggles * fix(companion): add dark mode support to login page logo and button * dark mode to many pages, centralize the colors * dark mode skelaton * Availability pages android * toggles * headers * red color for dark mode * copy button * white flash on bottom ui native ios sheet * bottom sheet buttons * bottom sheet in gray color * bottom sheet again.. yeahh * toggle green * toggle green * fix lint and typechecks * fix exntension error * Update companion/components/event-type-detail/tabs/LimitsTabDatePicker.android.tsx Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * address cubic comments --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
219 lines
6.9 KiB
TypeScript
219 lines
6.9 KiB
TypeScript
import { Ionicons } from "@expo/vector-icons";
|
|
import * as Clipboard from "expo-clipboard";
|
|
import * as Haptics from "expo-haptics";
|
|
import { Stack, useRouter } from "expo-router";
|
|
import {
|
|
ActivityIndicator,
|
|
Image,
|
|
ScrollView,
|
|
Text,
|
|
TouchableOpacity,
|
|
useColorScheme,
|
|
View,
|
|
} from "react-native";
|
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
import { HeaderButtonWrapper } from "@/components/HeaderButtonWrapper";
|
|
import { useUserProfile } from "@/hooks";
|
|
import { showSuccessAlert } from "@/utils/alerts";
|
|
import { openInAppBrowser } from "@/utils/browser";
|
|
import { getAvatarUrl } from "@/utils/getAvatarUrl";
|
|
|
|
interface ProfileMenuItem {
|
|
id: string;
|
|
label: string;
|
|
icon: keyof typeof Ionicons.glyphMap;
|
|
onPress: () => void;
|
|
external?: boolean;
|
|
}
|
|
|
|
export default function ProfileSheet() {
|
|
const router = useRouter();
|
|
const insets = useSafeAreaInsets();
|
|
const { data: userProfile, isLoading } = useUserProfile();
|
|
const colorScheme = useColorScheme();
|
|
const isDark = colorScheme === "dark";
|
|
|
|
const colors = {
|
|
background: isDark ? "#000000" : "#FFFFFF",
|
|
text: isDark ? "#FFFFFF" : "#111827",
|
|
textSecondary: isDark ? "#A3A3A3" : "#6B7280",
|
|
icon: isDark ? "#FFFFFF" : "#374151",
|
|
iconSecondary: isDark ? "#636366" : "#9CA3AF",
|
|
avatarBg: isDark ? "#4D4D4D" : "#E5E7EB",
|
|
avatarText: isDark ? "#FFFFFF" : "#4B5563",
|
|
activeBackground: isDark ? "#171717" : "#F3F4F6",
|
|
};
|
|
|
|
const publicPageUrl = userProfile?.username ? `https://cal.com/${userProfile.username}` : null;
|
|
|
|
const menuItems: ProfileMenuItem[] = [
|
|
{
|
|
id: "profile",
|
|
label: "My Profile",
|
|
icon: "person-outline",
|
|
onPress: () =>
|
|
openInAppBrowser("https://app.cal.com/settings/my-account/profile", "Profile page"),
|
|
external: true,
|
|
},
|
|
{
|
|
id: "settings",
|
|
label: "My Settings",
|
|
icon: "settings-outline",
|
|
onPress: () =>
|
|
openInAppBrowser("https://app.cal.com/settings/my-account/general", "Settings page"),
|
|
external: true,
|
|
},
|
|
{
|
|
id: "outOfOffice",
|
|
label: "Out of Office",
|
|
icon: "moon-outline",
|
|
onPress: () =>
|
|
openInAppBrowser(
|
|
"https://app.cal.com/settings/my-account/out-of-office",
|
|
"Out of Office page"
|
|
),
|
|
external: true,
|
|
},
|
|
{
|
|
id: "publicPage",
|
|
label: "View public page",
|
|
icon: "globe-outline",
|
|
onPress: () => {
|
|
if (publicPageUrl) openInAppBrowser(publicPageUrl, "Public page");
|
|
},
|
|
external: true,
|
|
},
|
|
{
|
|
id: "copyPublicPage",
|
|
label: "Copy public page link",
|
|
icon: "copy-outline",
|
|
onPress: async () => {
|
|
if (publicPageUrl) {
|
|
await Clipboard.setStringAsync(publicPageUrl);
|
|
await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
showSuccessAlert("Copied!", "Public page link copied to clipboard");
|
|
}
|
|
},
|
|
external: false,
|
|
},
|
|
{
|
|
id: "roadmap",
|
|
label: "Roadmap",
|
|
icon: "map-outline",
|
|
onPress: () => openInAppBrowser("https://cal.com/roadmap", "Roadmap page"),
|
|
external: true,
|
|
},
|
|
{
|
|
id: "help",
|
|
label: "Help",
|
|
icon: "help-circle-outline",
|
|
onPress: () => openInAppBrowser("https://cal.com/help", "Help page"),
|
|
external: true,
|
|
},
|
|
];
|
|
|
|
const handleClose = () => {
|
|
router.back();
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Stack.Screen
|
|
options={{
|
|
headerShown: true,
|
|
title: "Profile",
|
|
presentation: "modal",
|
|
contentStyle: {
|
|
backgroundColor: colors.background,
|
|
},
|
|
headerStyle: {
|
|
backgroundColor: colors.background,
|
|
},
|
|
headerTintColor: colors.text,
|
|
headerLeft: () => null,
|
|
headerRight: () => (
|
|
<HeaderButtonWrapper side="right">
|
|
<TouchableOpacity onPress={handleClose} style={{ padding: 8 }}>
|
|
<Ionicons name="close" size={24} color={colors.text} />
|
|
</TouchableOpacity>
|
|
</HeaderButtonWrapper>
|
|
),
|
|
}}
|
|
/>
|
|
|
|
<ScrollView
|
|
style={{ flex: 1, backgroundColor: colors.background }}
|
|
contentContainerStyle={{ paddingBottom: insets.bottom + 20 }}
|
|
>
|
|
{/* Profile Header */}
|
|
<View className="px-6 py-6">
|
|
{isLoading ? (
|
|
<View className="items-center py-8">
|
|
<ActivityIndicator size="large" color={colors.text} />
|
|
</View>
|
|
) : (
|
|
<View className="flex-row items-center">
|
|
{/* Avatar */}
|
|
{userProfile?.avatarUrl ? (
|
|
<Image
|
|
source={{ uri: getAvatarUrl(userProfile.avatarUrl) }}
|
|
style={{ width: 64, height: 64, borderRadius: 32 }}
|
|
/>
|
|
) : (
|
|
<View
|
|
className="items-center justify-center rounded-full"
|
|
style={{ width: 64, height: 64, backgroundColor: colors.avatarBg }}
|
|
>
|
|
<Text className="text-2xl font-semibold" style={{ color: colors.avatarText }}>
|
|
{userProfile?.name?.charAt(0).toUpperCase() ||
|
|
userProfile?.email?.charAt(0).toUpperCase() ||
|
|
"?"}
|
|
</Text>
|
|
</View>
|
|
)}
|
|
|
|
{/* Name and Email */}
|
|
<View className="ml-4 flex-1">
|
|
<Text className="text-xl font-semibold" style={{ color: colors.text }}>
|
|
{userProfile?.name || "User"}
|
|
</Text>
|
|
{userProfile?.email ? (
|
|
<Text className="mt-1 text-sm" style={{ color: colors.textSecondary }}>
|
|
{userProfile.email}
|
|
</Text>
|
|
) : null}
|
|
</View>
|
|
</View>
|
|
)}
|
|
</View>
|
|
|
|
{/* Menu Items */}
|
|
<View className="px-2 py-4">
|
|
{menuItems.map((item, index) => (
|
|
<TouchableOpacity
|
|
key={item.id}
|
|
className={`flex-row items-center justify-between rounded-xl px-4 py-4 ${
|
|
index < menuItems.length - 1 ? "mb-1" : ""
|
|
}`}
|
|
style={{ backgroundColor: "transparent" }}
|
|
onPress={item.onPress}
|
|
>
|
|
<View className="flex-row items-center">
|
|
<Ionicons name={item.icon} size={22} color={colors.icon} />
|
|
<Text className="ml-4 text-base" style={{ color: colors.text }}>
|
|
{item.label}
|
|
</Text>
|
|
</View>
|
|
{item.external ? (
|
|
<Ionicons name="open-outline" size={18} color={colors.iconSecondary} />
|
|
) : (
|
|
<Ionicons name="chevron-forward" size={18} color={colors.iconSecondary} />
|
|
)}
|
|
</TouchableOpacity>
|
|
))}
|
|
</View>
|
|
</ScrollView>
|
|
</>
|
|
);
|
|
}
|