Skip to content

Commit bfb9291

Browse files
committed
Move getPostHogUrl to renderer utils to fix typecheck
1 parent 66965eb commit bfb9291

9 files changed

Lines changed: 46 additions & 25 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Callout, Flex, Spinner, Text, Theme } from "@radix-ui/themes";
99
import codeLogo from "@renderer/assets/images/code.svg";
1010
import logomark from "@renderer/assets/images/logomark.svg";
1111
import { trpcClient } from "@renderer/trpc/client";
12-
import { REGION_LABELS } from "@shared/types/regions";
1312
import type { CloudRegion } from "@shared/types/regions";
1413
import { RegionSelect } from "./RegionSelect";
1514

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/inbox/components/InboxSignalsTab.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,15 @@ import {
5454
Text,
5555
Tooltip,
5656
} from "@radix-ui/themes";
57-
<<<<<<< HEAD
5857
import explorerHog from "@renderer/assets/images/explorer-hog.png";
5958
import graphsHog from "@renderer/assets/images/graphs-hog.png";
6059
import mailHog from "@renderer/assets/images/mail-hog.png";
61-
import { getCloudUrlFromRegion } from "@shared/constants/oauth";
62-
=======
63-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
64-
>>>>>>> ed81b3be (Move getCloudUrlFromRegion to shared/utils/urls)
6560
import type {
6661
SignalReportArtefact,
6762
SignalReportsQueryParams,
6863
SuggestedReviewersArtefact,
6964
} from "@shared/types";
65+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
7066
import { useNavigationStore } from "@stores/navigationStore";
7167
import { useRendererWindowFocusStore } from "@stores/rendererWindowFocusStore";
7268
import { useCallback, useEffect, useMemo, useRef, useState } from "react";

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 codeLogo from "@renderer/assets/images/code.svg";
1321
import { useEffect, useState } from "react";
1422

@@ -200,7 +208,10 @@ export function BillingStep({ onNext, onBack }: BillingStepProps) {
200208
</Flex>
201209
</Flex>
202210

203-
<Dialog.Root open={showUpgradeDialog} onOpenChange={setShowUpgradeDialog}>
211+
<Dialog.Root
212+
open={showUpgradeDialog}
213+
onOpenChange={setShowUpgradeDialog}
214+
>
204215
<Dialog.Content maxWidth="420px" size="2">
205216
<Dialog.Title size="3">Upgrade to Pro</Dialog.Title>
206217
<Dialog.Description size="2" color="gray">
@@ -209,11 +220,19 @@ export function BillingStep({ onNext, onBack }: BillingStepProps) {
209220
</Dialog.Description>
210221
<Flex direction="column" gap="2" mt="3">
211222
<Flex align="center" gap="2">
212-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
223+
<Check
224+
size={14}
225+
weight="bold"
226+
style={{ color: "var(--accent-9)" }}
227+
/>
213228
<Text size="2">Unlimited token usage</Text>
214229
</Flex>
215230
<Flex align="center" gap="2">
216-
<Check size={14} weight="bold" style={{ color: "var(--accent-9)" }} />
231+
<Check
232+
size={14}
233+
weight="bold"
234+
style={{ color: "var(--accent-9)" }}
235+
/>
217236
<Text size="2">Local and cloud execution</Text>
218237
</Flex>
219238
</Flex>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { DEFAULT_GATEWAY_MODEL } from "@posthog/agent/gateway-models";
3030
import { getIsOnline } from "@renderer/stores/connectivityStore";
3131
import { trpcClient } from "@renderer/trpc/client";
3232
import { toast } from "@renderer/utils/toast";
33-
import { getCloudUrlFromRegion } from "@shared/utils/urls";
3433
import {
3534
type CloudTaskUpdatePayload,
3635
type EffortLevel,
@@ -41,6 +40,7 @@ import {
4140
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
4241
import type { AcpMessage, StoredLogEntry } from "@shared/types/session-events";
4342
import { isJsonRpcRequest } from "@shared/types/session-events";
43+
import { getCloudUrlFromRegion } from "@shared/utils/urls";
4444
import { buildPermissionToolMetadata, track } from "@utils/analytics";
4545
import { logger } from "@utils/logger";
4646
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
@@ -19,13 +19,13 @@ import {
1919
Text,
2020
} from "@radix-ui/themes";
2121
import { useTRPC } from "@renderer/trpc";
22-
import { getPostHogUrl } from "@shared/utils/urls";
2322
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
2423
import type { ThemePreference } from "@stores/themeStore";
2524
import { useThemeStore } from "@stores/themeStore";
2625
import { useMutation, useQuery } from "@tanstack/react-query";
2726
import { track } from "@utils/analytics";
2827
import { playCompletionSound } from "@utils/sounds";
28+
import { getPostHogUrl } from "@utils/urls";
2929
import { useCallback, useEffect } from "react";
3030
import { toast } from "sonner";
3131

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+
}

apps/code/src/shared/utils/urls.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useAuthStore } from "@features/auth/stores/authStore";
21
import type { CloudRegion } from "@shared/types/regions";
32

43
export function getCloudUrlFromRegion(region: CloudRegion): string {
@@ -11,11 +10,3 @@ export function getCloudUrlFromRegion(region: CloudRegion): string {
1110
return "http://localhost:8010";
1211
}
1312
}
14-
15-
export function getPostHogUrl(path: string): string {
16-
const region = useAuthStore.getState().cloudRegion;
17-
const base = region
18-
? getCloudUrlFromRegion(region)
19-
: "http://localhost:8010";
20-
return `${base}${path.startsWith("/") ? path : `/${path}`}`;
21-
}

0 commit comments

Comments
 (0)