Skip to content

Commit 15a4b12

Browse files
committed
Move CloudRegion and REGION_LABELS to shared/types/regions
1 parent c609536 commit 15a4b12

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
@@ -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/constants/oauth";
9-
import type { CloudRegion } from "@shared/types/oauth";
8+
import { REGION_LABELS } from "@shared/types/regions";
9+
import type { CloudRegion } 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/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
@@ -8,7 +8,7 @@ import {
88
} from "@shared/constants/oauth";
99
import { getCloudUrlFromRegion } from "@shared/utils/urls";
1010
import { ANALYTICS_EVENTS } from "@shared/types/analytics";
11-
import type { CloudRegion } from "@shared/types/oauth";
11+
import type { CloudRegion } from "@shared/types/regions";
1212
import { sleepWithBackoff } from "@shared/utils/backoff";
1313
import { useNavigationStore } from "@stores/navigationStore";
1414
import {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useAuthStore } from "@features/auth/stores/authStore";
22
import { useSeat } from "@hooks/useSeat";
33
import { SignOut } from "@phosphor-icons/react";
44
import { Avatar, Badge, Button, Flex, Spinner, Text } from "@radix-ui/themes";
5-
import { REGION_LABELS } from "@shared/constants/oauth";
5+
import { REGION_LABELS } from "@shared/types/regions";
66
import { useQuery } from "@tanstack/react-query";
77

88
export function AccountSettings() {

โ€Ž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)