Skip to content

Commit a2a7737

Browse files
authored
fix: companion extension oauth (calcom#25939)
* fix: companion extension oauth * fix: ios build * address cubics comments
1 parent ee298af commit a2a7737

18 files changed

Lines changed: 522 additions & 292 deletions

File tree

companion/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ EXPO_PUBLIC_SCHEDULES_CACHE_STALE_TIME_MINUTES=-1
2626

2727
# User Profile cache stale time (default: -1 = never stale)
2828
EXPO_PUBLIC_USER_PROFILE_CACHE_STALE_TIME_MINUTES=-1
29+
30+
# required for dev/local
31+
EXPO_PUBLIC_COMPANION_DEV_URL=http://localhost:8081

companion/app/(tabs)/(event-types)/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { LoadingSpinner } from "../../../components/LoadingSpinner";
2222
import { EmptyScreen } from "../../../components/EmptyScreen";
2323
import { slugify } from "../../../utils/slugify";
2424
import { showErrorAlert } from "../../../utils/alerts";
25+
import { shadows } from "../../../utils/shadows";
2526
import { EventTypeListItem } from "../../../components/event-type-list-item/EventTypeListItem";
2627
import { offlineAwareRefresh } from "../../../utils/network";
2728
import { openInAppBrowser } from "../../../utils/browser";
@@ -570,13 +571,7 @@ export default function EventTypes() {
570571
className="max-h-[90%] w-[90%] max-w-[500px] rounded-2xl bg-white"
571572
activeOpacity={1}
572573
onPress={(e) => e.stopPropagation()}
573-
style={{
574-
shadowColor: "#000",
575-
shadowOffset: { width: 0, height: 20 },
576-
shadowOpacity: 0.25,
577-
shadowRadius: 25,
578-
elevation: 24,
579-
}}
574+
style={shadows.xl()}
580575
>
581576
{/* Header */}
582577
<View className="px-8 pb-4 pt-6">

companion/app/(tabs)/availability.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { LoadingSpinner } from "../../components/LoadingSpinner";
2323
import { EmptyScreen } from "../../components/EmptyScreen";
2424
import { showErrorAlert } from "../../utils/alerts";
2525
import { offlineAwareRefresh } from "../../utils/network";
26+
import { shadows } from "../../utils/shadows";
2627
import {
2728
useSchedules,
2829
useCreateSchedule,
@@ -458,13 +459,7 @@ export default function Availability() {
458459
className="w-[90%] max-w-[500px] rounded-2xl bg-white"
459460
activeOpacity={1}
460461
onPress={(e) => e.stopPropagation()}
461-
style={{
462-
shadowColor: "#000",
463-
shadowOffset: { width: 0, height: 20 },
464-
shadowOpacity: 0.25,
465-
shadowRadius: 25,
466-
elevation: 24,
467-
}}
462+
style={shadows.xl()}
468463
>
469464
{/* Header */}
470465
<View className="px-8 pb-4 pt-6">

companion/app/_layout.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ function RootLayoutContent() {
2727
? {
2828
width: 400,
2929
flex: 1,
30-
display: "flex",
31-
flexDirection: "column",
32-
pointerEvents: "auto",
30+
display: "flex" as const,
31+
flexDirection: "column" as const,
3332
}
3433
: { flex: 1 };
3534

3635
return (
37-
<View style={containerStyle} className={containerClass}>
36+
<View
37+
style={[containerStyle, Platform.OS === "web" && { pointerEvents: "auto" as const }]}
38+
className={containerClass}
39+
>
3840
<StatusBar barStyle="dark-content" backgroundColor="#ffffff" />
3941
{content}
4042
<NetworkStatusBanner />

companion/app/booking-detail.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
1515
import { CalComAPIService, Booking } from "../services/calcom";
1616
import { showErrorAlert } from "../utils/alerts";
1717
import { openInAppBrowser } from "../utils/browser";
18+
import { shadows } from "../utils/shadows";
1819
import { SvgImage } from "../components/SvgImage";
1920
import { FullScreenModal } from "../components/FullScreenModal";
2021
import { BookingActionsModal } from "../components/BookingActionsModal";
@@ -571,13 +572,7 @@ export default function BookingDetail() {
571572
className="w-[90%] max-w-[500px] rounded-2xl bg-white"
572573
activeOpacity={1}
573574
onPress={(e) => e.stopPropagation()}
574-
style={{
575-
shadowColor: "#000",
576-
shadowOffset: { width: 0, height: 20 },
577-
shadowOpacity: 0.25,
578-
shadowRadius: 25,
579-
elevation: 24,
580-
}}
575+
style={shadows.xl()}
581576
>
582577
{/* Header */}
583578
<View className="px-8 pb-4 pt-6">

companion/bun.lock

Lines changed: 97 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

companion/components/LoadingSpinner.tsx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
/**
2-
* LoadingSpinner Component
3-
*
4-
* A stylish loading spinner with iOS glass effect support when available.
5-
* Falls back to a nice styled container on other platforms.
6-
*/
7-
81
import React from "react";
92
import { View, ActivityIndicator, Platform, StyleSheet } from "react-native";
103
import { GlassView, isLiquidGlassAvailable } from "expo-glass-effect";
114

125
interface LoadingSpinnerProps {
13-
/** Size of the spinner - defaults to large */
146
size?: "small" | "large";
15-
/** Color of the spinner - defaults to system color */
167
color?: string;
17-
/** Whether to show the container background */
188
showBackground?: boolean;
199
}
2010

@@ -25,7 +15,6 @@ export function LoadingSpinner({
2515
}: LoadingSpinnerProps) {
2616
const supportsGlass = isLiquidGlassAvailable();
2717

28-
// Use glass effect on supported iOS devices
2918
if (supportsGlass && Platform.OS === "ios") {
3019
return (
3120
<GlassView style={styles.glassContainer} glassEffectStyle="regular">
@@ -34,7 +23,6 @@ export function LoadingSpinner({
3423
);
3524
}
3625

37-
// Styled container for other platforms
3826
if (showBackground) {
3927
return (
4028
<View style={styles.styledContainer}>
@@ -43,7 +31,6 @@ export function LoadingSpinner({
4331
);
4432
}
4533

46-
// Simple spinner without background
4734
return <ActivityIndicator size={size} color={color || "#000000"} />;
4835
}
4936

@@ -60,11 +47,18 @@ const styles = StyleSheet.create({
6047
padding: 24,
6148
borderRadius: 20,
6249
backgroundColor: "rgba(255, 255, 255, 0.9)",
63-
shadowColor: "#000",
64-
shadowOffset: { width: 0, height: 2 },
65-
shadowOpacity: 0.1,
66-
shadowRadius: 8,
67-
elevation: 4,
50+
...Platform.select({
51+
web: {
52+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.1)",
53+
},
54+
default: {
55+
shadowColor: "#000",
56+
shadowOffset: { width: 0, height: 2 },
57+
shadowOpacity: 0.1,
58+
shadowRadius: 8,
59+
elevation: 4,
60+
},
61+
}),
6862
},
6963
});
7064

companion/components/LoginScreen.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { View, Text, TouchableOpacity } from "react-native";
2+
import { View, Text, TouchableOpacity, Platform, StyleSheet } from "react-native";
33
import { useSafeAreaInsets } from "react-native-safe-area-context";
44
import { useAuth } from "../contexts/AuthContext";
55
import { CalComLogo } from "./CalComLogo";
@@ -42,14 +42,21 @@ export function LoginScreen() {
4242
onPress={handleOAuthLogin}
4343
disabled={loading}
4444
className="flex-row items-center justify-center rounded-2xl py-[18px]"
45-
style={{
46-
backgroundColor: loading ? "#9CA3AF" : "#111827",
47-
shadowColor: "#000",
48-
shadowOffset: { width: 0, height: 4 },
49-
shadowOpacity: loading ? 0 : 0.2,
50-
shadowRadius: 12,
51-
elevation: loading ? 0 : 6,
52-
}}
45+
style={[
46+
{ backgroundColor: loading ? "#9CA3AF" : "#111827" },
47+
Platform.select({
48+
web: {
49+
boxShadow: loading ? "none" : "0 4px 12px rgba(0, 0, 0, 0.2)",
50+
},
51+
default: {
52+
shadowColor: "#000",
53+
shadowOffset: { width: 0, height: 4 },
54+
shadowOpacity: loading ? 0 : 0.2,
55+
shadowRadius: 12,
56+
elevation: loading ? 0 : 6,
57+
},
58+
}),
59+
]}
5360
activeOpacity={0.9}
5461
>
5562
<Text className="text-[17px] font-semibold text-white">Continue with Cal.com</Text>

companion/components/Tooltip.tsx

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export function Tooltip({ text, children }: TooltipProps) {
1111
const [position, setPosition] = useState({ top: 0, left: 0 });
1212
const containerRef = useRef<any>(null);
1313

14-
// Only show tooltips on web platform
1514
if (Platform.OS !== "web") {
1615
return children;
1716
}
@@ -42,30 +41,25 @@ export function Tooltip({ text, children }: TooltipProps) {
4241
{children}
4342
{showTooltip && (
4443
<View
44+
// @ts-ignore - web-only styles
4545
style={{
4646
position: "fixed",
4747
top: position.top,
4848
left: position.left,
49-
transform: [{ translateX: -50 }, { translateY: -100 }],
49+
transform: "translate(-50%, -100%)",
5050
backgroundColor: "#1a1a1a",
51-
paddingHorizontal: 10,
52-
paddingVertical: 6,
51+
paddingLeft: 10,
52+
paddingRight: 10,
53+
paddingTop: 6,
54+
paddingBottom: 6,
5355
borderRadius: 6,
5456
zIndex: 10002,
5557
pointerEvents: "none",
56-
// @ts-ignore - web-only props
5758
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
5859
}}
5960
>
60-
<Text
61-
style={{
62-
color: "white",
63-
fontSize: 13,
64-
fontWeight: "600",
65-
whiteSpace: "nowrap",
66-
lineHeight: 18,
67-
}}
68-
>
61+
{/* @ts-ignore - web-only styles */}
62+
<Text style={{ color: "white", fontSize: 13, fontWeight: "600", whiteSpace: "nowrap" }}>
6963
{text}
7064
</Text>
7165
</View>

0 commit comments

Comments
 (0)