Skip to content

Commit eaf8600

Browse files
committed
Move getPostHogUrl to renderer utils to fix typecheck
1 parent 2862712 commit eaf8600

11 files changed

Lines changed: 49 additions & 23 deletions

File tree

apps/code/src/renderer/features/auth/components/AuthScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Callout, Flex, Spinner, Text, Theme } from "@radix-ui/themes";
55
import posthogIcon from "@renderer/assets/images/posthog-icon.svg";
66
import phWordmark from "@renderer/assets/images/wordmark.svg";
77
import { trpcClient } from "@renderer/trpc/client";
8-
import { REGION_LABELS } from "@shared/types/regions";
98
import type { CloudRegion } from "@shared/types/regions";
9+
import { REGION_LABELS } from "@shared/types/regions";
1010
import { useMutation } from "@tanstack/react-query";
1111
import { useState } from "react";
1212
import { RegionSelect } from "./RegionSelect";

apps/code/src/renderer/features/auth/stores/authStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
OAUTH_SCOPES,
77
TOKEN_REFRESH_BUFFER_MS,
88
} from "@shared/constants/oauth";
9-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
109
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
1110
import type { CloudRegion } from "@shared/types/regions";
1211
import { sleepWithBackoff } from "@shared/utils/backoff";
12+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
1313
import { useNavigationStore } from "@stores/navigationStore";
1414
import {
1515
identifyUser,

apps/code/src/renderer/features/billing/stores/seatStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useAuthStore } from "@features/auth/stores/authStore";
2-
import { getPostHogUrl } from "@shared/utils/urls";
32
import type { SeatData } from "@shared/types/seat";
43
import { PLAN_FREE, PLAN_PRO } from "@shared/types/seat";
54
import { electronStorage } from "@utils/electronStorage";
65
import { logger } from "@utils/logger";
6+
import { getPostHogUrl } from "@utils/urls";
77
import { create } from "zustand";
88
import { persist } from "zustand/middleware";
99

apps/code/src/renderer/features/git-interaction/hooks/useGitInteraction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
import { invalidateGitBranchQueries } from "@features/git-interaction/utils/gitCacheKeys";
1818
import { updateGitCacheFromSnapshot } from "@features/git-interaction/utils/updateGitCache";
1919
import { trpc, trpcClient } from "@renderer/trpc";
20-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
2120
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
21+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
2222
import { useQueryClient } from "@tanstack/react-query";
2323
import { track } from "@utils/analytics";
2424
import { logger } from "@utils/logger";

apps/code/src/renderer/features/inbox/components/InboxSignalsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ import {
3434
Select,
3535
Text,
3636
} from "@radix-ui/themes";
37-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
3837
import type {
3938
SignalReportArtefactsResponse,
4039
SignalReportsQueryParams,
4140
} from "@shared/types";
41+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
4242
import { useNavigationStore } from "@stores/navigationStore";
4343
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4444
import { toast } from "sonner";

apps/code/src/renderer/features/onboarding/components/BillingStep.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ import {
88
Check,
99
WarningCircle,
1010
} from "@phosphor-icons/react";
11-
import { Badge, Button, Callout, Dialog, Flex, Spinner, Text } from "@radix-ui/themes";
11+
import {
12+
Badge,
13+
Button,
14+
Callout,
15+
Dialog,
16+
Flex,
17+
Spinner,
18+
Text,
19+
} from "@radix-ui/themes";
1220
import phWordmark from "@renderer/assets/images/wordmark.svg";
1321
import { useEffect, useState } from "react";
1422

