Skip to content

Commit 173dd77

Browse files
committed
Fix classname sorting and OAuth callback
1 parent 1ed0016 commit 173dd77

File tree

8 files changed

+43
-53
lines changed

8 files changed

+43
-53
lines changed

apps/array/src/constants/oauth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function getCloudUrlFromRegion(region: CloudRegion): string {
2323
case "eu":
2424
return "https://eu.posthog.com";
2525
case "dev":
26-
return "http://localhost:8237";
26+
return "http://localhost:8010";
2727
}
2828
}
2929

apps/mobile/src/app/(auth)/settings.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ export default function SettingsScreen() {
1414
<View className="flex-1 px-6 pt-16">
1515
{/* Header */}
1616
<View className="mb-10">
17-
<Text className="text-3xl font-bold text-white mb-2">Settings</Text>
17+
<Text className="mb-2 font-bold text-3xl text-white">Settings</Text>
1818
<Text className="text-base text-dark-text-muted">
1919
App preferences
2020
</Text>
2121
</View>
2222

2323
{/* Placeholder Content */}
24-
<View className="bg-dark-surface rounded-xl p-4 mb-6">
25-
<Text className="text-sm text-dark-text-muted text-center">
24+
<View className="mb-6 rounded-xl bg-dark-surface p-4">
25+
<Text className="text-center text-dark-text-muted text-sm">
2626
Settings coming soon...
2727
</Text>
2828
</View>
2929

3030
{/* Logout Button */}
3131
<TouchableOpacity
32-
className="bg-dark-surface py-4 rounded-lg items-center border border-dark-border"
32+
className="items-center rounded-lg border border-dark-border bg-dark-surface py-4"
3333
onPress={handleLogout}
3434
>
35-
<Text className="text-white text-base font-semibold">Sign out</Text>
35+
<Text className="font-semibold text-base text-white">Sign out</Text>
3636
</TouchableOpacity>
3737
</View>
3838
</SafeAreaView>

apps/mobile/src/app/(auth)/tasks.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ export default function TasksScreen() {
1010
<View className="flex-1 px-6 pt-16">
1111
{/* Header */}
1212
<View className="mb-10">
13-
<Text className="text-3xl font-bold text-white mb-2">Tasks</Text>
13+
<Text className="mb-2 font-bold text-3xl text-white">Tasks</Text>
1414
<Text className="text-base text-dark-text-muted">
1515
Your PostHog tasks
1616
</Text>
1717
</View>
1818

1919
{/* Info Card */}
20-
<View className="bg-dark-surface rounded-xl p-4 mb-6">
20+
<View className="mb-6 rounded-xl bg-dark-surface p-4">
2121
<View className="flex-row justify-between py-2">
22-
<Text className="text-sm text-dark-text-muted">Region</Text>
23-
<Text className="text-sm font-medium text-white">
22+
<Text className="text-dark-text-muted text-sm">Region</Text>
23+
<Text className="font-medium text-sm text-white">
2424
{cloudRegion?.toUpperCase() || "N/A"}
2525
</Text>
2626
</View>
2727
<View className="flex-row justify-between py-2">
28-
<Text className="text-sm text-dark-text-muted">Project ID</Text>
29-
<Text className="text-sm font-medium text-white">
28+
<Text className="text-dark-text-muted text-sm">Project ID</Text>
29+
<Text className="font-medium text-sm text-white">
3030
{projectId || "N/A"}
3131
</Text>
3232
</View>
3333
</View>
3434

3535
{/* Empty State */}
3636
<View className="flex-1 items-center justify-center">
37-
<Text className="text-dark-text-muted text-base">No tasks yet</Text>
37+
<Text className="text-base text-dark-text-muted">No tasks yet</Text>
3838
</View>
3939
</View>
4040
</SafeAreaView>

apps/mobile/src/app/auth.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function AuthScreen() {
4848
<View className="flex-1 px-6 pt-16">
4949
{/* Header */}
5050
<View className="mb-10">
51-
<Text className="text-3xl font-bold text-white mb-2">
51+
<Text className="mb-2 font-bold text-3xl text-white">
5252
PostHog Mobile
5353
</Text>
5454
<Text className="text-base text-dark-text-muted">
@@ -58,24 +58,24 @@ export default function AuthScreen() {
5858

5959
{/* Form */}
6060
<View className="gap-4">
61-
<Text className="text-sm font-medium text-dark-text-muted mb-2">
61+
<Text className="mb-2 font-medium text-dark-text-muted text-sm">
6262
PostHog region
6363
</Text>
6464

6565
{/* Region Picker */}
66-
<View className="flex-row gap-3 mb-4">
66+
<View className="mb-4 flex-row gap-3">
6767
{REGIONS.map((region) => (
6868
<TouchableOpacity
6969
key={region.value}
70-
className={`flex-1 py-3 px-4 rounded-lg border items-center ${
70+
className={`flex-1 items-center rounded-lg border px-4 py-3 ${
7171
selectedRegion === region.value
7272
? "border-orange-500 bg-orange-500/10"
7373
: "border-dark-border bg-dark-surface"
7474
}`}
7575
onPress={() => setSelectedRegion(region.value)}
7676
>
7777
<Text
78-
className={`text-sm font-medium ${
78+
className={`font-medium text-sm ${
7979
selectedRegion === region.value
8080
? "text-orange-500"
8181
: "text-dark-text-muted"
@@ -89,14 +89,14 @@ export default function AuthScreen() {
8989

9090
{/* Error Message */}
9191
{error && (
92-
<View className="bg-red-500/10 rounded-lg p-3 border border-red-500">
92+
<View className="rounded-lg border border-red-500 bg-red-500/10 p-3">
9393
<Text className="text-red-500 text-sm">{error}</Text>
9494
</View>
9595
)}
9696

9797
{/* Loading Message */}
9898
{isLoading && (
99-
<View className="bg-blue-500/10 rounded-lg p-3 border border-blue-500">
99+
<View className="rounded-lg border border-blue-500 bg-blue-500/10 p-3">
100100
<Text className="text-blue-500 text-sm">
101101
Waiting for authorization in your browser...
102102
</Text>
@@ -105,7 +105,7 @@ export default function AuthScreen() {
105105

106106
{/* Sign In Button */}
107107
<TouchableOpacity
108-
className={`py-4 rounded-lg items-center mt-2 ${
108+
className={`mt-2 items-center rounded-lg py-4 ${
109109
isLoading ? "bg-gray-600" : "bg-orange-500"
110110
}`}
111111
onPress={handleSignIn}
@@ -114,7 +114,7 @@ export default function AuthScreen() {
114114
{isLoading ? (
115115
<ActivityIndicator color="#fff" />
116116
) : (
117-
<Text className="text-white text-base font-semibold">
117+
<Text className="font-semibold text-base text-white">
118118
Sign in with PostHog
119119
</Text>
120120
)}

apps/mobile/src/app/chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text, View } from "react-native";
22
import { SafeAreaView } from "react-native-safe-area-context";
3-
import { Message, MessagesList } from "../components/MessagesList";
3+
import { type Message, MessagesList } from "../components/MessagesList";
44

55
// Sample messages for demo
66
const SAMPLE_MESSAGES: Message[] = [
@@ -13,8 +13,8 @@ export default function ChatScreen() {
1313
return (
1414
<SafeAreaView className="flex-1 bg-dark-bg">
1515
{/* Header */}
16-
<View className="px-6 pt-4 pb-2 border-b border-dark-border">
17-
<Text className="text-xl font-bold text-white">Chat</Text>
16+
<View className="border-dark-border border-b px-6 pt-4 pb-2">
17+
<Text className="font-bold text-white text-xl">Chat</Text>
1818
</View>
1919

2020
{/* Messages */}

apps/mobile/src/app/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function AppContent() {
2020

2121
if (isLoading) {
2222
return (
23-
<View className="flex-1 bg-dark-bg items-center justify-center">
23+
<View className="flex-1 items-center justify-center bg-dark-bg">
2424
<ActivityIndicator size="large" color="#f97316" />
2525
</View>
2626
);

apps/mobile/src/constants/oauth.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
1-
import type { CloudRegion } from '../types/oauth';
1+
import type { CloudRegion } from "../types/oauth";
22

3-
export const POSTHOG_US_CLIENT_ID = 'HCWoE0aRFMYxIxFNTTwkOORn5LBjOt2GVDzwSw5W';
4-
export const POSTHOG_EU_CLIENT_ID = 'AIvijgMS0dxKEmr5z6odvRd8Pkh5vts3nPTzgzU9';
5-
export const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';
6-
7-
// OAuth callback port for mobile (different from desktop which uses 8237)
8-
export const MOBILE_OAUTH_PORT = 8238;
3+
export const POSTHOG_US_CLIENT_ID = "HCWoE0aRFMYxIxFNTTwkOORn5LBjOt2GVDzwSw5W";
4+
export const POSTHOG_EU_CLIENT_ID = "AIvijgMS0dxKEmr5z6odvRd8Pkh5vts3nPTzgzU9";
5+
export const POSTHOG_DEV_CLIENT_ID = "DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ";
96

107
export const OAUTH_SCOPES = [
11-
'user:read',
12-
'project:read',
13-
'task:write',
14-
'integration:read',
8+
"user:read",
9+
"project:read",
10+
"task:write",
11+
"integration:read",
1512
];
1613

1714
// Token refresh settings
1815
export const TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1000; // 5 minutes before expiry
1916

2017
export function getCloudUrlFromRegion(region: CloudRegion): string {
2118
switch (region) {
22-
case 'us':
23-
return 'https://us.posthog.com';
24-
case 'eu':
25-
return 'https://eu.posthog.com';
26-
case 'dev':
27-
return 'http://localhost:8010';
19+
case "us":
20+
return "https://us.posthog.com";
21+
case "eu":
22+
return "https://eu.posthog.com";
23+
case "dev":
24+
return "http://localhost:8010";
2825
}
2926
}
3027

3128
export function getOauthClientIdFromRegion(region: CloudRegion): string {
3229
switch (region) {
33-
case 'us':
30+
case "us":
3431
return POSTHOG_US_CLIENT_ID;
35-
case 'eu':
32+
case "eu":
3633
return POSTHOG_EU_CLIENT_ID;
37-
case 'dev':
34+
case "dev":
3835
return POSTHOG_DEV_CLIENT_ID;
3936
}
4037
}

apps/mobile/src/lib/oauth.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import * as WebBrowser from "expo-web-browser";
44
import {
55
getCloudUrlFromRegion,
66
getOauthClientIdFromRegion,
7-
MOBILE_OAUTH_PORT,
8-
OAUTH_SCOPES,
97
} from "../constants/oauth";
108
import type {
119
CloudRegion,
@@ -37,11 +35,6 @@ async function generateCodeChallenge(verifier: string): Promise<string> {
3735
}
3836

3937
export function getRedirectUri(): string {
40-
// Use localhost callback for development, custom scheme for production
41-
if (__DEV__) {
42-
return `http://localhost:${MOBILE_OAUTH_PORT}/callback`;
43-
}
44-
4538
return AuthSession.makeRedirectUri({
4639
scheme: "posthog-mobile",
4740
path: "callback",

0 commit comments

Comments
 (0)