diff --git a/functions/src/add-liquidity.ts b/functions/src/add-liquidity.ts index e37804d3..2f6d2446 100644 --- a/functions/src/add-liquidity.ts +++ b/functions/src/add-liquidity.ts @@ -1,11 +1,11 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { Contract } from '../../common/contract' -import { User } from '../../common/user' -import { removeUndefinedProps } from '../../common/util/object' +import { Contract } from 'common/contract' +import { User } from 'common/user' +import { removeUndefinedProps } from 'common/util/object' import { redeemShares } from './redeem-shares' -import { getNewLiquidityProvision } from '../../common/add-liquidity' +import { getNewLiquidityProvision } from 'common/add-liquidity' export const addLiquidity = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/change-user-info.ts b/functions/src/change-user-info.ts index ab15eb70..f85d45b3 100644 --- a/functions/src/change-user-info.ts +++ b/functions/src/change-user-info.ts @@ -2,12 +2,12 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import { getUser } from './utils' -import { Contract } from '../../common/contract' -import { Comment } from '../../common/comment' -import { User } from '../../common/user' -import { cleanUsername } from '../../common/util/clean-username' -import { removeUndefinedProps } from '../../common/util/object' -import { Answer } from '../../common/answer' +import { Contract } from 'common/contract' +import { Comment } from 'common/comment' +import { User } from 'common/user' +import { cleanUsername } from 'common/util/clean-username' +import { removeUndefinedProps } from 'common/util/object' +import { Answer } from 'common/answer' export const changeUserInfo = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/create-answer.ts b/functions/src/create-answer.ts index 1da8f350..55211585 100644 --- a/functions/src/create-answer.ts +++ b/functions/src/create-answer.ts @@ -1,18 +1,13 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { - Contract, - DPM, - FreeResponse, - FullContract, -} from '../../common/contract' -import { User } from '../../common/user' -import { getLoanAmount, getNewMultiBetInfo } from '../../common/new-bet' -import { Answer, MAX_ANSWER_LENGTH } from '../../common/answer' +import { Contract, DPM, FreeResponse, FullContract } from 'common/contract' +import { User } from 'common/user' +import { getLoanAmount, getNewMultiBetInfo } from 'common/new-bet' +import { Answer, MAX_ANSWER_LENGTH } from 'common/answer' import { getContract, getValues } from './utils' import { sendNewAnswerEmail } from './emails' -import { Bet } from '../../common/bet' +import { Bet } from 'common/bet' export const createAnswer = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/create-contract.ts b/functions/src/create-contract.ts index dfc8128d..5345469e 100644 --- a/functions/src/create-contract.ts +++ b/functions/src/create-contract.ts @@ -13,10 +13,10 @@ import { MAX_QUESTION_LENGTH, MAX_TAG_LENGTH, outcomeType, -} from '../../common/contract' -import { slugify } from '../../common/util/slugify' -import { randomString } from '../../common/util/random' -import { getNewContract } from '../../common/new-contract' +} from 'common/contract' +import { slugify } from 'common/util/slugify' +import { randomString } from 'common/util/random' +import { getNewContract } from 'common/new-contract' import { FIXED_ANTE, getAnteBets, @@ -24,8 +24,8 @@ import { getFreeAnswerAnte, HOUSE_LIQUIDITY_PROVIDER_ID, MINIMUM_ANTE, -} from '../../common/antes' -import { getNoneAnswer } from '../../common/answer' +} from 'common/antes' +import { getNoneAnswer } from 'common/answer' export const createContract = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/create-fold.ts b/functions/src/create-fold.ts index 36d1d269..5cf40b22 100644 --- a/functions/src/create-fold.ts +++ b/functions/src/create-fold.ts @@ -3,10 +3,10 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getUser } from './utils' -import { Contract } from '../../common/contract' -import { slugify } from '../../common/util/slugify' -import { randomString } from '../../common/util/random' -import { Fold } from '../../common/fold' +import { Contract } from 'common/contract' +import { slugify } from 'common/util/slugify' +import { randomString } from 'common/util/random' +import { Fold } from 'common/fold' export const createFold = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/create-user.ts b/functions/src/create-user.ts index f73b868b..dd2b5275 100644 --- a/functions/src/create-user.ts +++ b/functions/src/create-user.ts @@ -6,15 +6,12 @@ import { STARTING_BALANCE, SUS_STARTING_BALANCE, User, -} from '../../common/user' +} from 'common/user' import { getUser, getUserByUsername } from './utils' -import { randomString } from '../../common/util/random' -import { - cleanDisplayName, - cleanUsername, -} from '../../common/util/clean-username' +import { randomString } from 'common/util/random' +import { cleanDisplayName, cleanUsername } from 'common/util/clean-username' import { sendWelcomeEmail } from './emails' -import { isWhitelisted } from '../../common/envs/constants' +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 c3b70734..4c434bcf 100644 --- a/functions/src/emails.ts +++ b/functions/src/emails.ts @@ -1,14 +1,14 @@ import * as _ from 'lodash' -import { DOMAIN, PROJECT_ID } from '../../common/envs/constants' -import { Answer } from '../../common/answer' -import { Bet } from '../../common/bet' -import { getProbability } from '../../common/calculate' -import { Comment } from '../../common/comment' -import { Contract, FreeResponseContract } from '../../common/contract' -import { CREATOR_FEE } from '../../common/fees' -import { PrivateUser, User } from '../../common/user' -import { formatMoney, formatPercent } from '../../common/util/format' +import { DOMAIN, PROJECT_ID } from 'common/envs/constants' +import { Answer } from 'common/answer' +import { Bet } from 'common/bet' +import { getProbability } from 'common/calculate' +import { Comment } from 'common/comment' +import { Contract, FreeResponseContract } from 'common/contract' +import { CREATOR_FEE } from 'common/fees' +import { PrivateUser, User } from 'common/user' +import { formatMoney, formatPercent } from 'common/util/format' import { sendTemplateEmail, sendTextEmail } from './send-email' import { getPrivateUser, getUser } from './utils' diff --git a/functions/src/market-close-emails.ts b/functions/src/market-close-emails.ts index bb144600..3adc5b6d 100644 --- a/functions/src/market-close-emails.ts +++ b/functions/src/market-close-emails.ts @@ -1,7 +1,7 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { Contract } from '../../common/contract' +import { Contract } from 'common/contract' import { getPrivateUser, getUserByUsername } from './utils' import { sendMarketCloseEmail } from './emails' diff --git a/functions/src/on-create-bet.ts b/functions/src/on-create-bet.ts index deaa4c4a..e3cf0ece 100644 --- a/functions/src/on-create-bet.ts +++ b/functions/src/on-create-bet.ts @@ -3,7 +3,7 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getContract } from './utils' -import { Bet } from '../../common/bet' +import { Bet } from 'common/bet' const firestore = admin.firestore() diff --git a/functions/src/on-create-comment.ts b/functions/src/on-create-comment.ts index 18fc6757..654f9055 100644 --- a/functions/src/on-create-comment.ts +++ b/functions/src/on-create-comment.ts @@ -3,10 +3,10 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getContract, getUser, getValues } from './utils' -import { Comment } from '../../common/comment' +import { Comment } from 'common/comment' import { sendNewCommentEmail } from './emails' -import { Bet } from '../../common/bet' -import { Answer } from '../../common/answer' +import { Bet } from 'common/bet' +import { Answer } from 'common/answer' const firestore = admin.firestore() diff --git a/functions/src/on-view.ts b/functions/src/on-view.ts index d2f746d5..6e08ae76 100644 --- a/functions/src/on-view.ts +++ b/functions/src/on-view.ts @@ -1,6 +1,6 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { View } from '../../common/tracking' +import { View } from 'common/tracking' const firestore = admin.firestore() diff --git a/functions/src/place-bet.ts b/functions/src/place-bet.ts index 74487126..083c8bc2 100644 --- a/functions/src/place-bet.ts +++ b/functions/src/place-bet.ts @@ -1,18 +1,18 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { Contract } from '../../common/contract' -import { User } from '../../common/user' +import { Contract } from 'common/contract' +import { User } from 'common/user' import { getNewBinaryCpmmBetInfo, getNewBinaryDpmBetInfo, getNewMultiBetInfo, getLoanAmount, -} from '../../common/new-bet' -import { addObjects, removeUndefinedProps } from '../../common/util/object' -import { Bet } from '../../common/bet' +} from 'common/new-bet' +import { addObjects, removeUndefinedProps } from 'common/util/object' +import { Bet } from 'common/bet' import { redeemShares } from './redeem-shares' -import { Fees } from '../../common/fees' +import { Fees } from 'common/fees' export const placeBet = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/redeem-shares.ts b/functions/src/redeem-shares.ts index 08d87a8b..a43aa509 100644 --- a/functions/src/redeem-shares.ts +++ b/functions/src/redeem-shares.ts @@ -1,12 +1,12 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' -import { Bet } from '../../common/bet' -import { getProbability } from '../../common/calculate' +import { Bet } from 'common/bet' +import { getProbability } from 'common/calculate' -import { Binary, CPMM, FullContract } from '../../common/contract' -import { noFees } from '../../common/fees' -import { User } from '../../common/user' +import { Binary, CPMM, FullContract } from 'common/contract' +import { noFees } from 'common/fees' +import { User } from 'common/user' export const redeemShares = async (userId: string, contractId: string) => { return await firestore.runTransaction(async (transaction) => { diff --git a/functions/src/resolve-market.ts b/functions/src/resolve-market.ts index 5a2edec2..5ee82ff5 100644 --- a/functions/src/resolve-market.ts +++ b/functions/src/resolve-market.ts @@ -2,14 +2,14 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import * as _ from 'lodash' -import { Contract } from '../../common/contract' -import { User } from '../../common/user' -import { Bet } from '../../common/bet' +import { Contract } from 'common/contract' +import { User } from 'common/user' +import { Bet } from 'common/bet' import { getUser, isProd, payUser } from './utils' import { sendMarketResolutionEmail } from './emails' -import { getLoanPayouts, getPayouts } from '../../common/payouts' -import { removeUndefinedProps } from '../../common/util/object' -import { LiquidityProvision } from '../../common/liquidity-provision' +import { getLoanPayouts, getPayouts } from 'common/payouts' +import { removeUndefinedProps } from 'common/util/object' +import { LiquidityProvision } from 'common/liquidity-provision' export const resolveMarket = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/scripts/cache-views.ts b/functions/src/scripts/cache-views.ts index c7145a1e..c7ed661f 100644 --- a/functions/src/scripts/cache-views.ts +++ b/functions/src/scripts/cache-views.ts @@ -5,9 +5,9 @@ import { initAdmin } from './script-init' initAdmin() import { getValues } from '../utils' -import { View } from '../../../common/tracking' -import { User } from '../../../common/user' -import { batchedWaitAll } from '../../../common/util/promise' +import { View } from 'common/tracking' +import { User } from 'common/user' +import { batchedWaitAll } from 'common/util/promise' const firestore = admin.firestore() diff --git a/functions/src/scripts/correct-bet-probability.ts b/functions/src/scripts/correct-bet-probability.ts index 3b57dbeb..e65b4ddf 100644 --- a/functions/src/scripts/correct-bet-probability.ts +++ b/functions/src/scripts/correct-bet-probability.ts @@ -4,9 +4,9 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { getDpmProbability } from '../../../common/calculate-dpm' -import { Binary, Contract, DPM, FullContract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { getDpmProbability } from 'common/calculate-dpm' +import { Binary, Contract, DPM, FullContract } from 'common/contract' type DocRef = admin.firestore.DocumentReference const firestore = admin.firestore() diff --git a/functions/src/scripts/create-private-users.ts b/functions/src/scripts/create-private-users.ts index 8051a447..a83bb53e 100644 --- a/functions/src/scripts/create-private-users.ts +++ b/functions/src/scripts/create-private-users.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { PrivateUser, STARTING_BALANCE, User } from '../../../common/user' +import { PrivateUser, STARTING_BALANCE, User } from 'common/user' const firestore = admin.firestore() diff --git a/functions/src/scripts/get-json-dump.ts b/functions/src/scripts/get-json-dump.ts index b9909132..3027ce45 100644 --- a/functions/src/scripts/get-json-dump.ts +++ b/functions/src/scripts/get-json-dump.ts @@ -5,10 +5,10 @@ import * as fs from 'fs' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' import { getValues } from '../utils' -import { Comment } from '../../../common/comment' +import { Comment } from 'common/comment' const firestore = admin.firestore() diff --git a/functions/src/scripts/lowercase-fold-tags.ts b/functions/src/scripts/lowercase-fold-tags.ts index 80b79a33..f5d01bfe 100644 --- a/functions/src/scripts/lowercase-fold-tags.ts +++ b/functions/src/scripts/lowercase-fold-tags.ts @@ -5,7 +5,7 @@ import { initAdmin } from './script-init' initAdmin() import { getValues } from '../utils' -import { Fold } from '../../../common/fold' +import { Fold } from 'common/fold' async function lowercaseFoldTags() { const firestore = admin.firestore() diff --git a/functions/src/scripts/make-contracts-public.ts b/functions/src/scripts/make-contracts-public.ts index 19d2e196..5d958f13 100644 --- a/functions/src/scripts/make-contracts-public.ts +++ b/functions/src/scripts/make-contracts-public.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Contract } from '../../../common/contract' +import { Contract } from 'common/contract' const firestore = admin.firestore() diff --git a/functions/src/scripts/migrate-contract.ts b/functions/src/scripts/migrate-contract.ts index 718cf62e..7127f371 100644 --- a/functions/src/scripts/migrate-contract.ts +++ b/functions/src/scripts/migrate-contract.ts @@ -4,8 +4,8 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/migrate-to-cfmm.ts b/functions/src/scripts/migrate-to-cfmm.ts index 874011ca..9dd8c63e 100644 --- a/functions/src/scripts/migrate-to-cfmm.ts +++ b/functions/src/scripts/migrate-to-cfmm.ts @@ -4,22 +4,13 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { - Binary, - Contract, - CPMM, - DPM, - FullContract, -} from '../../../common/contract' -import { Bet } from '../../../common/bet' -import { - calculateDpmPayout, - getDpmProbability, -} from '../../../common/calculate-dpm' -import { User } from '../../../common/user' -import { getCpmmInitialLiquidity } from '../../../common/antes' -import { noFees } from '../../../common/fees' -import { addObjects } from '../../../common/util/object' +import { Binary, Contract, CPMM, DPM, FullContract } from 'common/contract' +import { Bet } from 'common/bet' +import { calculateDpmPayout, getDpmProbability } from 'common/calculate-dpm' +import { User } from 'common/user' +import { getCpmmInitialLiquidity } from 'common/antes' +import { noFees } from 'common/fees' +import { addObjects } from 'common/util/object' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/migrate-to-dpm-2.ts b/functions/src/scripts/migrate-to-dpm-2.ts index 2c6f066f..81e99d98 100644 --- a/functions/src/scripts/migrate-to-dpm-2.ts +++ b/functions/src/scripts/migrate-to-dpm-2.ts @@ -4,14 +4,11 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Binary, Contract, DPM, FullContract } from '../../../common/contract' -import { Bet } from '../../../common/bet' -import { - calculateDpmShares, - getDpmProbability, -} from '../../../common/calculate-dpm' -import { getSellBetInfo } from '../../../common/sell-bet' -import { User } from '../../../common/user' +import { Binary, Contract, DPM, FullContract } from 'common/contract' +import { Bet } from 'common/bet' +import { calculateDpmShares, getDpmProbability } from 'common/calculate-dpm' +import { getSellBetInfo } from 'common/sell-bet' +import { User } from 'common/user' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/pay-out-contract-again.ts b/functions/src/scripts/pay-out-contract-again.ts index 7672bf7b..0e56429f 100644 --- a/functions/src/scripts/pay-out-contract-again.ts +++ b/functions/src/scripts/pay-out-contract-again.ts @@ -4,10 +4,10 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' -import { getLoanPayouts, getPayouts } from '../../../common/payouts' -import { filterDefined } from '../../../common/util/array' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' +import { getLoanPayouts, getPayouts } from 'common/payouts' +import { filterDefined } from 'common/util/array' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/recalculate-contract-totals.ts b/functions/src/scripts/recalculate-contract-totals.ts index 39942542..91165781 100644 --- a/functions/src/scripts/recalculate-contract-totals.ts +++ b/functions/src/scripts/recalculate-contract-totals.ts @@ -4,8 +4,8 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' type DocRef = admin.firestore.DocumentReference diff --git a/functions/src/scripts/remove-answer-ante.ts b/functions/src/scripts/remove-answer-ante.ts index eb49af6c..8b026174 100644 --- a/functions/src/scripts/remove-answer-ante.ts +++ b/functions/src/scripts/remove-answer-ante.ts @@ -4,8 +4,8 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' import { getValues } from '../utils' async function removeAnswerAnte() { diff --git a/functions/src/scripts/rename-user-contracts.ts b/functions/src/scripts/rename-user-contracts.ts index 9b0f569b..bcb4fea6 100644 --- a/functions/src/scripts/rename-user-contracts.ts +++ b/functions/src/scripts/rename-user-contracts.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Contract } from '../../../common/contract' +import { Contract } from 'common/contract' import { getValues } from '../utils' const firestore = admin.firestore() diff --git a/functions/src/scripts/update-contract-tags.ts b/functions/src/scripts/update-contract-tags.ts index 1dda5615..7e671c9f 100644 --- a/functions/src/scripts/update-contract-tags.ts +++ b/functions/src/scripts/update-contract-tags.ts @@ -4,8 +4,8 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Contract } from '../../../common/contract' -import { parseTags } from '../../../common/util/parse' +import { Contract } from 'common/contract' +import { parseTags } from 'common/util/parse' import { getValues } from '../utils' async function updateContractTags() { diff --git a/functions/src/scripts/update-feed.ts b/functions/src/scripts/update-feed.ts index 25a0b14f..f98631dd 100644 --- a/functions/src/scripts/update-feed.ts +++ b/functions/src/scripts/update-feed.ts @@ -5,9 +5,9 @@ import { initAdmin } from './script-init' initAdmin() import { getValues } from '../utils' -import { User } from '../../../common/user' -import { batchedWaitAll } from '../../../common/util/promise' -import { Contract } from '../../../common/contract' +import { User } from 'common/user' +import { batchedWaitAll } from 'common/util/promise' +import { Contract } from 'common/contract' import { updateWordScores } from '../update-recommendations' import { getFeedContracts, doUserFeedUpdate } from '../update-feed' diff --git a/functions/src/scripts/update-last-comment-time.ts b/functions/src/scripts/update-last-comment-time.ts index ae950fbe..99d7f52d 100644 --- a/functions/src/scripts/update-last-comment-time.ts +++ b/functions/src/scripts/update-last-comment-time.ts @@ -4,9 +4,9 @@ import * as _ from 'lodash' import { initAdmin } from './script-init' initAdmin() -import { Contract } from '../../../common/contract' +import { Contract } from 'common/contract' import { getValues } from '../utils' -import { Comment } from '../../../common/comment' +import { Comment } from 'common/comment' async function updateLastCommentTime() { const firestore = admin.firestore() diff --git a/functions/src/sell-bet.ts b/functions/src/sell-bet.ts index fff88716..c685498b 100644 --- a/functions/src/sell-bet.ts +++ b/functions/src/sell-bet.ts @@ -1,12 +1,12 @@ import * as admin from 'firebase-admin' import * as functions from 'firebase-functions' -import { Contract } from '../../common/contract' -import { User } from '../../common/user' -import { Bet } from '../../common/bet' -import { getSellBetInfo } from '../../common/sell-bet' -import { addObjects, removeUndefinedProps } from '../../common/util/object' -import { Fees } from '../../common/fees' +import { Contract } from 'common/contract' +import { User } from 'common/user' +import { Bet } from 'common/bet' +import { getSellBetInfo } from 'common/sell-bet' +import { addObjects, removeUndefinedProps } from 'common/util/object' +import { Fees } from 'common/fees' export const sellBet = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/sell-shares.ts b/functions/src/sell-shares.ts index e4dbcbc9..158a5f6a 100644 --- a/functions/src/sell-shares.ts +++ b/functions/src/sell-shares.ts @@ -2,12 +2,12 @@ import * as _ from 'lodash' import * as admin from 'firebase-admin' import * as functions from 'firebase-functions' -import { Binary, CPMM, FullContract } from '../../common/contract' -import { User } from '../../common/user' -import { getCpmmSellBetInfo } from '../../common/sell-bet' -import { addObjects, removeUndefinedProps } from '../../common/util/object' +import { Binary, CPMM, FullContract } from 'common/contract' +import { User } from 'common/user' +import { getCpmmSellBetInfo } from 'common/sell-bet' +import { addObjects, removeUndefinedProps } from 'common/util/object' import { getValues } from './utils' -import { Bet } from '../../common/bet' +import { Bet } from 'common/bet' export const sellShares = functions.runWith({ minInstances: 1 }).https.onCall( async ( diff --git a/functions/src/transact.ts b/functions/src/transact.ts index 79b5ccb8..77323638 100644 --- a/functions/src/transact.ts +++ b/functions/src/transact.ts @@ -1,9 +1,9 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' -import { User } from '../../common/user' -import { Txn } from '../../common/txn' -import { removeUndefinedProps } from '../../common/util/object' +import { User } from 'common/user' +import { Txn } from 'common/txn' +import { removeUndefinedProps } from 'common/util/object' export const transact = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/unsubscribe.ts b/functions/src/unsubscribe.ts index c6edee92..7c9442d7 100644 --- a/functions/src/unsubscribe.ts +++ b/functions/src/unsubscribe.ts @@ -2,7 +2,7 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getUser } from './utils' -import { PrivateUser } from '../../common/user' +import { PrivateUser } from 'common/user' export const unsubscribe = functions .runWith({ minInstances: 1 }) diff --git a/functions/src/update-contract-metrics.ts b/functions/src/update-contract-metrics.ts index c3801df6..9214d2dc 100644 --- a/functions/src/update-contract-metrics.ts +++ b/functions/src/update-contract-metrics.ts @@ -3,9 +3,9 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getValues } from './utils' -import { Contract } from '../../common/contract' -import { Bet } from '../../common/bet' -import { batchedWaitAll } from '../../common/util/promise' +import { Contract } from 'common/contract' +import { Bet } from 'common/bet' +import { batchedWaitAll } from 'common/util/promise' const firestore = admin.firestore() diff --git a/functions/src/update-feed.ts b/functions/src/update-feed.ts index accd48e8..3bfa7949 100644 --- a/functions/src/update-feed.ts +++ b/functions/src/update-feed.ts @@ -3,21 +3,21 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import { getValue, getValues } from './utils' -import { Contract } from '../../common/contract' -import { logInterpolation } from '../../common/util/math' -import { DAY_MS } from '../../common/util/time' +import { Contract } from 'common/contract' +import { logInterpolation } from 'common/util/math' +import { DAY_MS } from 'common/util/time' import { getProbability, getOutcomeProbability, getTopAnswer, -} from '../../common/calculate' -import { Bet } from '../../common/bet' -import { Comment } from '../../common/comment' -import { User } from '../../common/user' +} from 'common/calculate' +import { Bet } from 'common/bet' +import { Comment } from 'common/comment' +import { User } from 'common/user' import { getContractScore, MAX_FEED_CONTRACTS, -} from '../../common/recommended-contracts' +} from 'common/recommended-contracts' import { callCloudFunction } from './call-cloud-function' const firestore = admin.firestore() diff --git a/functions/src/update-recommendations.ts b/functions/src/update-recommendations.ts index 4e656dda..e18e7c0e 100644 --- a/functions/src/update-recommendations.ts +++ b/functions/src/update-recommendations.ts @@ -3,12 +3,12 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getValue, getValues } from './utils' -import { Contract } from '../../common/contract' -import { Bet } from '../../common/bet' -import { User } from '../../common/user' -import { ClickEvent } from '../../common/tracking' -import { getWordScores } from '../../common/recommended-contracts' -import { batchedWaitAll } from '../../common/util/promise' +import { Contract } from 'common/contract' +import { Bet } from 'common/bet' +import { User } from 'common/user' +import { ClickEvent } from 'common/tracking' +import { getWordScores } from 'common/recommended-contracts' +import { batchedWaitAll } from 'common/util/promise' import { callCloudFunction } from './call-cloud-function' const firestore = admin.firestore() diff --git a/functions/src/update-user-metrics.ts b/functions/src/update-user-metrics.ts index 70fd1bc5..6f755622 100644 --- a/functions/src/update-user-metrics.ts +++ b/functions/src/update-user-metrics.ts @@ -3,11 +3,11 @@ import * as admin from 'firebase-admin' import * as _ from 'lodash' import { getValues } from './utils' -import { Contract } from '../../common/contract' -import { Bet } from '../../common/bet' -import { User } from '../../common/user' -import { batchedWaitAll } from '../../common/util/promise' -import { calculatePayout } from '../../common/calculate' +import { Contract } from 'common/contract' +import { Bet } from 'common/bet' +import { User } from 'common/user' +import { batchedWaitAll } from 'common/util/promise' +import { calculatePayout } from 'common/calculate' const firestore = admin.firestore() diff --git a/functions/src/utils.ts b/functions/src/utils.ts index 28ef5445..d0ab8c5d 100644 --- a/functions/src/utils.ts +++ b/functions/src/utils.ts @@ -1,7 +1,7 @@ import * as admin from 'firebase-admin' -import { Contract } from '../../common/contract' -import { PrivateUser, User } from '../../common/user' +import { Contract } from 'common/contract' +import { PrivateUser, User } from 'common/user' export const isProd = admin.instanceId().app.options.projectId === 'mantic-markets' diff --git a/functions/tsconfig.json b/functions/tsconfig.json index c836df11..e183bb44 100644 --- a/functions/tsconfig.json +++ b/functions/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "baseUrl": "../", "module": "commonjs", "noImplicitReturns": true, "outDir": "lib", diff --git a/web/components/add-funds-button.tsx b/web/components/add-funds-button.tsx index 7ca154ea..566f4716 100644 --- a/web/components/add-funds-button.tsx +++ b/web/components/add-funds-button.tsx @@ -1,8 +1,8 @@ import clsx from 'clsx' import { useEffect, useState } from 'react' -import { useUser } from '../hooks/use-user' -import { checkoutURL } from '../lib/service/stripe' +import { useUser } from 'web/hooks/use-user' +import { checkoutURL } from 'web/lib/service/stripe' import { FundsSelector } from './yes-no-selector' export function AddFundsButton(props: { className?: string }) { diff --git a/web/components/add-liquidity-panel.tsx b/web/components/add-liquidity-panel.tsx index f04c2b0a..240bde7d 100644 --- a/web/components/add-liquidity-panel.tsx +++ b/web/components/add-liquidity-panel.tsx @@ -1,10 +1,10 @@ import clsx from 'clsx' import { useState } from 'react' -import { Contract } from '../../common/contract' -import { formatMoney } from '../../common/util/format' -import { useUser } from '../hooks/use-user' -import { addLiquidity } from '../lib/firebase/api-call' +import { Contract } from 'common/contract' +import { formatMoney } from 'common/util/format' +import { useUser } from 'web/hooks/use-user' +import { addLiquidity } from 'web/lib/firebase/api-call' import { AmountInput } from './amount-input' import { Row } from './layout/row' diff --git a/web/components/amount-input.tsx b/web/components/amount-input.tsx index 76111b6f..ccd668d9 100644 --- a/web/components/amount-input.tsx +++ b/web/components/amount-input.tsx @@ -1,13 +1,13 @@ import clsx from 'clsx' import _ from 'lodash' -import { useUser } from '../hooks/use-user' -import { formatMoney, formatWithCommas } from '../../common/util/format' +import { useUser } from 'web/hooks/use-user' +import { formatMoney, formatWithCommas } from 'common/util/format' import { Col } from './layout/col' import { Row } from './layout/row' -import { Bet } from '../../common/bet' +import { Bet } from 'common/bet' import { Spacer } from './layout/spacer' -import { calculateCpmmSale } from '../../common/calculate-cpmm' -import { Binary, CPMM, FullContract } from '../../common/contract' +import { calculateCpmmSale } from 'common/calculate-cpmm' +import { Binary, CPMM, FullContract } from 'common/contract' import { SiteLink } from './site-link' export function AmountInput(props: { diff --git a/web/components/analytics/charts.tsx b/web/components/analytics/charts.tsx index 4bf8d52b..44360c97 100644 --- a/web/components/analytics/charts.tsx +++ b/web/components/analytics/charts.tsx @@ -1,7 +1,7 @@ import { ResponsiveLine } from '@nivo/line' import dayjs from 'dayjs' import _ from 'lodash' -import { useWindowSize } from '../../hooks/use-window-size' +import { useWindowSize } from 'web/hooks/use-window-size' export function DailyCountChart(props: { startDate: number diff --git a/web/components/answers/answer-bet-panel.tsx b/web/components/answers/answer-bet-panel.tsx index 18fd949d..e0984f6a 100644 --- a/web/components/answers/answer-bet-panel.tsx +++ b/web/components/answers/answer-bet-panel.tsx @@ -3,28 +3,28 @@ import _ from 'lodash' import { useEffect, useRef, useState } from 'react' import { XIcon } from '@heroicons/react/solid' -import { Answer } from '../../../common/answer' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { Answer } from 'common/answer' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { BuyAmountInput } from '../amount-input' import { Col } from '../layout/col' -import { placeBet } from '../../lib/firebase/api-call' +import { placeBet } from 'web/lib/firebase/api-call' import { Row } from '../layout/row' import { Spacer } from '../layout/spacer' import { formatMoney, formatPercent, formatWithCommas, -} from '../../../common/util/format' +} from 'common/util/format' import { InfoTooltip } from '../info-tooltip' -import { useUser } from '../../hooks/use-user' +import { useUser } from 'web/hooks/use-user' import { getDpmOutcomeProbability, calculateDpmShares, calculateDpmPayoutAfterCorrectBet, getDpmOutcomeProbabilityAfterBet, -} from '../../../common/calculate-dpm' -import { firebaseLogin } from '../../lib/firebase/users' -import { Bet } from '../../../common/bet' +} from 'common/calculate-dpm' +import { firebaseLogin } from 'web/lib/firebase/users' +import { Bet } from 'common/bet' export function AnswerBetPanel(props: { answer: Answer diff --git a/web/components/answers/answer-item.tsx b/web/components/answers/answer-item.tsx index 96746b62..55351083 100644 --- a/web/components/answers/answer-item.tsx +++ b/web/components/answers/answer-item.tsx @@ -1,15 +1,15 @@ import clsx from 'clsx' import _ from 'lodash' -import { Answer } from '../../../common/answer' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { Answer } from 'common/answer' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { Col } from '../layout/col' import { Row } from '../layout/row' import { Avatar } from '../avatar' import { SiteLink } from '../site-link' -import { formatPercent } from '../../../common/util/format' -import { getDpmOutcomeProbability } from '../../../common/calculate-dpm' -import { tradingAllowed } from '../../lib/firebase/contracts' +import { formatPercent } from 'common/util/format' +import { getDpmOutcomeProbability } from 'common/calculate-dpm' +import { tradingAllowed } from 'web/lib/firebase/contracts' import { Linkify } from '../linkify' export function AnswerItem(props: { diff --git a/web/components/answers/answer-resolve-panel.tsx b/web/components/answers/answer-resolve-panel.tsx index 41aa90b2..70eb1299 100644 --- a/web/components/answers/answer-resolve-panel.tsx +++ b/web/components/answers/answer-resolve-panel.tsx @@ -2,13 +2,13 @@ import clsx from 'clsx' import _ from 'lodash' import { useState } from 'react' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { Col } from '../layout/col' -import { resolveMarket } from '../../lib/firebase/api-call' +import { resolveMarket } from 'web/lib/firebase/api-call' import { Row } from '../layout/row' import { ChooseCancelSelector } from '../yes-no-selector' import { ResolveConfirmationButton } from '../confirmation-button' -import { removeUndefinedProps } from '../../../common/util/object' +import { removeUndefinedProps } from 'common/util/object' export function AnswerResolvePanel(props: { contract: FullContract diff --git a/web/components/answers/answers-graph.tsx b/web/components/answers/answers-graph.tsx index df56ab93..5853f4a9 100644 --- a/web/components/answers/answers-graph.tsx +++ b/web/components/answers/answers-graph.tsx @@ -4,11 +4,11 @@ import dayjs from 'dayjs' import _ from 'lodash' import { memo } from 'react' -import { Bet } from '../../../common/bet' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' -import { getOutcomeProbability } from '../../../common/calculate' -import { useBets } from '../../hooks/use-bets' -import { useWindowSize } from '../../hooks/use-window-size' +import { Bet } from 'common/bet' +import { DPM, FreeResponse, FullContract } from 'common/contract' +import { getOutcomeProbability } from 'common/calculate' +import { useBets } from 'web/hooks/use-bets' +import { useWindowSize } from 'web/hooks/use-window-size' const NUM_LINES = 6 diff --git a/web/components/answers/answers-panel.tsx b/web/components/answers/answers-panel.tsx index f315b514..3d9d066b 100644 --- a/web/components/answers/answers-panel.tsx +++ b/web/components/answers/answers-panel.tsx @@ -1,21 +1,21 @@ import _ from 'lodash' import { useLayoutEffect, useState } from 'react' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { Col } from '../layout/col' -import { useUser } from '../../hooks/use-user' -import { getDpmOutcomeProbability } from '../../../common/calculate-dpm' -import { useAnswers } from '../../hooks/use-answers' -import { tradingAllowed } from '../../lib/firebase/contracts' +import { useUser } from 'web/hooks/use-user' +import { getDpmOutcomeProbability } from 'common/calculate-dpm' +import { useAnswers } from 'web/hooks/use-answers' +import { tradingAllowed } from 'web/lib/firebase/contracts' import { AnswerItem } from './answer-item' import { CreateAnswerPanel } from './create-answer-panel' import { AnswerResolvePanel } from './answer-resolve-panel' import { Spacer } from '../layout/spacer' import { FeedItems } from '../feed/feed-items' import { ActivityItem } from '../feed/activity-items' -import { User } from '../../../common/user' -import { getOutcomeProbability } from '../../../common/calculate' -import { Answer } from '../../../common/answer' +import { User } from 'common/user' +import { getOutcomeProbability } from 'common/calculate' +import { Answer } from 'common/answer' export function AnswersPanel(props: { contract: FullContract diff --git a/web/components/answers/create-answer-panel.tsx b/web/components/answers/create-answer-panel.tsx index 6a3dd8c6..2075b60d 100644 --- a/web/components/answers/create-answer-panel.tsx +++ b/web/components/answers/create-answer-panel.tsx @@ -3,26 +3,26 @@ import _ from 'lodash' import { useState } from 'react' import Textarea from 'react-expanding-textarea' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { BuyAmountInput } from '../amount-input' import { Col } from '../layout/col' -import { createAnswer } from '../../lib/firebase/api-call' +import { createAnswer } from 'web/lib/firebase/api-call' import { Row } from '../layout/row' import { formatMoney, formatPercent, formatWithCommas, -} from '../../../common/util/format' +} from 'common/util/format' import { InfoTooltip } from '../info-tooltip' -import { useUser } from '../../hooks/use-user' +import { useUser } from 'web/hooks/use-user' import { calculateDpmShares, calculateDpmPayoutAfterCorrectBet, getDpmOutcomeProbabilityAfterBet, -} from '../../../common/calculate-dpm' -import { firebaseLogin } from '../../lib/firebase/users' -import { Bet } from '../../../common/bet' -import { MAX_ANSWER_LENGTH } from '../../../common/answer' +} from 'common/calculate-dpm' +import { firebaseLogin } from 'web/lib/firebase/users' +import { Bet } from 'common/bet' +import { MAX_ANSWER_LENGTH } from 'common/answer' export function CreateAnswerPanel(props: { contract: FullContract diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index c4f5c506..2f9064c7 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -1,8 +1,8 @@ import clsx from 'clsx' import React, { useEffect, useState } from 'react' -import { useUser } from '../hooks/use-user' -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' +import { useUser } from 'web/hooks/use-user' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' import { Col } from './layout/col' import { Row } from './layout/row' import { Spacer } from './layout/spacer' @@ -11,11 +11,11 @@ import { formatMoney, formatPercent, formatWithCommas, -} from '../../common/util/format' +} from 'common/util/format' import { Title } from './title' -import { firebaseLogin, User } from '../lib/firebase/users' -import { Bet } from '../../common/bet' -import { placeBet, sellShares } from '../lib/firebase/api-call' +import { firebaseLogin, User } from 'web/lib/firebase/users' +import { Bet } from 'common/bet' +import { placeBet, sellShares } from 'web/lib/firebase/api-call' import { BuyAmountInput, SellAmountInput } from './amount-input' import { InfoTooltip } from './info-tooltip' import { BinaryOutcomeLabel } from './outcome-label' @@ -24,13 +24,10 @@ import { calculateShares, getProbability, getOutcomeProbabilityAfterBet, -} from '../../common/calculate' -import { useFocus } from '../hooks/use-focus' -import { useUserContractBets } from '../hooks/use-user-bets' -import { - calculateCpmmSale, - getCpmmProbability, -} from '../../common/calculate-cpmm' +} from 'common/calculate' +import { useFocus } from 'web/hooks/use-focus' +import { useUserContractBets } from 'web/hooks/use-user-bets' +import { calculateCpmmSale, getCpmmProbability } from 'common/calculate-cpmm' import { SellRow } from './sell-row' import { useSaveShares } from './use-save-shares' diff --git a/web/components/bet-row.tsx b/web/components/bet-row.tsx index 3deec388..969dc47f 100644 --- a/web/components/bet-row.tsx +++ b/web/components/bet-row.tsx @@ -3,11 +3,11 @@ import { useState } from 'react' import { BetPanelSwitcher } from './bet-panel' import { Row } from './layout/row' import { YesNoSelector } from './yes-no-selector' -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' import { Modal } from './layout/modal' import { SellButton } from './sell-button' -import { useUser } from '../hooks/use-user' -import { useUserContractBets } from '../hooks/use-user-bets' +import { useUser } from 'web/hooks/use-user' +import { useUserContractBets } from 'web/hooks/use-user-bets' import { useSaveShares } from './use-save-shares' // Inline version of a bet panel. Opens BetPanel in a new modal. diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 9bad3627..403cb097 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -4,14 +4,14 @@ import dayjs from 'dayjs' import { useEffect, useState } from 'react' import clsx from 'clsx' -import { useUserBets } from '../hooks/use-user-bets' -import { Bet } from '../lib/firebase/bets' -import { User } from '../lib/firebase/users' +import { useUserBets } from 'web/hooks/use-user-bets' +import { Bet } from 'web/lib/firebase/bets' +import { User } from 'web/lib/firebase/users' import { formatMoney, formatPercent, formatWithCommas, -} from '../../common/util/format' +} from 'common/util/format' import { Col } from './layout/col' import { Spacer } from './layout/spacer' import { @@ -19,13 +19,13 @@ import { getContractFromId, contractPath, getBinaryProbPercent, -} from '../lib/firebase/contracts' +} from 'web/lib/firebase/contracts' import { Row } from './layout/row' import { UserLink } from './user-page' -import { sellBet } from '../lib/firebase/api-call' +import { sellBet } from 'web/lib/firebase/api-call' import { ConfirmationButton } from './confirmation-button' import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label' -import { filterDefined } from '../../common/util/array' +import { filterDefined } from 'common/util/array' import { LoadingIndicator } from './loading-indicator' import { SiteLink } from './site-link' import { @@ -36,9 +36,9 @@ import { getContractBetMetrics, resolvedPayout, getContractBetNullMetrics, -} from '../../common/calculate' -import { useTimeSinceFirstRender } from '../hooks/use-time-since-first-render' -import { trackLatency } from '../lib/firebase/tracking' +} from 'common/calculate' +import { useTimeSinceFirstRender } from 'web/hooks/use-time-since-first-render' +import { trackLatency } from 'web/lib/firebase/tracking' type BetSort = 'newest' | 'profit' | 'closeTime' | 'value' type BetFilter = 'open' | 'closed' | 'resolved' | 'all' diff --git a/web/components/charity/charity-card.tsx b/web/components/charity/charity-card.tsx index 13a871b1..92fa56d2 100644 --- a/web/components/charity/charity-card.tsx +++ b/web/components/charity/charity-card.tsx @@ -2,8 +2,8 @@ import { StarIcon } from '@heroicons/react/solid' import _ from 'lodash' import Link from 'next/link' import Image from 'next/image' -import { Charity } from '../../../common/charity' -import { useCharityTxns } from '../../hooks/use-charity-txns' +import { Charity } from 'common/charity' +import { useCharityTxns } from 'web/hooks/use-charity-txns' import { manaToUSD } from '../../pages/charity/[charitySlug]' import { Row } from '../layout/row' diff --git a/web/components/charity/feed-items.tsx b/web/components/charity/feed-items.tsx index 43d03c7b..368854c9 100644 --- a/web/components/charity/feed-items.tsx +++ b/web/components/charity/feed-items.tsx @@ -1,6 +1,6 @@ -import { Txn } from '../../../common/txn' +import { Txn } from 'common/txn' import { Avatar } from '../avatar' -import { useUserById } from '../../hooks/use-users' +import { useUserById } from 'web/hooks/use-users' import { UserLink } from '../user-page' import { manaToUSD } from '../../pages/charity/[charitySlug]' import { RelativeTimestamp } from '../relative-timestamp' diff --git a/web/components/comments-list.tsx b/web/components/comments-list.tsx index 7461c6f1..bceb2d59 100644 --- a/web/components/comments-list.tsx +++ b/web/components/comments-list.tsx @@ -1,12 +1,12 @@ -import { Comment } from '../../common/comment' -import { Contract } from '../../common/contract' -import { contractPath } from '../lib/firebase/contracts' +import { Comment } from 'common/comment' +import { Contract } from 'common/contract' +import { contractPath } from 'web/lib/firebase/contracts' import { SiteLink } from './site-link' import { Row } from './layout/row' import { Avatar } from './avatar' import { RelativeTimestamp } from './relative-timestamp' import { UserLink } from './user-page' -import { User } from '../../common/user' +import { User } from 'common/user' import { Col } from './layout/col' import { Linkify } from './linkify' diff --git a/web/components/contract/contract-card.tsx b/web/components/contract/contract-card.tsx index 41373679..d1c7dd31 100644 --- a/web/components/contract/contract-card.tsx +++ b/web/components/contract/contract-card.tsx @@ -2,12 +2,12 @@ import clsx from 'clsx' import Link from 'next/link' import _ from 'lodash' import { Row } from '../layout/row' -import { formatPercent } from '../../../common/util/format' +import { formatPercent } from 'common/util/format' import { Contract, contractPath, getBinaryProbPercent, -} from '../../lib/firebase/contracts' +} from 'web/lib/firebase/contracts' import { Col } from '../layout/col' import { Spacer } from '../layout/spacer' import { @@ -17,13 +17,13 @@ import { FreeResponse, FreeResponseContract, FullContract, -} from '../../../common/contract' +} from 'common/contract' import { AnswerLabel, BinaryContractOutcomeLabel, FreeResponseOutcomeLabel, } from '../outcome-label' -import { getOutcomeProbability, getTopAnswer } from '../../../common/calculate' +import { getOutcomeProbability, getTopAnswer } from 'common/calculate' import { AbbrContractDetails } from './contract-details' export function ContractCard(props: { diff --git a/web/components/contract/contract-description.tsx b/web/components/contract/contract-description.tsx index dea08c6a..86331601 100644 --- a/web/components/contract/contract-description.tsx +++ b/web/components/contract/contract-description.tsx @@ -3,10 +3,10 @@ import dayjs from 'dayjs' import { useState } from 'react' import Textarea from 'react-expanding-textarea' -import { Contract } from '../../../common/contract' -import { parseTags } from '../../../common/util/parse' -import { useAdmin } from '../../hooks/use-admin' -import { updateContract } from '../../lib/firebase/contracts' +import { Contract } from 'common/contract' +import { parseTags } from 'common/util/parse' +import { useAdmin } from 'web/hooks/use-admin' +import { updateContract } from 'web/lib/firebase/contracts' import { Row } from '../layout/row' import { Linkify } from '../linkify' diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 8cc27496..21849cc4 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -3,21 +3,21 @@ import _ from 'lodash' import { ClockIcon, DatabaseIcon, PencilIcon } from '@heroicons/react/outline' import { TrendingUpIcon } from '@heroicons/react/solid' import { Row } from '../layout/row' -import { formatMoney } from '../../../common/util/format' +import { formatMoney } from 'common/util/format' import { UserLink } from '../user-page' import { Contract, contractMetrics, updateContract, -} from '../../lib/firebase/contracts' +} from 'web/lib/firebase/contracts' import { Col } from '../layout/col' import dayjs from 'dayjs' import { DateTimeTooltip } from '../datetime-tooltip' -import { fromNow } from '../../lib/util/time' +import { fromNow } from 'web/lib/util/time' import { Avatar } from '../avatar' import { useState } from 'react' import { ContractInfoDialog } from './contract-info-dialog' -import { Bet } from '../../../common/bet' +import { Bet } from 'common/bet' import NewContractBadge from '../new-contract-badge' export function AbbrContractDetails(props: { diff --git a/web/components/contract/contract-info-dialog.tsx b/web/components/contract/contract-info-dialog.tsx index 7d94c64a..dca03507 100644 --- a/web/components/contract/contract-info-dialog.tsx +++ b/web/components/contract/contract-info-dialog.tsx @@ -3,14 +3,11 @@ import clsx from 'clsx' import dayjs from 'dayjs' import _ from 'lodash' import { useState } from 'react' -import { Bet } from '../../../common/bet' +import { Bet } from 'common/bet' -import { Contract } from '../../../common/contract' -import { formatMoney } from '../../../common/util/format' -import { - contractPath, - getBinaryProbPercent, -} from '../../lib/firebase/contracts' +import { Contract } from 'common/contract' +import { formatMoney } from 'common/util/format' +import { contractPath, getBinaryProbPercent } from 'web/lib/firebase/contracts' import { AddLiquidityPanel } from '../add-liquidity-panel' import { CopyLinkButton } from '../copy-link-button' import { Col } from '../layout/col' diff --git a/web/components/contract/contract-overview.tsx b/web/components/contract/contract-overview.tsx index 524a1962..7ebdf09d 100644 --- a/web/components/contract/contract-overview.tsx +++ b/web/components/contract/contract-overview.tsx @@ -1,8 +1,8 @@ -import { Contract, tradingAllowed } from '../../lib/firebase/contracts' +import { Contract, tradingAllowed } from 'web/lib/firebase/contracts' import { Col } from '../layout/col' import { Spacer } from '../layout/spacer' import { ContractProbGraph } from './contract-prob-graph' -import { useUser } from '../../hooks/use-user' +import { useUser } from 'web/hooks/use-user' import { Row } from '../layout/row' import { Linkify } from '../linkify' import clsx from 'clsx' @@ -10,11 +10,11 @@ import { FreeResponseResolutionOrChance, BinaryResolutionOrChance, } from './contract-card' -import { Bet } from '../../../common/bet' -import { Comment } from '../../../common/comment' +import { Bet } from 'common/bet' +import { Comment } from 'common/comment' import BetRow from '../bet-row' import { AnswersGraph } from '../answers/answers-graph' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' +import { DPM, FreeResponse, FullContract } from 'common/contract' import { ContractDescription } from './contract-description' import { ContractDetails } from './contract-details' import { ShareMarket } from '../share-market' diff --git a/web/components/contract/contract-prob-graph.tsx b/web/components/contract/contract-prob-graph.tsx index 18374f0e..e3743e84 100644 --- a/web/components/contract/contract-prob-graph.tsx +++ b/web/components/contract/contract-prob-graph.tsx @@ -2,11 +2,11 @@ import { DatumValue } from '@nivo/core' import { ResponsiveLine } from '@nivo/line' import dayjs from 'dayjs' import { memo } from 'react' -import { Bet } from '../../../common/bet' -import { getInitialProbability } from '../../../common/calculate' -import { Binary, CPMM, DPM, FullContract } from '../../../common/contract' -import { useBetsWithoutAntes } from '../../hooks/use-bets' -import { useWindowSize } from '../../hooks/use-window-size' +import { Bet } from 'common/bet' +import { getInitialProbability } from 'common/calculate' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { useBetsWithoutAntes } from 'web/hooks/use-bets' +import { useWindowSize } from 'web/hooks/use-window-size' export const ContractProbGraph = memo(function ContractProbGraph(props: { contract: FullContract diff --git a/web/components/contract/contract-tabs.tsx b/web/components/contract/contract-tabs.tsx index ae1203cf..c59a834d 100644 --- a/web/components/contract/contract-tabs.tsx +++ b/web/components/contract/contract-tabs.tsx @@ -1,8 +1,8 @@ -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' -import { Comment } from '../../lib/firebase/comments' -import { User } from '../../../common/user' -import { useBets } from '../../hooks/use-bets' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' +import { Comment } from 'web/lib/firebase/comments' +import { User } from 'common/user' +import { useBets } from 'web/hooks/use-bets' import { ContractActivity } from '../feed/contract-activity' import { ContractBetsTable, MyBetsSummary } from '../bets-list' import { Spacer } from '../layout/spacer' diff --git a/web/components/contract/contracts-list.tsx b/web/components/contract/contracts-list.tsx index e84af1ea..76cc8752 100644 --- a/web/components/contract/contracts-list.tsx +++ b/web/components/contract/contracts-list.tsx @@ -8,16 +8,16 @@ import { Contract, listContracts, getBinaryProb, -} from '../../lib/firebase/contracts' -import { User } from '../../lib/firebase/users' +} from 'web/lib/firebase/contracts' +import { User } from 'web/lib/firebase/users' import { Col } from '../layout/col' import { SiteLink } from '../site-link' import { ContractCard } from './contract-card' import { Sort, useQueryAndSortParams, -} from '../../hooks/use-sort-and-query-params' -import { Answer } from '../../../common/answer' +} from 'web/hooks/use-sort-and-query-params' +import { Answer } from 'common/answer' import { LoadingIndicator } from '../loading-indicator' export function ContractsGrid(props: { diff --git a/web/components/copy-link-button.tsx b/web/components/copy-link-button.tsx index d63d3ff2..6ad22893 100644 --- a/web/components/copy-link-button.tsx +++ b/web/components/copy-link-button.tsx @@ -2,10 +2,10 @@ import { Fragment } from 'react' import { LinkIcon } from '@heroicons/react/outline' import { Menu, Transition } from '@headlessui/react' import clsx from 'clsx' -import { Contract } from '../../common/contract' -import { copyToClipboard } from '../lib/util/copy' -import { contractPath } from '../lib/firebase/contracts' -import { ENV_CONFIG } from '../../common/envs/constants' +import { Contract } from 'common/contract' +import { copyToClipboard } from 'web/lib/util/copy' +import { contractPath } from 'web/lib/firebase/contracts' +import { ENV_CONFIG } from 'common/envs/constants' function copyContractUrl(contract: Contract) { copyToClipboard(`https://${ENV_CONFIG.domain}${contractPath(contract)}`) diff --git a/web/components/feed-create.tsx b/web/components/feed-create.tsx index 7ce1deb5..1f308355 100644 --- a/web/components/feed-create.tsx +++ b/web/components/feed-create.tsx @@ -3,13 +3,13 @@ import { Avatar } from './avatar' import { useEffect, useRef, useState } from 'react' import { Spacer } from './layout/spacer' import { NewContract } from '../pages/create' -import { firebaseLogin, User } from '../lib/firebase/users' +import { firebaseLogin, User } from 'web/lib/firebase/users' import { ContractsGrid } from './contract/contracts-list' -import { Contract, MAX_QUESTION_LENGTH } from '../../common/contract' +import { Contract, MAX_QUESTION_LENGTH } from 'common/contract' import { Col } from './layout/col' import clsx from 'clsx' import { Row } from './layout/row' -import { ENV_CONFIG } from '../../common/envs/constants' +import { ENV_CONFIG } from 'common/envs/constants' import _ from 'lodash' import { SiteLink } from './site-link' diff --git a/web/components/feed/activity-feed.tsx b/web/components/feed/activity-feed.tsx index 19ec1299..c8d14476 100644 --- a/web/components/feed/activity-feed.tsx +++ b/web/components/feed/activity-feed.tsx @@ -1,10 +1,10 @@ import _ from 'lodash' -import { Contract } from '../../lib/firebase/contracts' -import { Comment } from '../../lib/firebase/comments' +import { Contract } from 'web/lib/firebase/contracts' +import { Comment } from 'web/lib/firebase/comments' import { Col } from '../layout/col' -import { Bet } from '../../../common/bet' -import { useUser } from '../../hooks/use-user' +import { Bet } from 'common/bet' +import { useUser } from 'web/hooks/use-user' import { ContractActivity } from './contract-activity' export function ActivityFeed(props: { diff --git a/web/components/feed/activity-items.ts b/web/components/feed/activity-items.ts index 71d42621..21baa322 100644 --- a/web/components/feed/activity-items.ts +++ b/web/components/feed/activity-items.ts @@ -1,17 +1,12 @@ import _ from 'lodash' -import { Answer } from '../../../common/answer' -import { Bet } from '../../../common/bet' -import { getOutcomeProbability } from '../../../common/calculate' -import { Comment } from '../../../common/comment' -import { - Contract, - DPM, - FreeResponse, - FullContract, -} from '../../../common/contract' -import { User } from '../../../common/user' -import { mapCommentsByBetId } from '../../lib/firebase/comments' +import { Answer } from 'common/answer' +import { Bet } from 'common/bet' +import { getOutcomeProbability } from 'common/calculate' +import { Comment } from 'common/comment' +import { Contract, DPM, FreeResponse, FullContract } from 'common/contract' +import { User } from 'common/user' +import { mapCommentsByBetId } from 'web/lib/firebase/comments' export type ActivityItem = | DescriptionItem diff --git a/web/components/feed/contract-activity.tsx b/web/components/feed/contract-activity.tsx index a0e40916..40b2dd09 100644 --- a/web/components/feed/contract-activity.tsx +++ b/web/components/feed/contract-activity.tsx @@ -1,15 +1,15 @@ -import { Contract } from '../../lib/firebase/contracts' -import { Comment } from '../../lib/firebase/comments' -import { Bet } from '../../../common/bet' -import { useBets } from '../../hooks/use-bets' -import { useComments } from '../../hooks/use-comments' +import { Contract } from 'web/lib/firebase/contracts' +import { Comment } from 'web/lib/firebase/comments' +import { Bet } from 'common/bet' +import { useBets } from 'web/hooks/use-bets' +import { useComments } from 'web/hooks/use-comments' import { getAllContractActivityItems, getRecentContractActivityItems, getSpecificContractActivityItems, } from './activity-items' import { FeedItems } from './feed-items' -import { User } from '../../../common/user' +import { User } from 'common/user' export function ContractActivity(props: { contract: Contract diff --git a/web/components/feed/feed-items.tsx b/web/components/feed/feed-items.tsx index dbf3ece3..cb089dd7 100644 --- a/web/components/feed/feed-items.tsx +++ b/web/components/feed/feed-items.tsx @@ -19,44 +19,38 @@ import { Contract, contractPath, tradingAllowed, -} from '../../lib/firebase/contracts' -import { useUser } from '../../hooks/use-user' +} from 'web/lib/firebase/contracts' +import { useUser } from 'web/hooks/use-user' import { Linkify } from '../linkify' import { Row } from '../layout/row' -import { createComment, MAX_COMMENT_LENGTH } from '../../lib/firebase/comments' -import { formatMoney, formatPercent } from '../../../common/util/format' -import { Comment } from '../../../common/comment' +import { createComment, MAX_COMMENT_LENGTH } from 'web/lib/firebase/comments' +import { formatMoney, formatPercent } from 'common/util/format' +import { Comment } from 'common/comment' import { BinaryResolutionOrChance } from '../contract/contract-card' import { SiteLink } from '../site-link' import { Col } from '../layout/col' import { UserLink } from '../user-page' import { DateTimeTooltip } from '../datetime-tooltip' -import { Bet } from '../../lib/firebase/bets' +import { Bet } from 'web/lib/firebase/bets' import { JoinSpans } from '../join-spans' -import { fromNow } from '../../lib/util/time' +import { fromNow } from 'web/lib/util/time' import BetRow from '../bet-row' import { Avatar } from '../avatar' -import { Answer } from '../../../common/answer' +import { Answer } from 'common/answer' import { ActivityItem, GENERAL_COMMENTS_OUTCOME_ID } from './activity-items' -import { - Binary, - CPMM, - DPM, - FreeResponse, - FullContract, -} from '../../../common/contract' +import { Binary, CPMM, DPM, FreeResponse, FullContract } from 'common/contract' import { BuyButton } from '../yes-no-selector' -import { getDpmOutcomeProbability } from '../../../common/calculate-dpm' +import { getDpmOutcomeProbability } from 'common/calculate-dpm' import { AnswerBetPanel } from '../answers/answer-bet-panel' -import { useSaveSeenContract } from '../../hooks/use-seen-contracts' -import { User } from '../../../common/user' +import { useSaveSeenContract } from 'web/hooks/use-seen-contracts' +import { User } from 'common/user' import { Modal } from '../layout/modal' -import { trackClick } from '../../lib/firebase/tracking' -import { firebaseLogin } from '../../lib/firebase/users' -import { DAY_MS } from '../../../common/util/time' +import { trackClick } from 'web/lib/firebase/tracking' +import { firebaseLogin } from 'web/lib/firebase/users' +import { DAY_MS } from 'common/util/time' import NewContractBadge from '../new-contract-badge' import { RelativeTimestamp } from '../relative-timestamp' -import { calculateCpmmSale } from '../../../common/calculate-cpmm' +import { calculateCpmmSale } from 'common/calculate-cpmm' export function FeedItems(props: { contract: Contract diff --git a/web/components/feed/find-active-contracts.ts b/web/components/feed/find-active-contracts.ts index 6f40806f..51965792 100644 --- a/web/components/feed/find-active-contracts.ts +++ b/web/components/feed/find-active-contracts.ts @@ -1,7 +1,7 @@ import _ from 'lodash' -import { Contract } from '../../lib/firebase/contracts' -import { Comment } from '../../lib/firebase/comments' -import { Bet } from '../../../common/bet' +import { Contract } from 'web/lib/firebase/contracts' +import { Comment } from 'web/lib/firebase/comments' +import { Bet } from 'common/bet' const MAX_ACTIVE_CONTRACTS = 75 diff --git a/web/components/folds/create-fold-button.tsx b/web/components/folds/create-fold-button.tsx index 0d71fa18..d00964c9 100644 --- a/web/components/folds/create-fold-button.tsx +++ b/web/components/folds/create-fold-button.tsx @@ -2,10 +2,10 @@ import clsx from 'clsx' import { useRouter } from 'next/router' import { useState } from 'react' import { PlusCircleIcon } from '@heroicons/react/solid' -import { parseWordsAsTags } from '../../../common/util/parse' -import { createFold } from '../../lib/firebase/api-call' -import { foldPath } from '../../lib/firebase/folds' -import { toCamelCase } from '../../../common/util/format' +import { parseWordsAsTags } from 'common/util/parse' +import { createFold } from 'web/lib/firebase/api-call' +import { foldPath } from 'web/lib/firebase/folds' +import { toCamelCase } from 'common/util/format' import { ConfirmationButton } from '../confirmation-button' import { Col } from '../layout/col' import { Spacer } from '../layout/spacer' diff --git a/web/components/folds/edit-fold-button.tsx b/web/components/folds/edit-fold-button.tsx index d18ab41c..d6c296b2 100644 --- a/web/components/folds/edit-fold-button.tsx +++ b/web/components/folds/edit-fold-button.tsx @@ -3,10 +3,10 @@ import _ from 'lodash' import clsx from 'clsx' import { PencilIcon } from '@heroicons/react/outline' -import { Fold } from '../../../common/fold' -import { parseWordsAsTags } from '../../../common/util/parse' -import { deleteFold, updateFold } from '../../lib/firebase/folds' -import { toCamelCase } from '../../../common/util/format' +import { Fold } from 'common/fold' +import { parseWordsAsTags } from 'common/util/parse' +import { deleteFold, updateFold } from 'web/lib/firebase/folds' +import { toCamelCase } from 'common/util/format' import { Spacer } from '../layout/spacer' import { TagsList } from '../tags-list' import { useRouter } from 'next/router' diff --git a/web/components/folds/fast-fold-following.tsx b/web/components/folds/fast-fold-following.tsx index eea1e592..b714e22b 100644 --- a/web/components/folds/fast-fold-following.tsx +++ b/web/components/folds/fast-fold-following.tsx @@ -2,11 +2,11 @@ import clsx from 'clsx' import { useState } from 'react' import { SearchIcon } from '@heroicons/react/outline' -import { User } from '../../../common/user' +import { User } from 'common/user' import { followFoldFromSlug, unfollowFoldFromSlug, -} from '../../lib/firebase/folds' +} from 'web/lib/firebase/folds' import { Row } from '../layout/row' import { Spacer } from '../layout/spacer' diff --git a/web/components/folds/fold-tag.tsx b/web/components/folds/fold-tag.tsx index 370cd0b8..4e975226 100644 --- a/web/components/folds/fold-tag.tsx +++ b/web/components/folds/fold-tag.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import { Fold } from '../../../common/fold' +import { Fold } from 'common/fold' export function FoldTag(props: { fold: Fold }) { const { fold } = props diff --git a/web/components/folds/follow-fold-button.tsx b/web/components/folds/follow-fold-button.tsx index 496cda42..21278bdf 100644 --- a/web/components/folds/follow-fold-button.tsx +++ b/web/components/folds/follow-fold-button.tsx @@ -1,8 +1,8 @@ import clsx from 'clsx' -import { Fold } from '../../../common/fold' -import { useFollowedFoldIds } from '../../hooks/use-fold' -import { useUser } from '../../hooks/use-user' -import { followFold, unfollowFold } from '../../lib/firebase/folds' +import { Fold } from 'common/fold' +import { useFollowedFoldIds } from 'web/hooks/use-fold' +import { useUser } from 'web/hooks/use-user' +import { followFold, unfollowFold } from 'web/lib/firebase/folds' export function FollowFoldButton(props: { fold: Fold; className?: string }) { const { fold, className } = props diff --git a/web/components/leaderboard.tsx b/web/components/leaderboard.tsx index 5ae3ddd3..fb104060 100644 --- a/web/components/leaderboard.tsx +++ b/web/components/leaderboard.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import { User } from '../../common/user' +import { User } from 'common/user' import { Avatar } from './avatar' import { Row } from './layout/row' import { SiteLink } from './site-link' diff --git a/web/components/nav/manifold-logo.tsx b/web/components/nav/manifold-logo.tsx index c7fc9df3..ec15d54b 100644 --- a/web/components/nav/manifold-logo.tsx +++ b/web/components/nav/manifold-logo.tsx @@ -1,8 +1,8 @@ import Link from 'next/link' import clsx from 'clsx' -import { useUser } from '../../hooks/use-user' -import { ENV_CONFIG } from '../../../common/envs/constants' +import { useUser } from 'web/hooks/use-user' +import { ENV_CONFIG } from 'common/envs/constants' export function ManifoldLogo(props: { className?: string diff --git a/web/components/nav/nav-bar.tsx b/web/components/nav/nav-bar.tsx index 0aded804..f92f6630 100644 --- a/web/components/nav/nav-bar.tsx +++ b/web/components/nav/nav-bar.tsx @@ -10,8 +10,8 @@ import { import { Transition, Dialog } from '@headlessui/react' import { useState, Fragment } from 'react' import Sidebar from './sidebar' -import { useUser } from '../../hooks/use-user' -import { formatMoney } from '../../../common/util/format' +import { useUser } from 'web/hooks/use-user' +import { formatMoney } from 'common/util/format' import { Avatar } from '../avatar' // From https://codepen.io/chris__sev/pen/QWGvYbL diff --git a/web/components/nav/profile-menu.tsx b/web/components/nav/profile-menu.tsx index 994f8bc1..b25603d4 100644 --- a/web/components/nav/profile-menu.tsx +++ b/web/components/nav/profile-menu.tsx @@ -1,7 +1,7 @@ -import { firebaseLogout, User } from '../../lib/firebase/users' -import { formatMoney } from '../../../common/util/format' +import { firebaseLogout, User } from 'web/lib/firebase/users' +import { formatMoney } from 'common/util/format' import { Avatar } from '../avatar' -import { IS_PRIVATE_MANIFOLD } from '../../../common/envs/constants' +import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' import { Row } from '../layout/row' export function getNavigationOptions(user?: User | null) { diff --git a/web/components/nav/sidebar.tsx b/web/components/nav/sidebar.tsx index 4fef69f4..80376b6c 100644 --- a/web/components/nav/sidebar.tsx +++ b/web/components/nav/sidebar.tsx @@ -14,13 +14,13 @@ import clsx from 'clsx' import _ from 'lodash' import Link from 'next/link' import { useRouter } from 'next/router' -import { useFollowedFolds } from '../../hooks/use-fold' -import { useUser } from '../../hooks/use-user' -import { firebaseLogin, firebaseLogout } from '../../lib/firebase/users' +import { useFollowedFolds } from 'web/hooks/use-fold' +import { useUser } from 'web/hooks/use-user' +import { firebaseLogin, firebaseLogout } from 'web/lib/firebase/users' import { ManifoldLogo } from './manifold-logo' import { MenuButton } from './menu' import { getNavigationOptions, ProfileSummary } from './profile-menu' -import { useHasCreatedContractToday } from '../../hooks/use-has-created-contract-today' +import { useHasCreatedContractToday } from 'web/hooks/use-has-created-contract-today' // Create an icon from the url of an image function IconFromUrl(url: string): React.ComponentType<{ className?: string }> { @@ -46,8 +46,16 @@ const signedOutNavigation = [ const signedOutMobileNavigation = [ { name: 'Charity', href: '/charity', icon: HeartIcon }, { name: 'Leaderboards', href: '/leaderboards', icon: CakeIcon }, - { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh', icon: IconFromUrl("/discord-logo.svg") }, - { name: 'Twitter', href: 'https://twitter.com/ManifoldMarkets', icon: IconFromUrl("/twitter-logo.svg") }, + { + name: 'Discord', + href: 'https://discord.gg/eHQBNBqXuh', + icon: IconFromUrl('/discord-logo.svg'), + }, + { + name: 'Twitter', + href: 'https://twitter.com/ManifoldMarkets', + icon: IconFromUrl('/twitter-logo.svg'), + }, { name: 'About', href: 'https://docs.manifold.markets', icon: BookOpenIcon }, ] diff --git a/web/components/outcome-label.tsx b/web/components/outcome-label.tsx index 95403c75..d578247b 100644 --- a/web/components/outcome-label.tsx +++ b/web/components/outcome-label.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx' -import { Answer } from '../../common/answer' -import { getProbability } from '../../common/calculate' +import { Answer } from 'common/answer' +import { getProbability } from 'common/calculate' import { Binary, Contract, @@ -9,8 +9,8 @@ import { FreeResponse, FreeResponseContract, FullContract, -} from '../../common/contract' -import { formatPercent } from '../../common/util/format' +} from 'common/contract' +import { formatPercent } from 'common/util/format' import { ClientRender } from './client-render' export function OutcomeLabel(props: { diff --git a/web/components/relative-timestamp.tsx b/web/components/relative-timestamp.tsx index cd5ca713..160a665d 100644 --- a/web/components/relative-timestamp.tsx +++ b/web/components/relative-timestamp.tsx @@ -1,5 +1,5 @@ import { DateTimeTooltip } from './datetime-tooltip' -import { fromNow } from '../lib/util/time' +import { fromNow } from 'web/lib/util/time' import React from 'react' export function RelativeTimestamp(props: { time: number }) { diff --git a/web/components/resolution-panel.tsx b/web/components/resolution-panel.tsx index 7645f039..316a5374 100644 --- a/web/components/resolution-panel.tsx +++ b/web/components/resolution-panel.tsx @@ -3,16 +3,16 @@ import React, { useEffect, useState } from 'react' import { Col } from './layout/col' import { Title } from './title' -import { User } from '../lib/firebase/users' +import { User } from 'web/lib/firebase/users' import { YesNoCancelSelector } from './yes-no-selector' import { Spacer } from './layout/spacer' import { ResolveConfirmationButton } from './confirmation-button' -import { resolveMarket } from '../lib/firebase/api-call' +import { resolveMarket } from 'web/lib/firebase/api-call' import { ProbabilitySelector } from './probability-selector' -import { DPM_CREATOR_FEE } from '../../common/fees' -import { getProbability } from '../../common/calculate' -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' -import { formatMoney } from '../../common/util/format' +import { DPM_CREATOR_FEE } from 'common/fees' +import { getProbability } from 'common/calculate' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { formatMoney } from 'common/util/format' export function ResolutionPanel(props: { creator: User diff --git a/web/components/sell-button.tsx b/web/components/sell-button.tsx index 0bccb631..5e71bd77 100644 --- a/web/components/sell-button.tsx +++ b/web/components/sell-button.tsx @@ -1,6 +1,6 @@ -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' -import { User } from '../../common/user' -import { useUserContractBets } from '../hooks/use-user-bets' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { User } from 'common/user' +import { useUserContractBets } from 'web/hooks/use-user-bets' import { useState } from 'react' import { Col } from './layout/col' import clsx from 'clsx' diff --git a/web/components/sell-modal.tsx b/web/components/sell-modal.tsx index 19954d7f..28282766 100644 --- a/web/components/sell-modal.tsx +++ b/web/components/sell-modal.tsx @@ -1,10 +1,10 @@ -import { Binary, CPMM, FullContract } from '../../common/contract' -import { Bet } from '../../common/bet' -import { User } from '../../common/user' +import { Binary, CPMM, FullContract } from 'common/contract' +import { Bet } from 'common/bet' +import { User } from 'common/user' import { Modal } from './layout/modal' import { Col } from './layout/col' import { Title } from './title' -import { formatWithCommas } from '../../common/util/format' +import { formatWithCommas } from 'common/util/format' import { OutcomeLabel } from './outcome-label' import { SellPanel } from './bet-panel' diff --git a/web/components/sell-row.tsx b/web/components/sell-row.tsx index c30f799e..2ec50c72 100644 --- a/web/components/sell-row.tsx +++ b/web/components/sell-row.tsx @@ -1,11 +1,11 @@ -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' -import { User } from '../../common/user' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { User } from 'common/user' import { useState } from 'react' import { Col } from './layout/col' import { Row } from './layout/row' -import { formatWithCommas } from '../../common/util/format' +import { formatWithCommas } from 'common/util/format' import { OutcomeLabel } from './outcome-label' -import { useUserContractBets } from '../hooks/use-user-bets' +import { useUserContractBets } from 'web/hooks/use-user-bets' import { useSaveShares } from './use-save-shares' import { SellSharesModal } from './sell-modal' diff --git a/web/components/share-embed-button.tsx b/web/components/share-embed-button.tsx index eeed7d44..1023b169 100644 --- a/web/components/share-embed-button.tsx +++ b/web/components/share-embed-button.tsx @@ -1,10 +1,10 @@ import { Fragment } from 'react' import { CodeIcon } from '@heroicons/react/outline' import { Menu, Transition } from '@headlessui/react' -import { Contract } from '../../common/contract' -import { contractPath } from '../lib/firebase/contracts' -import { DOMAIN } from '../../common/envs/constants' -import { copyToClipboard } from '../lib/util/copy' +import { Contract } from 'common/contract' +import { contractPath } from 'web/lib/firebase/contracts' +import { DOMAIN } from 'common/envs/constants' +import { copyToClipboard } from 'web/lib/util/copy' function copyEmbedCode(contract: Contract) { const title = contract.question diff --git a/web/components/share-market.tsx b/web/components/share-market.tsx index 0fa425ad..28c0e5ad 100644 --- a/web/components/share-market.tsx +++ b/web/components/share-market.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import { Contract, contractUrl } from '../lib/firebase/contracts' +import { Contract, contractUrl } from 'web/lib/firebase/contracts' import { CopyLinkButton } from './copy-link-button' import { Col } from './layout/col' import { Row } from './layout/row' diff --git a/web/components/tags-input.tsx b/web/components/tags-input.tsx index 83c6bbb1..b52d78e9 100644 --- a/web/components/tags-input.tsx +++ b/web/components/tags-input.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx' import { useState } from 'react' -import { parseWordsAsTags } from '../../common/util/parse' -import { Contract, updateContract } from '../lib/firebase/contracts' +import { parseWordsAsTags } from 'common/util/parse' +import { Contract, updateContract } from 'web/lib/firebase/contracts' import { Col } from './layout/col' import { Row } from './layout/row' import { TagsList } from './tags-list' diff --git a/web/components/use-save-shares.ts b/web/components/use-save-shares.ts index c67ea9c9..6a8b251e 100644 --- a/web/components/use-save-shares.ts +++ b/web/components/use-save-shares.ts @@ -1,5 +1,5 @@ -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' -import { Bet } from '../../common/bet' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { Bet } from 'common/bet' import { useEffect, useState } from 'react' import _ from 'lodash' diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index 24d58081..a36f754c 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -1,5 +1,5 @@ import clsx from 'clsx' -import { User } from '../lib/firebase/users' +import { User } from 'web/lib/firebase/users' import { CreatorContractsList } from './contract/contracts-list' import { SEO } from './SEO' import { Page } from './page' @@ -10,14 +10,14 @@ import { Linkify } from './linkify' import { Spacer } from './layout/spacer' import { Row } from './layout/row' import { LinkIcon } from '@heroicons/react/solid' -import { genHash } from '../../common/util/random' +import { genHash } from 'common/util/random' import { PencilIcon } from '@heroicons/react/outline' import { Tabs } from './layout/tabs' import { UserCommentsList } from './comments-list' import { useEffect, useState } from 'react' -import { Comment, getUsersComments } from '../lib/firebase/comments' -import { Contract } from '../../common/contract' -import { getContractFromId, listContracts } from '../lib/firebase/contracts' +import { Comment, getUsersComments } from 'web/lib/firebase/comments' +import { Contract } from 'common/contract' +import { getContractFromId, listContracts } from 'web/lib/firebase/contracts' import { LoadingIndicator } from './loading-indicator' import { useRouter } from 'next/router' import _ from 'lodash' diff --git a/web/components/yes-no-selector.tsx b/web/components/yes-no-selector.tsx index 4bb7949f..7c175695 100644 --- a/web/components/yes-no-selector.tsx +++ b/web/components/yes-no-selector.tsx @@ -1,6 +1,6 @@ import clsx from 'clsx' import React from 'react' -import { formatMoney } from '../../common/util/format' +import { formatMoney } from 'common/util/format' import { Col } from './layout/col' import { Row } from './layout/row' diff --git a/web/hooks/use-admin.ts b/web/hooks/use-admin.ts index 7c8b8449..a80b3ac4 100644 --- a/web/hooks/use-admin.ts +++ b/web/hooks/use-admin.ts @@ -1,4 +1,4 @@ -import { isAdmin } from '../../common/envs/constants' +import { isAdmin } from 'common/envs/constants' import { usePrivateUser, useUser } from './use-user' export const useAdmin = () => { diff --git a/web/hooks/use-algo-feed.ts b/web/hooks/use-algo-feed.ts index b8cfb7a2..e365c88d 100644 --- a/web/hooks/use-algo-feed.ts +++ b/web/hooks/use-algo-feed.ts @@ -1,17 +1,17 @@ import _ from 'lodash' import { useState, useEffect } from 'react' -import { Bet } from '../../common/bet' -import { Comment } from '../../common/comment' -import { Contract } from '../../common/contract' +import { Bet } from 'common/bet' +import { Comment } from 'common/comment' +import { Contract } from 'common/contract' import { useTimeSinceFirstRender } from './use-time-since-first-render' -import { trackLatency } from '../lib/firebase/tracking' -import { User } from '../../common/user' -import { getUserFeed } from '../lib/firebase/users' +import { trackLatency } from 'web/lib/firebase/tracking' +import { User } from 'common/user' +import { getUserFeed } from 'web/lib/firebase/users' import { useUpdatedContracts } from './use-contracts' import { getRecentBetsAndComments, getTopWeeklyContracts, -} from '../lib/firebase/contracts' +} from 'web/lib/firebase/contracts' type feed = { contract: Contract diff --git a/web/hooks/use-answers.ts b/web/hooks/use-answers.ts index efac8db7..bcfa6725 100644 --- a/web/hooks/use-answers.ts +++ b/web/hooks/use-answers.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import { Answer } from '../../common/answer' -import { listenForAnswers } from '../lib/firebase/answers' +import { Answer } from 'common/answer' +import { listenForAnswers } from 'web/lib/firebase/answers' export const useAnswers = (contractId: string) => { const [answers, setAnswers] = useState() diff --git a/web/hooks/use-bets.ts b/web/hooks/use-bets.ts index 5ea66e1c..5cab16a7 100644 --- a/web/hooks/use-bets.ts +++ b/web/hooks/use-bets.ts @@ -1,11 +1,11 @@ import { useEffect, useState } from 'react' -import { Contract } from '../../common/contract' +import { Contract } from 'common/contract' import { Bet, listenForBets, listenForRecentBets, withoutAnteBets, -} from '../lib/firebase/bets' +} from 'web/lib/firebase/bets' export const useBets = (contractId: string) => { const [bets, setBets] = useState() diff --git a/web/hooks/use-charity-txns.ts b/web/hooks/use-charity-txns.ts index 5636e720..13050fb1 100644 --- a/web/hooks/use-charity-txns.ts +++ b/web/hooks/use-charity-txns.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import { Txn } from '../../common/txn' -import { listenForCharityTxns } from '../lib/firebase/txns' +import { Txn } from 'common/txn' +import { listenForCharityTxns } from 'web/lib/firebase/txns' export const useCharityTxns = (charityId: string) => { const [txns, setTxns] = useState([]) diff --git a/web/hooks/use-comments.ts b/web/hooks/use-comments.ts index 37f001dd..e56e8179 100644 --- a/web/hooks/use-comments.ts +++ b/web/hooks/use-comments.ts @@ -3,7 +3,7 @@ import { Comment, listenForComments, listenForRecentComments, -} from '../lib/firebase/comments' +} from 'web/lib/firebase/comments' export const useComments = (contractId: string) => { const [comments, setComments] = useState() diff --git a/web/hooks/use-contract.ts b/web/hooks/use-contract.ts index ebff7dce..ad2f12a2 100644 --- a/web/hooks/use-contract.ts +++ b/web/hooks/use-contract.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import { Contract, listenForContract } from '../lib/firebase/contracts' +import { Contract, listenForContract } from 'web/lib/firebase/contracts' import { useStateCheckEquality } from './use-state-check-equality' export const useContract = (contractId: string) => { diff --git a/web/hooks/use-contracts.ts b/web/hooks/use-contracts.ts index 0402613f..ef0fd65f 100644 --- a/web/hooks/use-contracts.ts +++ b/web/hooks/use-contracts.ts @@ -8,8 +8,8 @@ import { listenForHotContracts, listenForInactiveContracts, listenForNewContracts, -} from '../lib/firebase/contracts' -import { listenForTaggedContracts } from '../lib/firebase/folds' +} from 'web/lib/firebase/contracts' +import { listenForTaggedContracts } from 'web/lib/firebase/folds' export const useContracts = () => { const [contracts, setContracts] = useState() diff --git a/web/hooks/use-fold.ts b/web/hooks/use-fold.ts index 2c0230c4..4333c218 100644 --- a/web/hooks/use-fold.ts +++ b/web/hooks/use-fold.ts @@ -1,7 +1,7 @@ import _ from 'lodash' import { useEffect, useState } from 'react' -import { Fold } from '../../common/fold' -import { User } from '../../common/user' +import { Fold } from 'common/fold' +import { User } from 'common/user' import { listAllFolds, listenForFold, @@ -9,7 +9,7 @@ import { listenForFoldsWithTags, listenForFollow, listenForFollowedFolds, -} from '../lib/firebase/folds' +} from 'web/lib/firebase/folds' export const useFold = (foldId: string | undefined) => { const [fold, setFold] = useState() diff --git a/web/hooks/use-has-created-contract-today.ts b/web/hooks/use-has-created-contract-today.ts index 43fe42f9..0b3f4bdd 100644 --- a/web/hooks/use-has-created-contract-today.ts +++ b/web/hooks/use-has-created-contract-today.ts @@ -1,6 +1,6 @@ -import { listContracts } from '../lib/firebase/contracts' +import { listContracts } from 'web/lib/firebase/contracts' import { useEffect, useState } from 'react' -import { User } from '../../common/user' +import { User } from 'common/user' export const useHasCreatedContractToday = (user: User | null | undefined) => { const [hasCreatedContractToday, setHasCreatedContractToday] = useState(true) diff --git a/web/hooks/use-propz.ts b/web/hooks/use-propz.ts index 5aee4c61..de161e83 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/envs/constants' +import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' type PropzProps = { // Params from the router query diff --git a/web/hooks/use-seen-contracts.ts b/web/hooks/use-seen-contracts.ts index 58ff1c54..6157f8c7 100644 --- a/web/hooks/use-seen-contracts.ts +++ b/web/hooks/use-seen-contracts.ts @@ -1,7 +1,7 @@ import _ from 'lodash' import { useEffect, RefObject, useState } from 'react' -import { Contract } from '../../common/contract' -import { trackView } from '../lib/firebase/tracking' +import { Contract } from 'common/contract' +import { trackView } from 'web/lib/firebase/tracking' import { useIsVisible } from './use-is-visible' export const useSeenContracts = () => { diff --git a/web/hooks/use-user-bets.ts b/web/hooks/use-user-bets.ts index c11af097..ead55729 100644 --- a/web/hooks/use-user-bets.ts +++ b/web/hooks/use-user-bets.ts @@ -4,7 +4,7 @@ import { Bet, listenForUserBets, listenForUserContractBets, -} from '../lib/firebase/bets' +} from 'web/lib/firebase/bets' export const useUserBets = (userId: string | undefined) => { const [bets, setBets] = useState(undefined) diff --git a/web/hooks/use-user.ts b/web/hooks/use-user.ts index 022045b9..0b96edc1 100644 --- a/web/hooks/use-user.ts +++ b/web/hooks/use-user.ts @@ -1,12 +1,12 @@ import _ from 'lodash' import { useEffect, useState } from 'react' -import { PrivateUser } from '../../common/user' +import { PrivateUser } from 'common/user' import { listenForLogin, listenForPrivateUser, listenForUser, User, -} from '../lib/firebase/users' +} from 'web/lib/firebase/users' import { useStateCheckEquality } from './use-state-check-equality' export const useUser = () => { diff --git a/web/hooks/use-users.ts b/web/hooks/use-users.ts index 5d2649b6..1b5656a0 100644 --- a/web/hooks/use-users.ts +++ b/web/hooks/use-users.ts @@ -1,10 +1,10 @@ import { useState, useEffect } from 'react' -import { PrivateUser, User } from '../../common/user' +import { PrivateUser, User } from 'common/user' import { getUser, listenForAllUsers, listenForPrivateUsers, -} from '../lib/firebase/users' +} from 'web/lib/firebase/users' export const useUsers = () => { const [users, setUsers] = useState([]) diff --git a/web/lib/firebase/answers.ts b/web/lib/firebase/answers.ts index ab41165b..c7ee5c4f 100644 --- a/web/lib/firebase/answers.ts +++ b/web/lib/firebase/answers.ts @@ -2,7 +2,7 @@ import { collection } from 'firebase/firestore' import { getValues, listenForValues } from './utils' import { db } from './init' -import { Answer } from '../../../common/answer' +import { Answer } from 'common/answer' function getAnswersCollection(contractId: string) { return collection(db, 'contracts', contractId, 'answers') diff --git a/web/lib/firebase/api-call.ts b/web/lib/firebase/api-call.ts index a71c2752..fa786952 100644 --- a/web/lib/firebase/api-call.ts +++ b/web/lib/firebase/api-call.ts @@ -1,8 +1,8 @@ import { httpsCallable } from 'firebase/functions' -import { Fold } from '../../../common/fold' -import { Txn } from '../../../common/txn' -import { User } from '../../../common/user' -import { randomString } from '../../../common/util/random' +import { Fold } from 'common/fold' +import { Txn } from 'common/txn' +import { User } from 'common/user' +import { randomString } from 'common/util/random' import './init' import { functions } from './init' diff --git a/web/lib/firebase/bets.ts b/web/lib/firebase/bets.ts index 4056e114..b55b0027 100644 --- a/web/lib/firebase/bets.ts +++ b/web/lib/firebase/bets.ts @@ -8,8 +8,8 @@ import { import _ from 'lodash' import { db } from './init' -import { Bet } from '../../../common/bet' -import { Contract } from '../../../common/contract' +import { Bet } from 'common/bet' +import { Contract } from 'common/contract' import { getValues, listenForValues } from './utils' export type { Bet } diff --git a/web/lib/firebase/comments.ts b/web/lib/firebase/comments.ts index e97e6f99..4b7d1b36 100644 --- a/web/lib/firebase/comments.ts +++ b/web/lib/firebase/comments.ts @@ -11,8 +11,8 @@ import _ from 'lodash' import { getValues, listenForValues } from './utils' import { db } from './init' -import { User } from '../../../common/user' -import { Comment } from '../../../common/comment' +import { User } from 'common/user' +import { Comment } from 'common/comment' export type { Comment } diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts index ab408215..72264b72 100644 --- a/web/lib/firebase/contracts.ts +++ b/web/lib/firebase/contracts.ts @@ -17,16 +17,16 @@ import _ from 'lodash' import { app } from './init' import { getValues, listenForValue, listenForValues } from './utils' -import { Binary, Contract, FullContract } from '../../../common/contract' -import { getDpmProbability } from '../../../common/calculate-dpm' -import { createRNG, shuffle } from '../../../common/util/random' -import { getCpmmProbability } from '../../../common/calculate-cpmm' -import { formatMoney, formatPercent } from '../../../common/util/format' -import { DAY_MS } from '../../../common/util/time' -import { MAX_FEED_CONTRACTS } from '../../../common/recommended-contracts' -import { Bet } from '../../../common/bet' -import { Comment } from '../../../common/comment' -import { ENV_CONFIG } from '../../../common/envs/constants' +import { Binary, Contract, FullContract } from 'common/contract' +import { getDpmProbability } from 'common/calculate-dpm' +import { createRNG, shuffle } from 'common/util/random' +import { getCpmmProbability } from 'common/calculate-cpmm' +import { formatMoney, formatPercent } from 'common/util/format' +import { DAY_MS } from 'common/util/time' +import { MAX_FEED_CONTRACTS } from 'common/recommended-contracts' +import { Bet } from 'common/bet' +import { Comment } from 'common/comment' +import { ENV_CONFIG } from 'common/envs/constants' export type { Contract } export function contractPath(contract: Contract) { diff --git a/web/lib/firebase/folds.ts b/web/lib/firebase/folds.ts index 92dc5be0..90268e98 100644 --- a/web/lib/firebase/folds.ts +++ b/web/lib/firebase/folds.ts @@ -11,7 +11,7 @@ import { where, } from 'firebase/firestore' import _ from 'lodash' -import { Fold } from '../../../common/fold' +import { Fold } from 'common/fold' import { Contract, contractCollection } from './contracts' import { db } from './init' import { User } from './users' diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index 46f14330..379f7cb6 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/envs/constants' +import { FIREBASE_CONFIG } from 'common/envs/constants' import { connectFirestoreEmulator } from 'firebase/firestore' import { connectFunctionsEmulator, getFunctions } from 'firebase/functions' diff --git a/web/lib/firebase/tracking.ts b/web/lib/firebase/tracking.ts index 034ad09d..035ef973 100644 --- a/web/lib/firebase/tracking.ts +++ b/web/lib/firebase/tracking.ts @@ -2,7 +2,7 @@ import { doc, collection, setDoc } from 'firebase/firestore' import _ from 'lodash' import { db } from './init' -import { ClickEvent, LatencyEvent, View } from '../../../common/tracking' +import { ClickEvent, LatencyEvent, View } from 'common/tracking' import { listenForLogin, User } from './users' let user: User | null = null diff --git a/web/lib/firebase/txns.ts b/web/lib/firebase/txns.ts index efb98b45..8fc07525 100644 --- a/web/lib/firebase/txns.ts +++ b/web/lib/firebase/txns.ts @@ -1,6 +1,6 @@ import { collection, query, where, orderBy } from 'firebase/firestore' import _ from 'lodash' -import { Txn } from '../../../common/txn' +import { Txn } from 'common/txn' import { db } from './init' import { getValues, listenForValues } from './utils' diff --git a/web/lib/firebase/users.ts b/web/lib/firebase/users.ts index 8b8523c6..594786ab 100644 --- a/web/lib/firebase/users.ts +++ b/web/lib/firebase/users.ts @@ -21,10 +21,10 @@ import { import _ from 'lodash' import { app } from './init' -import { PrivateUser, User } from '../../../common/user' +import { PrivateUser, User } from 'common/user' import { createUser } from './api-call' import { getValue, getValues, listenForValue, listenForValues } from './utils' -import { DAY_MS } from '../../../common/util/time' +import { DAY_MS } from 'common/util/time' import { Contract } from './contracts' import { Bet } from './bets' import { Comment } from './comments' diff --git a/web/lib/service/stripe.ts b/web/lib/service/stripe.ts index 6c093483..395f7093 100644 --- a/web/lib/service/stripe.ts +++ b/web/lib/service/stripe.ts @@ -1,4 +1,4 @@ -import { PROJECT_ID } from '../../../common/envs/constants' +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 3d646902..b9f0b72d 100644 --- a/web/pages/404.tsx +++ b/web/pages/404.tsx @@ -1,6 +1,6 @@ -import { IS_PRIVATE_MANIFOLD } from '../../common/envs/constants' -import { Page } from '../components/page' -import { Title } from '../components/title' +import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' +import { Page } from 'web/components/page' +import { Title } from 'web/components/title' export default function Custom404() { if (IS_PRIVATE_MANIFOLD) { diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index 34ed776a..96b5feee 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -1,39 +1,39 @@ import React, { useEffect, useState } from 'react' import { ArrowLeftIcon } from '@heroicons/react/outline' -import { useContractWithPreload } from '../../hooks/use-contract' -import { ContractOverview } from '../../components/contract/contract-overview' -import { BetPanel } from '../../components/bet-panel' -import { Col } from '../../components/layout/col' -import { useUser } from '../../hooks/use-user' -import { ResolutionPanel } from '../../components/resolution-panel' -import { Title } from '../../components/title' -import { Spacer } from '../../components/layout/spacer' -import { listUsers, User } from '../../lib/firebase/users' +import { useContractWithPreload } from 'web/hooks/use-contract' +import { ContractOverview } from 'web/components/contract/contract-overview' +import { BetPanel } from 'web/components/bet-panel' +import { Col } from 'web/components/layout/col' +import { useUser } from 'web/hooks/use-user' +import { ResolutionPanel } from 'web/components/resolution-panel' +import { Title } from 'web/components/title' +import { Spacer } from 'web/components/layout/spacer' +import { listUsers, User } from 'web/lib/firebase/users' import { Contract, getContractFromSlug, tradingAllowed, getBinaryProbPercent, -} from '../../lib/firebase/contracts' -import { SEO } from '../../components/SEO' -import { Page } from '../../components/page' -import { Bet, listAllBets } from '../../lib/firebase/bets' -import { Comment, listAllComments } from '../../lib/firebase/comments' +} from 'web/lib/firebase/contracts' +import { SEO } from 'web/components/SEO' +import { Page } from 'web/components/page' +import { Bet, listAllBets } from 'web/lib/firebase/bets' +import { Comment, listAllComments } from 'web/lib/firebase/comments' import Custom404 from '../404' -import { AnswersPanel } from '../../components/answers/answers-panel' -import { fromPropz, usePropz } from '../../hooks/use-propz' -import { Leaderboard } from '../../components/leaderboard' +import { AnswersPanel } from 'web/components/answers/answers-panel' +import { fromPropz, usePropz } from 'web/hooks/use-propz' +import { Leaderboard } from 'web/components/leaderboard' import _ from 'lodash' -import { resolvedPayout } from '../../../common/calculate' -import { formatMoney } from '../../../common/util/format' -import { FeedBet, FeedComment } from '../../components/feed/feed-items' -import { useUserById } from '../../hooks/use-users' -import { ContractTabs } from '../../components/contract/contract-tabs' -import { FirstArgument } from '../../../common/util/types' -import { DPM, FreeResponse, FullContract } from '../../../common/contract' -import { contractTextDetails } from '../../components/contract/contract-details' -import { useWindowSize } from '../../hooks/use-window-size' +import { resolvedPayout } from 'common/calculate' +import { formatMoney } from 'common/util/format' +import { FeedBet, FeedComment } from 'web/components/feed/feed-items' +import { useUserById } from 'web/hooks/use-users' +import { ContractTabs } from 'web/components/contract/contract-tabs' +import { FirstArgument } from 'common/util/types' +import { DPM, FreeResponse, FullContract } from 'common/contract' +import { contractTextDetails } from 'web/components/contract/contract-details' +import { useWindowSize } from 'web/hooks/use-window-size' import Confetti from 'react-confetti' export const getStaticProps = fromPropz(getStaticPropz) diff --git a/web/pages/[username]/index.tsx b/web/pages/[username]/index.tsx index e1e63260..cbc53235 100644 --- a/web/pages/[username]/index.tsx +++ b/web/pages/[username]/index.tsx @@ -1,9 +1,9 @@ import { useRouter } from 'next/router' import React, { useEffect, useState } from 'react' -import { getUserByUsername, User } from '../../lib/firebase/users' -import { UserPage } from '../../components/user-page' -import { useUser } from '../../hooks/use-user' +import { getUserByUsername, User } from 'web/lib/firebase/users' +import { UserPage } from 'web/components/user-page' +import { useUser } from 'web/hooks/use-user' import Custom404 from '../404' export default function UserProfile() { diff --git a/web/pages/_app.tsx b/web/pages/_app.tsx index 6a9c4414..1bf84c39 100644 --- a/web/pages/_app.tsx +++ b/web/pages/_app.tsx @@ -1,7 +1,7 @@ import 'tailwindcss/tailwind.css' import type { AppProps } from 'next/app' import Head from 'next/head' -import { usePreserveScroll } from '../hooks/use-preserve-scroll' +import { usePreserveScroll } from 'web/hooks/use-preserve-scroll' function MyApp({ Component, pageProps }: AppProps) { usePreserveScroll() diff --git a/web/pages/_document.tsx b/web/pages/_document.tsx index 18329b12..461103bd 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/envs/constants' +import { ENV_CONFIG } from 'common/envs/constants' export default function Document() { return ( diff --git a/web/pages/about.tsx b/web/pages/about.tsx index 3f0fcead..d2a1bee2 100644 --- a/web/pages/about.tsx +++ b/web/pages/about.tsx @@ -1,7 +1,7 @@ import { cloneElement } from 'react' -import { CREATOR_FEE } from '../../common/fees' -import { Page } from '../components/page' -import { SEO } from '../components/SEO' +import { CREATOR_FEE } from 'common/fees' +import { Page } from 'web/components/page' +import { SEO } from 'web/components/SEO' import styles from './about.module.css' export default function About() { diff --git a/web/pages/account.tsx b/web/pages/account.tsx index 194e3680..59d938c3 100644 --- a/web/pages/account.tsx +++ b/web/pages/account.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { Page } from '../components/page' -import { UserPage } from '../components/user-page' -import { useUser } from '../hooks/use-user' -import { firebaseLogin } from '../lib/firebase/users' +import { Page } from 'web/components/page' +import { UserPage } from 'web/components/user-page' +import { useUser } from 'web/hooks/use-user' +import { firebaseLogin } from 'web/lib/firebase/users' function SignInCard() { return ( diff --git a/web/pages/add-funds.tsx b/web/pages/add-funds.tsx index 0bf89a3d..9812695c 100644 --- a/web/pages/add-funds.tsx +++ b/web/pages/add-funds.tsx @@ -1,11 +1,11 @@ import { useState } from 'react' -import { Col } from '../components/layout/col' -import { SEO } from '../components/SEO' -import { Title } from '../components/title' -import { FundsSelector } from '../components/yes-no-selector' -import { useUser } from '../hooks/use-user' -import { checkoutURL } from '../lib/service/stripe' -import { Page } from '../components/page' +import { Col } from 'web/components/layout/col' +import { SEO } from 'web/components/SEO' +import { Title } from 'web/components/title' +import { FundsSelector } from 'web/components/yes-no-selector' +import { useUser } from 'web/hooks/use-user' +import { checkoutURL } from 'web/lib/service/stripe' +import { Page } from 'web/components/page' export default function AddFundsPage() { const user = useUser() diff --git a/web/pages/admin.tsx b/web/pages/admin.tsx index e71e1cf1..cea82e8b 100644 --- a/web/pages/admin.tsx +++ b/web/pages/admin.tsx @@ -1,14 +1,14 @@ -import { Page } from '../components/page' +import { Page } from 'web/components/page' import { Grid, _ as r } from 'gridjs-react' import 'gridjs/dist/theme/mermaid.css' import { html } from 'gridjs' import dayjs from 'dayjs' -import { usePrivateUsers, useUsers } from '../hooks/use-users' +import { usePrivateUsers, useUsers } from 'web/hooks/use-users' import Custom404 from './404' -import { useContracts } from '../hooks/use-contracts' +import { useContracts } from 'web/hooks/use-contracts' import _ from 'lodash' -import { useAdmin } from '../hooks/use-admin' -import { contractPath } from '../lib/firebase/contracts' +import { useAdmin } from 'web/hooks/use-admin' +import { contractPath } from 'web/lib/firebase/contracts' function avatarHtml(avatarUrl: string) { return ` diff --git a/web/pages/charity/index.tsx b/web/pages/charity/index.tsx index bd729571..a6444053 100644 --- a/web/pages/charity/index.tsx +++ b/web/pages/charity/index.tsx @@ -1,13 +1,13 @@ import _ from 'lodash' import { useState, useMemo } from 'react' -import { charities, Charity as CharityType } from '../../../common/charity' -import { CharityCard } from '../../components/charity/charity-card' -import { Col } from '../../components/layout/col' -import { Spacer } from '../../components/layout/spacer' -import { Page } from '../../components/page' -import { SiteLink } from '../../components/site-link' -import { Title } from '../../components/title' -import { getAllCharityTxns } from '../../lib/firebase/txns' +import { charities, Charity as CharityType } from 'common/charity' +import { CharityCard } from 'web/components/charity/charity-card' +import { Col } from 'web/components/layout/col' +import { Spacer } from 'web/components/layout/spacer' +import { Page } from 'web/components/page' +import { SiteLink } from 'web/components/site-link' +import { Title } from 'web/components/title' +import { getAllCharityTxns } from 'web/lib/firebase/txns' export async function getStaticProps() { const txns = await getAllCharityTxns() diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 9f4dae84..26d5e710 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -4,21 +4,21 @@ import clsx from 'clsx' import dayjs from 'dayjs' import Textarea from 'react-expanding-textarea' -import { Spacer } from '../components/layout/spacer' -import { useUser } from '../hooks/use-user' -import { Contract, contractPath } from '../lib/firebase/contracts' -import { createContract } from '../lib/firebase/api-call' -import { FIXED_ANTE, MINIMUM_ANTE } from '../../common/antes' -import { InfoTooltip } from '../components/info-tooltip' -import { Page } from '../components/page' -import { Title } from '../components/title' -import { ProbabilitySelector } from '../components/probability-selector' -import { parseWordsAsTags } from '../../common/util/parse' -import { TagsList } from '../components/tags-list' -import { Row } from '../components/layout/row' -import { MAX_DESCRIPTION_LENGTH, outcomeType } from '../../common/contract' -import { formatMoney } from '../../common/util/format' -import { useHasCreatedContractToday } from '../hooks/use-has-created-contract-today' +import { Spacer } from 'web/components/layout/spacer' +import { useUser } from 'web/hooks/use-user' +import { Contract, contractPath } from 'web/lib/firebase/contracts' +import { createContract } from 'web/lib/firebase/api-call' +import { FIXED_ANTE, MINIMUM_ANTE } from 'common/antes' +import { InfoTooltip } from 'web/components/info-tooltip' +import { Page } from 'web/components/page' +import { Title } from 'web/components/title' +import { ProbabilitySelector } from 'web/components/probability-selector' +import { parseWordsAsTags } from 'common/util/parse' +import { TagsList } from 'web/components/tags-list' +import { Row } from 'web/components/layout/row' +import { MAX_DESCRIPTION_LENGTH, outcomeType } from 'common/contract' +import { formatMoney } from 'common/util/format' +import { useHasCreatedContractToday } from 'web/hooks/use-has-created-contract-today' export default function Create() { const [question, setQuestion] = useState('') diff --git a/web/pages/embed/[username]/[contractSlug].tsx b/web/pages/embed/[username]/[contractSlug].tsx index 11b47149..7792a633 100644 --- a/web/pages/embed/[username]/[contractSlug].tsx +++ b/web/pages/embed/[username]/[contractSlug].tsx @@ -1,32 +1,24 @@ -import { Bet } from '../../../../common/bet' -import { - Contract, - DPM, - FreeResponse, - FullContract, -} from '../../../../common/contract' -import { DOMAIN } from '../../../../common/envs/constants' -import { AnswersGraph } from '../../../components/answers/answers-graph' +import { Bet } from 'common/bet' +import { Contract, DPM, FreeResponse, FullContract } from 'common/contract' +import { DOMAIN } from 'common/envs/constants' +import { AnswersGraph } from 'web/components/answers/answers-graph' import { BinaryResolutionOrChance, FreeResponseResolutionOrChance, -} from '../../../components/contract/contract-card' -import { ContractDetails } from '../../../components/contract/contract-details' -import { ContractProbGraph } from '../../../components/contract/contract-prob-graph' -import { Col } from '../../../components/layout/col' -import { Row } from '../../../components/layout/row' -import { Spacer } from '../../../components/layout/spacer' -import { Linkify } from '../../../components/linkify' -import { SiteLink } from '../../../components/site-link' -import { useContractWithPreload } from '../../../hooks/use-contract' -import { useMeasureSize } from '../../../hooks/use-measure-size' -import { fromPropz, usePropz } from '../../../hooks/use-propz' -import { useWindowSize } from '../../../hooks/use-window-size' -import { listAllBets } from '../../../lib/firebase/bets' -import { - contractPath, - getContractFromSlug, -} from '../../../lib/firebase/contracts' +} from 'web/components/contract/contract-card' +import { ContractDetails } from 'web/components/contract/contract-details' +import { ContractProbGraph } from 'web/components/contract/contract-prob-graph' +import { Col } from 'web/components/layout/col' +import { Row } from 'web/components/layout/row' +import { Spacer } from 'web/components/layout/spacer' +import { Linkify } from 'web/components/linkify' +import { SiteLink } from 'web/components/site-link' +import { useContractWithPreload } from 'web/hooks/use-contract' +import { useMeasureSize } from 'web/hooks/use-measure-size' +import { fromPropz, usePropz } from 'web/hooks/use-propz' +import { useWindowSize } from 'web/hooks/use-window-size' +import { listAllBets } from 'web/lib/firebase/bets' +import { contractPath, getContractFromSlug } from 'web/lib/firebase/contracts' import Custom404 from '../../404' export const getStaticProps = fromPropz(getStaticPropz) diff --git a/web/pages/embed/analytics.tsx b/web/pages/embed/analytics.tsx index 1441e39e..8ba2951a 100644 --- a/web/pages/embed/analytics.tsx +++ b/web/pages/embed/analytics.tsx @@ -1,7 +1,7 @@ -import { FirstArgument } from '../../../common/util/types' -import { Col } from '../../components/layout/col' -import { Spacer } from '../../components/layout/spacer' -import { fromPropz } from '../../hooks/use-propz' +import { FirstArgument } from 'common/util/types' +import { Col } from 'web/components/layout/col' +import { Spacer } from 'web/components/layout/spacer' +import { fromPropz } from 'web/hooks/use-propz' import Analytics, { CustomAnalytics, FirebaseAnalytics, @@ -12,7 +12,7 @@ export const getStaticProps = fromPropz(getStaticPropz) export default function AnalyticsEmbed(props: FirstArgument) { return ( - + diff --git a/web/pages/fold/[...slugs]/index.tsx b/web/pages/fold/[...slugs]/index.tsx index b0d52793..4101bbeb 100644 --- a/web/pages/fold/[...slugs]/index.tsx +++ b/web/pages/fold/[...slugs]/index.tsx @@ -1,40 +1,40 @@ import _ from 'lodash' -import { Fold } from '../../../../common/fold' -import { Comment } from '../../../../common/comment' -import { Page } from '../../../components/page' -import { Title } from '../../../components/title' -import { Bet, listAllBets } from '../../../lib/firebase/bets' -import { Contract } from '../../../lib/firebase/contracts' +import { Fold } from 'common/fold' +import { Comment } from 'common/comment' +import { Page } from 'web/components/page' +import { Title } from 'web/components/title' +import { Bet, listAllBets } from 'web/lib/firebase/bets' +import { Contract } from 'web/lib/firebase/contracts' import { foldPath, getFoldBySlug, getFoldContracts, -} from '../../../lib/firebase/folds' -import { ActivityFeed } from '../../../components/feed/activity-feed' -import { TagsList } from '../../../components/tags-list' -import { Row } from '../../../components/layout/row' -import { UserLink } from '../../../components/user-page' -import { getUser, User } from '../../../lib/firebase/users' -import { Spacer } from '../../../components/layout/spacer' -import { Col } from '../../../components/layout/col' -import { useUser } from '../../../hooks/use-user' -import { useFold } from '../../../hooks/use-fold' -import { SearchableGrid } from '../../../components/contract/contracts-list' +} from 'web/lib/firebase/folds' +import { ActivityFeed } from 'web/components/feed/activity-feed' +import { TagsList } from 'web/components/tags-list' +import { Row } from 'web/components/layout/row' +import { UserLink } from 'web/components/user-page' +import { getUser, User } from 'web/lib/firebase/users' +import { Spacer } from 'web/components/layout/spacer' +import { Col } from 'web/components/layout/col' +import { useUser } from 'web/hooks/use-user' +import { useFold } from 'web/hooks/use-fold' +import { SearchableGrid } from 'web/components/contract/contracts-list' import { useRouter } from 'next/router' -import { scoreCreators, scoreTraders } from '../../../../common/scoring' -import { Leaderboard } from '../../../components/leaderboard' -import { formatMoney } from '../../../../common/util/format' -import { EditFoldButton } from '../../../components/folds/edit-fold-button' +import { scoreCreators, scoreTraders } from 'common/scoring' +import { Leaderboard } from 'web/components/leaderboard' +import { formatMoney } from 'common/util/format' +import { EditFoldButton } from 'web/components/folds/edit-fold-button' import Custom404 from '../../404' -import { FollowFoldButton } from '../../../components/folds/follow-fold-button' -import { SEO } from '../../../components/SEO' -import { useTaggedContracts } from '../../../hooks/use-contracts' -import { Linkify } from '../../../components/linkify' -import { fromPropz, usePropz } from '../../../hooks/use-propz' -import { filterDefined } from '../../../../common/util/array' -import { findActiveContracts } from '../../../components/feed/find-active-contracts' -import { Tabs } from '../../../components/layout/tabs' +import { FollowFoldButton } from 'web/components/folds/follow-fold-button' +import { SEO } from 'web/components/SEO' +import { useTaggedContracts } from 'web/hooks/use-contracts' +import { Linkify } from 'web/components/linkify' +import { fromPropz, usePropz } from 'web/hooks/use-propz' +import { filterDefined } from 'common/util/array' +import { findActiveContracts } from 'web/components/feed/find-active-contracts' +import { Tabs } from 'web/components/layout/tabs' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz(props: { params: { slugs: string[] } }) { diff --git a/web/pages/folds.tsx b/web/pages/folds.tsx index 4b4b8892..655b5309 100644 --- a/web/pages/folds.tsx +++ b/web/pages/folds.tsx @@ -1,19 +1,19 @@ import _ from 'lodash' import Link from 'next/link' import { useEffect, useState } from 'react' -import { Fold } from '../../common/fold' -import { CreateFoldButton } from '../components/folds/create-fold-button' -import { FollowFoldButton } from '../components/folds/follow-fold-button' -import { Col } from '../components/layout/col' -import { Row } from '../components/layout/row' -import { Page } from '../components/page' -import { TagsList } from '../components/tags-list' -import { Title } from '../components/title' -import { UserLink } from '../components/user-page' -import { useFolds, useFollowedFoldIds } from '../hooks/use-fold' -import { useUser } from '../hooks/use-user' -import { foldPath, listAllFolds } from '../lib/firebase/folds' -import { getUser, User } from '../lib/firebase/users' +import { Fold } from 'common/fold' +import { CreateFoldButton } from 'web/components/folds/create-fold-button' +import { FollowFoldButton } from 'web/components/folds/follow-fold-button' +import { Col } from 'web/components/layout/col' +import { Row } from 'web/components/layout/row' +import { Page } from 'web/components/page' +import { TagsList } from 'web/components/tags-list' +import { Title } from 'web/components/title' +import { UserLink } from 'web/components/user-page' +import { useFolds, useFollowedFoldIds } from 'web/hooks/use-fold' +import { useUser } from 'web/hooks/use-user' +import { foldPath, listAllFolds } from 'web/lib/firebase/folds' +import { getUser, User } from 'web/lib/firebase/users' export async function getStaticProps() { const folds = await listAllFolds().catch((_) => []) diff --git a/web/pages/home.tsx b/web/pages/home.tsx index 6f1ec93c..f4dbc319 100644 --- a/web/pages/home.tsx +++ b/web/pages/home.tsx @@ -2,14 +2,14 @@ import React, { useEffect } from 'react' import Router, { useRouter } from 'next/router' import _ from 'lodash' -import { Page } from '../components/page' -import { ActivityFeed } from '../components/feed/activity-feed' -import FeedCreate from '../components/feed-create' -import { Spacer } from '../components/layout/spacer' -import { Col } from '../components/layout/col' -import { useUser } from '../hooks/use-user' -import { LoadingIndicator } from '../components/loading-indicator' -import { useAlgoFeed } from '../hooks/use-algo-feed' +import { Page } from 'web/components/page' +import { ActivityFeed } from 'web/components/feed/activity-feed' +import FeedCreate from 'web/components/feed-create' +import { Spacer } from 'web/components/layout/spacer' +import { Col } from 'web/components/layout/col' +import { useUser } from 'web/hooks/use-user' +import { LoadingIndicator } from 'web/components/loading-indicator' +import { useAlgoFeed } from 'web/hooks/use-algo-feed' import { ContractPageContent } from './[username]/[contractSlug]' const Home = () => { diff --git a/web/pages/index.tsx b/web/pages/index.tsx index eb954f3c..d20da939 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -1,12 +1,12 @@ import React from 'react' import Router from 'next/router' -import { Contract, getContractsBySlugs } from '../lib/firebase/contracts' -import { Page } from '../components/page' -import { FeedPromo } from '../components/feed-create' -import { Col } from '../components/layout/col' -import { useUser } from '../hooks/use-user' -import { ManifoldLogo } from '../components/nav/manifold-logo' +import { Contract, getContractsBySlugs } from 'web/lib/firebase/contracts' +import { Page } from 'web/components/page' +import { FeedPromo } from 'web/components/feed-create' +import { Col } from 'web/components/layout/col' +import { useUser } from 'web/hooks/use-user' +import { ManifoldLogo } from 'web/components/nav/manifold-logo' export async function getStaticProps() { const hotContracts = await getContractsBySlugs([ diff --git a/web/pages/landing-page.tsx b/web/pages/landing-page.tsx index 7bf01fa9..507e67dd 100644 --- a/web/pages/landing-page.tsx +++ b/web/pages/landing-page.tsx @@ -7,11 +7,11 @@ import { ArrowDownIcon, } from '@heroicons/react/outline' -import { firebaseLogin } from '../lib/firebase/users' -import { ContractsGrid } from '../components/contract/contracts-list' -import { Col } from '../components/layout/col' +import { firebaseLogin } from 'web/lib/firebase/users' +import { ContractsGrid } from 'web/components/contract/contracts-list' +import { Col } from 'web/components/layout/col' import Link from 'next/link' -import { Contract } from '../lib/firebase/contracts' +import { Contract } from 'web/lib/firebase/contracts' export default function LandingPage(props: { hotContracts: Contract[] }) { const { hotContracts } = props diff --git a/web/pages/leaderboards.tsx b/web/pages/leaderboards.tsx index 38e31cd5..32fc3ad7 100644 --- a/web/pages/leaderboards.tsx +++ b/web/pages/leaderboards.tsx @@ -1,11 +1,11 @@ import _ from 'lodash' -import { Col } from '../components/layout/col' -import { Leaderboard } from '../components/leaderboard' -import { Page } from '../components/page' -import { getTopCreators, getTopTraders, User } from '../lib/firebase/users' -import { formatMoney } from '../../common/util/format' -import { fromPropz, usePropz } from '../hooks/use-propz' +import { Col } from 'web/components/layout/col' +import { Leaderboard } from 'web/components/leaderboard' +import { Page } from 'web/components/page' +import { getTopCreators, getTopTraders, User } from 'web/lib/firebase/users' +import { formatMoney } from 'common/util/format' +import { fromPropz, usePropz } from 'web/hooks/use-propz' export const getStaticProps = fromPropz(getStaticPropz) export async function getStaticPropz() { diff --git a/web/pages/make-predictions.tsx b/web/pages/make-predictions.tsx index fa7ef5c7..54929bd7 100644 --- a/web/pages/make-predictions.tsx +++ b/web/pages/make-predictions.tsx @@ -4,20 +4,20 @@ import Link from 'next/link' import { useState } from 'react' import Textarea from 'react-expanding-textarea' -import { getProbability } from '../../common/calculate' -import { Binary, CPMM, DPM, FullContract } from '../../common/contract' -import { parseWordsAsTags } from '../../common/util/parse' -import { BuyAmountInput } from '../components/amount-input' -import { InfoTooltip } from '../components/info-tooltip' -import { Col } from '../components/layout/col' -import { Row } from '../components/layout/row' -import { Spacer } from '../components/layout/spacer' -import { Linkify } from '../components/linkify' -import { Page } from '../components/page' -import { Title } from '../components/title' -import { useUser } from '../hooks/use-user' -import { createContract } from '../lib/firebase/api-call' -import { contractPath } from '../lib/firebase/contracts' +import { getProbability } from 'common/calculate' +import { Binary, CPMM, DPM, FullContract } from 'common/contract' +import { parseWordsAsTags } from 'common/util/parse' +import { BuyAmountInput } from 'web/components/amount-input' +import { InfoTooltip } from 'web/components/info-tooltip' +import { Col } from 'web/components/layout/col' +import { Row } from 'web/components/layout/row' +import { Spacer } from 'web/components/layout/spacer' +import { Linkify } from 'web/components/linkify' +import { Page } from 'web/components/page' +import { Title } from 'web/components/title' +import { useUser } from 'web/hooks/use-user' +import { createContract } from 'web/lib/firebase/api-call' +import { contractPath } from 'web/lib/firebase/contracts' type Prediction = { question: string diff --git a/web/pages/markets.tsx b/web/pages/markets.tsx index 23ff2adf..b745b8e4 100644 --- a/web/pages/markets.tsx +++ b/web/pages/markets.tsx @@ -1,12 +1,12 @@ import { ContractsGrid, SearchableGrid, -} from '../components/contract/contracts-list' -import { Page } from '../components/page' -import { SEO } from '../components/SEO' -import { Title } from '../components/title' -import { useContracts } from '../hooks/use-contracts' -import { Contract } from '../lib/firebase/contracts' +} from 'web/components/contract/contracts-list' +import { Page } from 'web/components/page' +import { SEO } from 'web/components/SEO' +import { Title } from 'web/components/title' +import { useContracts } from 'web/hooks/use-contracts' +import { Contract } from 'web/lib/firebase/contracts' // TODO: Rename endpoint to "Explore" export default function Markets() { diff --git a/web/pages/portfolio.tsx b/web/pages/portfolio.tsx index 99bb7a0a..8b1f07ad 100644 --- a/web/pages/portfolio.tsx +++ b/web/pages/portfolio.tsx @@ -1,11 +1,11 @@ import Router from 'next/router' import { useEffect } from 'react' -import { BetsList } from '../components/bets-list' -import { Page } from '../components/page' -import { SEO } from '../components/SEO' -import { Title } from '../components/title' -import { useUser } from '../hooks/use-user' +import { BetsList } from 'web/components/bets-list' +import { Page } from 'web/components/page' +import { SEO } from 'web/components/SEO' +import { Title } from 'web/components/title' +import { useUser } from 'web/hooks/use-user' export default function PortfolioPage() { const user = useUser() diff --git a/web/pages/profile.tsx b/web/pages/profile.tsx index f637a4f2..2fab545b 100644 --- a/web/pages/profile.tsx +++ b/web/pages/profile.tsx @@ -2,24 +2,21 @@ import { useEffect, useState } from 'react' import { PencilIcon } from '@heroicons/react/outline' import Router from 'next/router' -import { AddFundsButton } from '../components/add-funds-button' -import { Page } from '../components/page' -import { SEO } from '../components/SEO' -import { Title } from '../components/title' -import { usePrivateUser, useUser } from '../hooks/use-user' -import { formatMoney } from '../../common/util/format' -import { - cleanDisplayName, - cleanUsername, -} from '../../common/util/clean-username' -import { changeUserInfo } from '../lib/firebase/api-call' -import { uploadImage } from '../lib/firebase/storage' -import { Col } from '../components/layout/col' -import { Row } from '../components/layout/row' -import { User } from '../../common/user' -import { updateUser } from '../lib/firebase/users' -import { defaultBannerUrl } from '../components/user-page' -import { SiteLink } from '../components/site-link' +import { AddFundsButton } from 'web/components/add-funds-button' +import { Page } from 'web/components/page' +import { SEO } from 'web/components/SEO' +import { Title } from 'web/components/title' +import { usePrivateUser, useUser } from 'web/hooks/use-user' +import { formatMoney } from 'common/util/format' +import { cleanDisplayName, cleanUsername } from 'common/util/clean-username' +import { changeUserInfo } from 'web/lib/firebase/api-call' +import { uploadImage } from 'web/lib/firebase/storage' +import { Col } from 'web/components/layout/col' +import { Row } from 'web/components/layout/row' +import { User } from 'common/user' +import { updateUser } from 'web/lib/firebase/users' +import { defaultBannerUrl } from 'web/components/user-page' +import { SiteLink } from 'web/components/site-link' import Textarea from 'react-expanding-textarea' function EditUserField(props: { diff --git a/web/pages/server-sitemap.xml.tsx b/web/pages/server-sitemap.xml.tsx index 9a3cdfe8..d837b26e 100644 --- a/web/pages/server-sitemap.xml.tsx +++ b/web/pages/server-sitemap.xml.tsx @@ -2,7 +2,7 @@ import _ from 'lodash' import { GetServerSideProps } from 'next' import { getServerSideSitemap, ISitemapField } from 'next-sitemap' -import { DOMAIN } from '../../common/envs/constants' +import { DOMAIN } from 'common/envs/constants' import { LiteMarket } from './api/v0/_types' export const getServerSideProps: GetServerSideProps = async (ctx) => { diff --git a/web/pages/simulator.tsx b/web/pages/simulator.tsx index 7c48302e..bbf7408e 100644 --- a/web/pages/simulator.tsx +++ b/web/pages/simulator.tsx @@ -2,8 +2,8 @@ import React, { useMemo, useState } from 'react' import { DatumValue } from '@nivo/core' import { ResponsiveLine } from '@nivo/line' -import { Entry, makeEntries } from '../lib/simulator/entries' -import { Col } from '../components/layout/col' +import { Entry, makeEntries } from 'web/lib/simulator/entries' +import { Col } from 'web/components/layout/col' function TableBody(props: { entries: Entry[] }) { return ( diff --git a/web/pages/tag/[tag].tsx b/web/pages/tag/[tag].tsx index cabc6c80..c1d4d01f 100644 --- a/web/pages/tag/[tag].tsx +++ b/web/pages/tag/[tag].tsx @@ -1,12 +1,12 @@ import { useEffect, useState } from 'react' import { useRouter } from 'next/router' -import { SearchableGrid } from '../../components/contract/contracts-list' -import { Page } from '../../components/page' -import { Title } from '../../components/title' +import { SearchableGrid } from 'web/components/contract/contracts-list' +import { Page } from 'web/components/page' +import { Title } from 'web/components/title' import { Contract, listTaggedContractsCaseInsensitive, -} from '../../lib/firebase/contracts' +} from 'web/lib/firebase/contracts' export default function TagPage() { const router = useRouter() diff --git a/web/pages/trades.tsx b/web/pages/trades.tsx index 906b631d..55a08bc6 100644 --- a/web/pages/trades.tsx +++ b/web/pages/trades.tsx @@ -1,7 +1,7 @@ import Router from 'next/router' import { useEffect } from 'react' -import { useUser } from '../hooks/use-user' +import { useUser } from 'web/hooks/use-user' // Deprecated: redirects to /portfolio. // Eventually, this will be removed.