Skip to content

Commit d137d35

Browse files
committed
Move CloudRegion and REGION_LABELS to shared/types/regions
1 parent 13ca970 commit d137d35

8 files changed

Lines changed: 14 additions & 14 deletions

File tree

โ€Žapps/code/src/renderer/features/auth/components/AuthScreen.tsxโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ 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/constants/oauth";
13-
import type { CloudRegion } from "@shared/types/oauth";
12+
import { REGION_LABELS } from "@shared/types/regions";
13+
import type { CloudRegion } from "@shared/types/regions";
1414
import { RegionSelect } from "./RegionSelect";
1515

1616
export const getErrorMessage = (error: unknown) => {

โ€Žapps/code/src/renderer/features/auth/components/RegionSelect.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Flex, Select, Text } from "@radix-ui/themes";
22
import { IS_DEV } from "@shared/constants/environment";
3-
import type { CloudRegion } from "@shared/types/oauth";
3+
import type { CloudRegion } from "@shared/types/regions";
44
import { useState } from "react";
55

66
interface RegionSelectProps {

โ€Žapps/code/src/renderer/features/auth/stores/authStore.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PostHogAPIClient } from "@renderer/api/posthogClient";
33
import { trpcClient } from "@renderer/trpc/client";
44
import { getCloudUrlFromRegion } from "@shared/utils/urls";
55
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
6-
import type { CloudRegion } from "@shared/types/oauth";
6+
import type { CloudRegion } from "@shared/types/regions";
77
import { useNavigationStore } from "@stores/navigationStore";
88
import { identifyUser, resetUser, track } from "@utils/analytics";
99
import { logger } from "@utils/logger";

โ€Žapps/code/src/renderer/features/settings/components/sections/AccountSettings.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { useSeat } from "@hooks/useSeat";
88
import { SignOut } from "@phosphor-icons/react";
99
import { Avatar, Badge, Button, Flex, Spinner, Text } from "@radix-ui/themes";
10-
import { REGION_LABELS } from "@shared/constants/oauth";
10+
import { REGION_LABELS } from "@shared/types/regions";
1111

1212
export function AccountSettings() {
1313
const isAuthenticated = useAuthStateValue(

โ€Žapps/code/src/shared/constants/oauth.tsโ€Ž

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CloudRegion } from "../types/oauth";
1+
import type { CloudRegion } from "@shared/types/regions";
22

33
export const POSTHOG_US_CLIENT_ID = "HCWoE0aRFMYxIxFNTTwkOORn5LBjOt2GVDzwSw5W";
44
export const POSTHOG_EU_CLIENT_ID = "AIvijgMS0dxKEmr5z6odvRd8Pkh5vts3nPTzgzU9";
@@ -43,12 +43,6 @@ export const OAUTH_SCOPES = [
4343

4444
export const OAUTH_SCOPE_VERSION = 3;
4545

46-
export const REGION_LABELS: Record<CloudRegion, string> = {
47-
us: "๐Ÿ‡บ๐Ÿ‡ธ US Cloud",
48-
eu: "๐Ÿ‡ช๐Ÿ‡บ EU Cloud",
49-
dev: "๐Ÿ› ๏ธ Development",
50-
};
51-
5246
// Token refresh settings
5347
export const TOKEN_REFRESH_BUFFER_MS = 30 * 60 * 1000; // 30 minutes before expiry
5448
export const TOKEN_REFRESH_FORCE_MS = 60 * 1000; // Force refresh when <1 min to expiry, even with active sessions

โ€Žapps/code/src/shared/types/oauth.tsโ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export type CloudRegion = "us" | "eu" | "dev";
2+
3+
export const REGION_LABELS: Record<CloudRegion, string> = {
4+
us: "๐Ÿ‡บ๐Ÿ‡ธ US Cloud",
5+
eu: "๐Ÿ‡ช๐Ÿ‡บ EU Cloud",
6+
dev: "๐Ÿ› ๏ธ Development",
7+
};

โ€Žapps/code/src/shared/utils/urls.tsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useAuthStore } from "@features/auth/stores/authStore";
2-
import type { CloudRegion } from "@shared/types/oauth";
2+
import type { CloudRegion } from "@shared/types/regions";
33

44
export function getCloudUrlFromRegion(region: CloudRegion): string {
55
switch (region) {

0 commit comments

Comments
ย (0)