From 22799d1c3ca298f4b2ed0e4e657cb0112d233a76 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Mon, 7 Mar 2022 20:52:10 -0800 Subject: [PATCH] Rename access.ts to envs/constants.ts --- common/{access.ts => envs/constants.ts} | 6 +++--- common/util/format.ts | 2 +- functions/src/create-user.ts | 2 +- functions/src/emails.ts | 2 +- web/components/feed-create.tsx | 2 +- web/components/manifold-logo.tsx | 2 +- web/components/profile-menu.tsx | 2 +- web/hooks/use-admin.ts | 2 +- web/hooks/use-propz.ts | 2 +- web/lib/firebase/init.ts | 2 +- web/lib/service/stripe.ts | 2 +- web/pages/404.tsx | 2 +- web/pages/_document.tsx | 2 +- web/pages/analytics.tsx | 2 +- web/pages/home.tsx | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) rename common/{access.ts => envs/constants.ts} (84%) diff --git a/common/access.ts b/common/envs/constants.ts similarity index 84% rename from common/access.ts rename to common/envs/constants.ts index c0b67094..b87948a7 100644 --- a/common/access.ts +++ b/common/envs/constants.ts @@ -1,6 +1,6 @@ -import { DEV_CONFIG } from './envs/dev' -import { EnvConfig, PROD_CONFIG } from './envs/prod' -import { THEOREMONE_CONFIG } from './envs/theoremone' +import { DEV_CONFIG } from './dev' +import { EnvConfig, PROD_CONFIG } from './prod' +import { THEOREMONE_CONFIG } from './theoremone' const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD' diff --git a/common/util/format.ts b/common/util/format.ts index 5a9a3208..a8e6f58a 100644 --- a/common/util/format.ts +++ b/common/util/format.ts @@ -1,4 +1,4 @@ -import { ENV_CONFIG } from '../access' +import { ENV_CONFIG } from '../envs/constants' const formatter = new Intl.NumberFormat('en-US', { style: 'currency', diff --git a/functions/src/create-user.ts b/functions/src/create-user.ts index f583abe4..f73b868b 100644 --- a/functions/src/create-user.ts +++ b/functions/src/create-user.ts @@ -14,7 +14,7 @@ import { cleanUsername, } from '../../common/util/clean-username' import { sendWelcomeEmail } from './emails' -import { isWhitelisted } from '../../common/access' +import { isWhitelisted } from '../../common/envs/constants' export const createUser = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/emails.ts b/functions/src/emails.ts index 1fdb6f73..3d37ba2b 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -1,5 +1,5 @@ import _ = require('lodash') -import { DOMAIN, PROJECT_ID } from '../../common/access' +import { DOMAIN, PROJECT_ID } from '../../common/envs/constants' import { Answer } from '../../common/answer' import { Bet } from '../../common/bet' import { getProbability } from '../../common/calculate' diff --git a/web/components/feed-create.tsx b/web/components/feed-create.tsx index 90b99837..00bbc31f 100644 --- a/web/components/feed-create.tsx +++ b/web/components/feed-create.tsx @@ -9,7 +9,7 @@ import { Contract } from '../../common/contract' import { Col } from './layout/col' import clsx from 'clsx' import { Row } from './layout/row' -import { ENV_CONFIG } from '../../common/access' +import { ENV_CONFIG } from '../../common/envs/constants' export function FeedPromo(props: { hotContracts: Contract[] }) { const { hotContracts } = props diff --git a/web/components/manifold-logo.tsx b/web/components/manifold-logo.tsx index 8654e269..26344bf3 100644 --- a/web/components/manifold-logo.tsx +++ b/web/components/manifold-logo.tsx @@ -2,7 +2,7 @@ import Link from 'next/link' import clsx from 'clsx' import { useUser } from '../hooks/use-user' -import { ENV_CONFIG } from '../../common/access' +import { ENV_CONFIG } from '../../common/envs/constants' export function ManifoldLogo(props: { className?: string diff --git a/web/components/profile-menu.tsx b/web/components/profile-menu.tsx index bfc69fdb..a01614b1 100644 --- a/web/components/profile-menu.tsx +++ b/web/components/profile-menu.tsx @@ -3,7 +3,7 @@ import { formatMoney } from '../../common/util/format' import { Avatar } from './avatar' import { Col } from './layout/col' import { MenuButton } from './menu' -import { IS_PRIVATE_MANIFOLD } from '../../common/access' +import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' export function ProfileMenu(props: { user: User | undefined }) { const { user } = props diff --git a/web/hooks/use-admin.ts b/web/hooks/use-admin.ts index bbeaf59c..7c8b8449 100644 --- a/web/hooks/use-admin.ts +++ b/web/hooks/use-admin.ts @@ -1,4 +1,4 @@ -import { isAdmin } from '../../common/access' +import { isAdmin } from '../../common/envs/constants' import { usePrivateUser, useUser } from './use-user' export const useAdmin = () => { diff --git a/web/hooks/use-propz.ts b/web/hooks/use-propz.ts index bf4046d3..16315929 100644 --- a/web/hooks/use-propz.ts +++ b/web/hooks/use-propz.ts @@ -1,7 +1,7 @@ import _ from 'lodash' import { useRouter } from 'next/router' import { useState, useEffect } from 'react' -import { IS_PRIVATE_MANIFOLD } from '../../common/access' +import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' type PropzProps = { params: any diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index aec2a4c0..b11ad355 100644 --- a/web/lib/firebase/init.ts +++ b/web/lib/firebase/init.ts @@ -1,6 +1,6 @@ import { getFirestore } from '@firebase/firestore' import { initializeApp, getApps, getApp } from 'firebase/app' -import { FIREBASE_CONFIG } from '../../../common/access' +import { FIREBASE_CONFIG } from '../../../common/envs/constants' // Initialize Firebase export const app = getApps().length ? getApp() : initializeApp(FIREBASE_CONFIG) diff --git a/web/lib/service/stripe.ts b/web/lib/service/stripe.ts index 84c07d07..6c093483 100644 --- a/web/lib/service/stripe.ts +++ b/web/lib/service/stripe.ts @@ -1,4 +1,4 @@ -import { PROJECT_ID } from '../../../common/access' +import { PROJECT_ID } from '../../../common/envs/constants' export const checkoutURL = ( userId: string, diff --git a/web/pages/404.tsx b/web/pages/404.tsx index d3f10c83..f710263d 100644 --- a/web/pages/404.tsx +++ b/web/pages/404.tsx @@ -1,4 +1,4 @@ -import { IS_PRIVATE_MANIFOLD } from '../../common/access' +import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' import { Page } from '../components/page' import { Title } from '../components/title' diff --git a/web/pages/_document.tsx b/web/pages/_document.tsx index 5cae7052..18329b12 100644 --- a/web/pages/_document.tsx +++ b/web/pages/_document.tsx @@ -1,5 +1,5 @@ import { Html, Head, Main, NextScript } from 'next/document' -import { ENV_CONFIG } from '../../common/access' +import { ENV_CONFIG } from '../../common/envs/constants' export default function Document() { return ( diff --git a/web/pages/analytics.tsx b/web/pages/analytics.tsx index 76e09c06..c2e0ac99 100644 --- a/web/pages/analytics.tsx +++ b/web/pages/analytics.tsx @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import _ from 'lodash' -import { IS_PRIVATE_MANIFOLD } from '../../common/access' +import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' import { DailyCountChart } from '../components/analytics/charts' import { Col } from '../components/layout/col' import { Spacer } from '../components/layout/spacer' diff --git a/web/pages/home.tsx b/web/pages/home.tsx index c5b6e804..8e10106f 100644 --- a/web/pages/home.tsx +++ b/web/pages/home.tsx @@ -26,7 +26,7 @@ import { fromPropz, usePropz } from '../hooks/use-propz' import { useGetRecentBets, useRecentBets } from '../hooks/use-bets' import { useActiveContracts } from '../hooks/use-contracts' import { useRecentComments } from '../hooks/use-comments' -import { IS_PRIVATE_MANIFOLD } from '../../common/access' +import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz() {