Add pubsub to dev.sh, show heart on FR, remove from answer trigger
This commit is contained in:
parent
653515ff87
commit
3ae12b7583
2
dev.sh
2
dev.sh
|
@ -24,7 +24,7 @@ then
|
||||||
npx concurrently \
|
npx concurrently \
|
||||||
-n FIRESTORE,FUNCTIONS,NEXT,TS \
|
-n FIRESTORE,FUNCTIONS,NEXT,TS \
|
||||||
-c green,white,magenta,cyan \
|
-c green,white,magenta,cyan \
|
||||||
"yarn --cwd=functions firestore" \
|
"yarn --cwd=functions localDbScript" \
|
||||||
"cross-env FIRESTORE_EMULATOR_HOST=localhost:8080 yarn --cwd=functions dev" \
|
"cross-env FIRESTORE_EMULATOR_HOST=localhost:8080 yarn --cwd=functions dev" \
|
||||||
"cross-env NEXT_PUBLIC_FUNCTIONS_URL=http://localhost:8088 \
|
"cross-env NEXT_PUBLIC_FUNCTIONS_URL=http://localhost:8088 \
|
||||||
NEXT_PUBLIC_FIREBASE_EMULATE=TRUE \
|
NEXT_PUBLIC_FIREBASE_EMULATE=TRUE \
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"deploy": "firebase deploy --only functions",
|
"deploy": "firebase deploy --only functions",
|
||||||
"logs": "firebase functions:log",
|
"logs": "firebase functions:log",
|
||||||
"dev": "nodemon src/serve.ts",
|
"dev": "nodemon src/serve.ts",
|
||||||
"firestore": "firebase emulators:start --only firestore --import=./firestore_export",
|
"localDbScript": "firebase emulators:start --only functions,firestore,pubsub --import=./firestore_export",
|
||||||
"serve": "firebase use dev && yarn build && firebase emulators:start --only functions,firestore,pubsub --import=./firestore_export",
|
"serve": "firebase use dev && yarn build && firebase emulators:start --only functions,firestore,pubsub --import=./firestore_export",
|
||||||
"db:update-local-from-remote": "yarn db:backup-remote && gsutil rsync -r gs://$npm_package_config_firestore/firestore_export ./firestore_export",
|
"db:update-local-from-remote": "yarn db:backup-remote && gsutil rsync -r gs://$npm_package_config_firestore/firestore_export ./firestore_export",
|
||||||
"db:backup-local": "firebase emulators:export --force ./firestore_export",
|
"db:backup-local": "firebase emulators:export --force ./firestore_export",
|
||||||
|
|
|
@ -2,7 +2,6 @@ import * as functions from 'firebase-functions'
|
||||||
import { getContract, getUser } from './utils'
|
import { getContract, getUser } from './utils'
|
||||||
import { createCommentOrAnswerOrUpdatedContractNotification } from './create-notification'
|
import { createCommentOrAnswerOrUpdatedContractNotification } from './create-notification'
|
||||||
import { Answer } from '../../common/answer'
|
import { Answer } from '../../common/answer'
|
||||||
import { addUserToContractFollowers } from './follow-market'
|
|
||||||
|
|
||||||
export const onCreateAnswer = functions.firestore
|
export const onCreateAnswer = functions.firestore
|
||||||
.document('contracts/{contractId}/answers/{answerNumber}')
|
.document('contracts/{contractId}/answers/{answerNumber}')
|
||||||
|
@ -21,7 +20,6 @@ export const onCreateAnswer = functions.firestore
|
||||||
|
|
||||||
const answerCreator = await getUser(answer.userId)
|
const answerCreator = await getUser(answer.userId)
|
||||||
if (!answerCreator) throw new Error('Could not find answer creator')
|
if (!answerCreator) throw new Error('Could not find answer creator')
|
||||||
await addUserToContractFollowers(contract.id, answerCreator.id)
|
|
||||||
await createCommentOrAnswerOrUpdatedContractNotification(
|
await createCommentOrAnswerOrUpdatedContractNotification(
|
||||||
answer.id,
|
answer.id,
|
||||||
'answer',
|
'answer',
|
||||||
|
|
|
@ -45,6 +45,13 @@ export const ContractOverview = (props: {
|
||||||
<div className="text-2xl text-indigo-700 md:text-3xl">
|
<div className="text-2xl text-indigo-700 md:text-3xl">
|
||||||
<Linkify text={question} />
|
<Linkify text={question} />
|
||||||
</div>
|
</div>
|
||||||
|
{(outcomeType === 'FREE_RESPONSE' ||
|
||||||
|
outcomeType === 'MULTIPLE_CHOICE') &&
|
||||||
|
!resolution && (
|
||||||
|
<div className={'xl:hidden'}>
|
||||||
|
<FollowMarketButton contract={contract} user={user} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<Row className={'hidden gap-3 xl:flex'}>
|
<Row className={'hidden gap-3 xl:flex'}>
|
||||||
<FollowMarketButton contract={contract} user={user} />
|
<FollowMarketButton contract={contract} user={user} />
|
||||||
|
|
||||||
|
@ -85,12 +92,10 @@ export const ContractOverview = (props: {
|
||||||
) : isPseudoNumeric ? (
|
) : isPseudoNumeric ? (
|
||||||
<Row className="items-center justify-between gap-4 xl:hidden">
|
<Row className="items-center justify-between gap-4 xl:hidden">
|
||||||
<PseudoNumericResolutionOrExpectation contract={contract} />
|
<PseudoNumericResolutionOrExpectation contract={contract} />
|
||||||
|
<Row className={'items-start gap-2'}>
|
||||||
|
<FollowMarketButton contract={contract} user={user} />
|
||||||
{tradingAllowed(contract) && <BetButton contract={contract} />}
|
{tradingAllowed(contract) && <BetButton contract={contract} />}
|
||||||
</Row>
|
</Row>
|
||||||
) : isPseudoNumeric ? (
|
|
||||||
<Row className="items-center justify-between gap-4 xl:hidden">
|
|
||||||
<PseudoNumericResolutionOrExpectation contract={contract} />
|
|
||||||
{tradingAllowed(contract) && <BetButton contract={contract} />}
|
|
||||||
</Row>
|
</Row>
|
||||||
) : (
|
) : (
|
||||||
(outcomeType === 'FREE_RESPONSE' ||
|
(outcomeType === 'FREE_RESPONSE' ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user