@@ -81,10 +86,7 @@ function ContractCard(props: { contract: Contract }) {
export function ContractsGrid(props: { contracts: Contract[] }) {
const { contracts } = props
return (
-
+
{contracts.map((contract) => (
))}
diff --git a/web/lib/firebase/contracts.ts b/web/lib/firebase/contracts.ts
index 0bcca1a7..a2aad767 100644
--- a/web/lib/firebase/contracts.ts
+++ b/web/lib/firebase/contracts.ts
@@ -37,6 +37,13 @@ export type Contract = {
resolution?: 'YES' | 'NO' | 'CANCEL' // Chosen by creator; must be one of outcomes
}
+export function path(contract: Contract) {
+ // For now, derive username from creatorName
+ // Fix this when users can change their own names
+ const username = contract.creatorName.replace(/\s+/g, '')
+ return `/${username}/${contract.id}`
+}
+
export function compute(contract: Contract) {
const { pot, seedAmounts, createdTime, resolutionTime, isResolved } = contract
const volume = pot.YES + pot.NO - seedAmounts.YES - seedAmounts.NO
diff --git a/web/pages/contract/[contractId].tsx b/web/pages/[username]/[contractId].tsx
similarity index 100%
rename from web/pages/contract/[contractId].tsx
rename to web/pages/[username]/[contractId].tsx
diff --git a/web/pages/[username]/index.tsx b/web/pages/[username]/index.tsx
new file mode 100644
index 00000000..c2676800
--- /dev/null
+++ b/web/pages/[username]/index.tsx
@@ -0,0 +1,18 @@
+import { useRouter } from 'next/router'
+import React from 'react'
+import { Header } from '../../components/header'
+import { Col } from '../../components/layout/col'
+import { Title } from '../../components/title'
+
+// For now, render a placeholder page
+export default function ContractPage() {
+ const router = useRouter()
+ const { username } = router.query as { username: string }
+
+ return (
+
+
+
+
+ )
+}