Compare commits

...

11 Commits

Author SHA1 Message Date
James Grugett
fbb185d7a0 Merge branch 'main' into hanania 2022-07-14 22:21:08 -05:00
James Grugett
42c1f7fe25 Add leaderboard to top nav 2022-06-27 11:08:09 -05:00
James Grugett
6a8887cbfb Apply tag and creatorId filters to contract firestore search 2022-06-24 12:08:06 -05:00
James Grugett
80ea611ba8 Only RichardHanania can create markets 2022-06-24 12:00:21 -05:00
Austin Chen
84b2dc8fbd Merge branch 'main' into hanania 2022-06-22 19:03:06 -05:00
Austin Chen
6f4f9e0066 Update cloud function endpoints 2022-06-22 18:59:01 -05:00
Austin Chen
fb4bfe6244 Merge branch 'main' into hanania 2022-06-22 18:51:56 -05:00
Austin Chen
4f83aa769b Remove analytics.tsx 2022-06-22 18:32:41 -05:00
Austin Chen
3ac66947b8 Add dev script 2022-06-22 18:27:29 -05:00
Austin Chen
135f2a3e7e Update indexes 2022-06-22 18:22:07 -05:00
Austin Chen
dcb81974e6 Set up an custom instance for Richard Hanania 2022-06-22 18:14:21 -05:00
7 changed files with 73 additions and 56 deletions

View File

@ -1,5 +1,6 @@
import { escapeRegExp } from 'lodash' import { escapeRegExp } from 'lodash'
import { DEV_CONFIG } from './dev' import { DEV_CONFIG } from './dev'
import { HANANIA_CONFIG } from './hanania'
import { EnvConfig, PROD_CONFIG } from './prod' import { EnvConfig, PROD_CONFIG } from './prod'
import { THEOREMONE_CONFIG } from './theoremone' import { THEOREMONE_CONFIG } from './theoremone'
@ -9,6 +10,7 @@ const CONFIGS: { [env: string]: EnvConfig } = {
PROD: PROD_CONFIG, PROD: PROD_CONFIG,
DEV: DEV_CONFIG, DEV: DEV_CONFIG,
THEOREMONE: THEOREMONE_CONFIG, THEOREMONE: THEOREMONE_CONFIG,
HANANIA: HANANIA_CONFIG,
} }
export const ENV_CONFIG = CONFIGS[ENV] export const ENV_CONFIG = CONFIGS[ENV]

21
common/envs/hanania.ts Normal file
View File

@ -0,0 +1,21 @@
import { EnvConfig, PROD_CONFIG } from './prod'
export const HANANIA_CONFIG: EnvConfig = {
domain: 'hanania.manifold.markets',
firebaseConfig: {
apiKey: 'AIzaSyC1F3kAXZ0V0RM0Cg-xFwQn8pbOWFFDBYY',
authDomain: 'hanania-manifold.firebaseapp.com',
projectId: 'hanania-manifold',
storageBucket: 'hanania-manifold.appspot.com',
messagingSenderId: '319008991675',
appId: '1:319008991675:web:d2dc5e72b95cdcec96fc9e',
measurementId: 'G-VCXVKYGKTC',
},
cloudRunId: '45jazbrfja', // TODO: fill in real ID for T1
cloudRunRegion: 'uc',
adminEmails: [...PROD_CONFIG.adminEmails],
whitelistEmail: '',
moneyMoniker: 'H$',
visibility: 'PRIVATE',
newQuestionPlaceholders: [],
}

View File