@@ -198,7 +206,10 @@ export function BillingStep({ onNext, onBack }: BillingStepProps) {
198206
</Button>
199207
</Flex>
200208

201-
<Dialog.Root open={showUpgradeDialog} onOpenChange={setShowUpgradeDialog}>
209+
<Dialog.Root
210+
open={showUpgradeDialog}
211+
onOpenChange={setShowUpgradeDialog}
212+
>
202213
<Dialog.Content maxWidth="420px" size="2">
203214
<Dialog.Title size="3">Upgrade to Pro</Dialog.Title>
204215
<Dialog.Description size="2" color="gray">
@@ -207,11 +218,19 @@ export function BillingStep({ onNext, onBack }: BillingStepProps) {
207218
</Dialog.Description>
208219
<Flex direction="column" gap="2" mt="3">
209220
<Flex align="center" gap="2">
210-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
221+
<Check
222+
size={14}
223+
weight="bold"
224+
style={{ color: "var(--accent-9)" }}
225+
/>
211226
<Text size="2">Unlimited token usage</Text>
212227
</Flex>
213228
<Flex align="center" gap="2">
214-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
229+
<Check
230+
size={14}
231+
weight="bold"
232+
style={{ color: "var(--accent-9)" }}
233+
/>
215234
<Text size="2">Local and cloud execution</Text>
216235
</Flex>
217236
</Flex>

apps/code/src/renderer/features/sessions/service/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { DEFAULT_GATEWAY_MODEL } from "@posthog/agent/gateway-models";
2929
import { getIsOnline } from "@renderer/stores/connectivityStore";
3030
import { trpcClient } from "@renderer/trpc/client";
3131
import { toast } from "@renderer/utils/toast";
32-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
3332
import {
3433
type CloudTaskUpdatePayload,
3534
type EffortLevel,
@@ -40,6 +39,7 @@ import {
4039
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
4140
import type { AcpMessage, StoredLogEntry } from "@shared/types/session-events";
4241
import { isJsonRpcRequest } from "@shared/types/session-events";
42+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
4343
import { buildPermissionToolMetadata, track } from "@utils/analytics";
4444
import { logger } from "@utils/logger";
4545
import {

apps/code/src/renderer/features/settings/components/sections/GeneralSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import {
2020
TextField,
2121
} from "@radix-ui/themes";
2222
import { useTRPC } from "@renderer/trpc";
23-
import { getPostHogUrl } from "@shared/utils/urls";
2423
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
2524
import { useSettingsStore as useTerminalSettingsStore } from "@stores/settingsStore";
2625
import type { ThemePreference } from "@stores/themeStore";
2726
import { useThemeStore } from "@stores/themeStore";
2827
import { useMutation, useQuery } from "@tanstack/react-query";
2928
import { track } from "@utils/analytics";
3029
import { playCompletionSound } from "@utils/sounds";
30+
import { getPostHogUrl } from "@utils/urls";
3131
import { useCallback, useEffect, useRef, useState } from "react";
3232
import { toast } from "sonner";
3333

apps/code/src/renderer/features/settings/components/sections/PlanUsageSettings.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {
1515
Spinner,
1616
Text,
1717
} from "@radix-ui/themes";
18+
import { getPostHogUrl } from "@utils/urls";
1819
import { useState } from "react";
19-
import { getPostHogUrl } from "@shared/utils/urls";
2020

2121
export function PlanUsageSettings() {
2222
const {
@@ -294,11 +294,19 @@ export function PlanUsageSettings() {
294294
</Dialog.Description>
295295
<Flex direction="column" gap="2" mt="3">
296296
<Flex align="center" gap="2">
297-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
297+
<Check
298+
size={14}
299+
weight="bold"
300+
style={{ color: "var(--accent-9)" }}
301+
/>
298302
<Text size="2">Unlimited token usage</Text>
299303
</Flex>
300304
<Flex align="center" gap="2">
301-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
305+
<Check
306+
size={14}
307+
weight="bold"
308+
style={{ color: "var(--accent-9)" }}
309+
/>
302310
<Text size="2">Local and cloud execution</Text>
303311
</Flex>
304312
</Flex>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { useAuthStore } from "@features/auth/stores/authStore";
2+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
3+
4+
export function getPostHogUrl(path: string): string {
5+
const region = useAuthStore.getState().cloudRegion;
6+
const base = region ? getCloudUrlFromRegion(region) : "http://localhost:8010";
7+
return `${base}${path.startsWith("/") ? path : `/${path}`}`;
8+
}

0 commit comments

Comments
 (0)