@ -13,7 +13,7 @@ import clsx from 'clsx'
import Link from 'next/link' import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import { usePrivateUser, useUser } from 'web/hooks/use-user' import { usePrivateUser, useUser } from 'web/hooks/use-user'
import { firebaseLogout, User } from 'web/lib/firebase/users' import { firebaseLogin, firebaseLogout, User } from 'web/lib/firebase/users'
import { ManifoldLogo } from './manifold-logo' import { ManifoldLogo } from './manifold-logo'
import { MenuButton } from './menu' import { MenuButton } from './menu'
import { ProfileSummary } from './profile-menu' import { ProfileSummary } from './profile-menu'
@ -41,16 +41,33 @@ function getNavigation() {
}, },
...(IS_PRIVATE_MANIFOLD ...(IS_PRIVATE_MANIFOLD
? [] ? [
{
name: 'Leaderboards',
href: '/leaderboards',
icon: TrendingUpIcon,
},
]
: [{ name: 'Get M$', href: '/add-funds', icon: CashIcon }]), : [{ name: 'Get M$', href: '/add-funds', icon: CashIcon }]),
] ]
} }
function getMoreNavigation(user?: User | null) { function getMoreNavigation(user?: User | null) {
if (IS_PRIVATE_MANIFOLD) { if (IS_PRIVATE_MANIFOLD) {
return [{ name: 'Leaderboards', href: '/leaderboards' }] return [
user
? {
name: 'Sign out',
href: '#',
onClick: withTracking(firebaseLogout, 'sign out'),
}
: {
name: 'Sign in',
href: '#',
onClick: withTracking(firebaseLogin, 'sign in'),
},
]
} }
if (!user) { if (!user) {
return [ return [
{ name: 'Leaderboards', href: '/leaderboards' }, { name: 'Leaderboards', href: '/leaderboards' },
@ -62,7 +79,6 @@ function getMoreNavigation(user?: User | null) {
} }
return [ return [
{ name: 'Send M$', href: '/links' },
{ name: 'Leaderboards', href: '/leaderboards' }, { name: 'Leaderboards', href: '/leaderboards' },
{ name: 'Charity', href: '/charity' }, { name: 'Charity', href: '/charity' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' }, { name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
@ -92,9 +108,7 @@ const signedOutMobileNavigation = [
href: 'https://docs.manifold.markets/$how-to', href: 'https://docs.manifold.markets/$how-to',
icon: BookOpenIcon, icon: BookOpenIcon,
}, },
{ name: 'Charity', href: '/charity', icon: HeartIcon },
{ name: 'Leaderboards', href: '/leaderboards', icon: TrendingUpIcon }, { name: 'Leaderboards', href: '/leaderboards', icon: TrendingUpIcon },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh', icon: ChatIcon },
] ]
const signedInMobileNavigation = [ const signedInMobileNavigation = [
@ -110,9 +124,6 @@ const signedInMobileNavigation = [
function getMoreMobileNav() { function getMoreMobileNav() {
return [ return [
{ name: 'Send M$', href: '/links' },
{ name: 'Charity', href: '/charity' },
{ name: 'Discord', href: 'https://discord.gg/eHQBNBqXuh' },
{ name: 'Leaderboards', href: '/leaderboards' }, { name: 'Leaderboards', href: '/leaderboards' },
{ {
name: 'Sign out', name: 'Sign out',
@ -204,7 +215,9 @@ export default function Sidebar(props: { className?: string }) {
<nav aria-label="Sidebar" className={className}> <nav aria-label="Sidebar" className={className}>
<ManifoldLogo className="py-6" twoLine /> <ManifoldLogo className="py-6" twoLine />
{user?.username === 'RichardHanania' && (
<CreateQuestionButton user={user} /> <CreateQuestionButton user={user} />
)}
<Spacer h={4} /> <Spacer h={4} />
{user && ( {user && (
<div className="w-full" style={{ minHeight: 80 }}> <div className="w-full" style={{ minHeight: 80 }}>
@ -243,6 +256,7 @@ export default function Sidebar(props: { className?: string }) {
menuItems={getMoreNavigation(user)} menuItems={getMoreNavigation(user)}
buttonContent={<MoreButton />} buttonContent={<MoreButton />}
/> />
</div>
{/* Spacer if there are any groups */} {/* Spacer if there are any groups */}
{memberItems.length > 0 && ( {memberItems.length > 0 && (
@ -257,7 +271,6 @@ export default function Sidebar(props: { className?: string }) {
privateUser={privateUser} privateUser={privateUser}
/> />
)} )}
</div>
</nav> </nav>
) )
} }

View File

@ -7,6 +7,7 @@
"devdev": "cross-env NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=DEV next dev -p 3000\" \"cross-env FIREBASE_ENV=DEV yarn ts --watch\"", "devdev": "cross-env NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=DEV next dev -p 3000\" \"cross-env FIREBASE_ENV=DEV yarn ts --watch\"",
"dev:dev": "yarn devdev", "dev:dev": "yarn devdev",
"dev:the": "cross-env NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"cross-env FIREBASE_ENV=THEOREMONE yarn ts --watch\"", "dev:the": "cross-env NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"cross-env FIREBASE_ENV=THEOREMONE yarn ts --watch\"",
"dev:han": "cross-env NEXT_PUBLIC_FIREBASE_ENV=HANANIA concurrently -n NEXT,TS -c magenta,cyan \"cross-env FIREBASE_ENV=HANANIA next dev -p 3000\" \"cross-env FIREBASE_ENV=HANANIA yarn ts --watch\"",
"dev:emulate": "cross-env NEXT_PUBLIC_FIREBASE_EMULATE=TRUE yarn devdev", "dev:emulate": "cross-env NEXT_PUBLIC_FIREBASE_EMULATE=TRUE yarn devdev",
"ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty", "ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty",
"build": "next build", "build": "next build",

View File

@ -57,6 +57,7 @@ export default function Create() {
const creator = useUser() const creator = useUser()
useEffect(() => { useEffect(() => {
if (creator === null) router.push('/') if (creator === null) router.push('/')
if (creator && creator.username !== 'RichardHanania') router.push('/')
}, [creator, router]) }, [creator, router])
if (!router.isReady || !creator) return <div /> if (!router.isReady || !creator) return <div />

View File

@ -1,23 +0,0 @@
import { useState, useEffect } from 'react'
import { Col } from 'web/components/layout/col'
import { Spacer } from 'web/components/layout/spacer'
import { CustomAnalytics, FirebaseAnalytics } from '../stats'
import { getStats } from 'web/lib/firebase/stats'
import { Stats } from 'common/stats'
export default function AnalyticsEmbed() {
const [stats, setStats] = useState<Stats | undefined>(undefined)
useEffect(() => {
getStats().then(setStats)
}, [])
if (stats == null) {
return <></>
}
return (
<Col className="w-full bg-white px-2">
<CustomAnalytics {...stats} />
<Spacer h={8} />
<FirebaseAnalytics />
</Col>
)
}

View File

@ -161,7 +161,7 @@ export default function GroupPage(props: {
const { referrer } = router.query as { const { referrer } = router.query as {
referrer?: string referrer?: string
} }
if (!user && router.isReady) if (!user && router.isReady && creator)
writeReferralInfo(creator.username, undefined, referrer, group?.slug) writeReferralInfo(creator.username, undefined, referrer, group?.slug)
}, [user, creator, group, router]) }, [user, creator, group, router])
@ -269,6 +269,7 @@ export default function GroupPage(props: {
<Linkify text={group.about} /> <Linkify text={group.about} />
</div> </div>
</div> </div>
{isMember && user?.username === 'RichardHanania' && (
<div className="hidden sm:block xl:hidden"> <div className="hidden sm:block xl:hidden">
<JoinOrCreateButton <JoinOrCreateButton
group={group} group={group}
@ -276,6 +277,7 @@ export default function GroupPage(props: {
isMember={!!isMember} isMember={!!isMember}
/> />
</div> </div>
)}
</Row> </Row>
<div className="block sm:hidden"> <div className="block sm:hidden">
<JoinOrCreateButton group={group} user={user} isMember={!!isMember} /> <JoinOrCreateButton group={group} user={user} isMember={!!isMember} />