Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
429 changes: 216 additions & 213 deletions apps/dapp/.env.example

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions apps/dapp/app/[chain]/intents/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,14 @@ import { parseChainSegment } from '@intent/config'
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'

import { IntentChat } from '../../../../components/intents/intent-chat'
import { intentIntro } from '../../../../lib/intent-intro-copy'

export const metadata: Metadata = { title: 'New intent' }

/** The chat is drawn by `ChatHost` in the chain layout, under this page's own heading. */
export default async function NewIntentPage({
params,
}: {
params: Promise<{ chain: string }>
}): Promise<JSX.Element> {
const route = parseChainSegment((await params).chain)
if (route === undefined) notFound()

return (
<div className="mx-auto max-w-2xl px-4 py-6 sm:px-6 sm:py-10">
<div className="mb-6">
<h1 className="font-display text-3xl font-semibold tracking-tight">Submit an intent</h1>
<p className="text-muted-foreground mt-1 text-sm">{intentIntro(route.slug)}</p>
</div>
<IntentChat />
</div>
)
}): Promise<null> {
if (parseChainSegment((await params).chain) === undefined) notFound()
return null
}
22 changes: 4 additions & 18 deletions apps/dapp/app/[chain]/intents/page.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
'use client'

import { IntentChat } from '../../../components/intents/intent-chat'

/**
* The composer, and only the composer.
* The composer, and only the composer: `ChatHost` in the chain layout draws it,
* so the chat stays mounted when the person goes to another page.
*
* History used to sit behind a second tab here, which hid a whole page of
* settled trades and open positions behind a label most people never
* clicked. It has its own page now, one step away in the sidebar.
*/
export default function IntentsPage(): JSX.Element {
return (
<div className="mx-auto max-w-4xl px-4 py-6 sm:px-6 sm:py-10">
<div className="mb-6">
<h1 className="font-display text-3xl font-semibold tracking-tight">Intents</h1>
<p className="text-muted-foreground mt-1 text-sm">
Say what you want. Agents compete to deliver it.
</p>
</div>

<IntentChat />
</div>
)
export default function IntentsPage(): null {
return null
}
17 changes: 6 additions & 11 deletions apps/dapp/app/[chain]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { cookies } from 'next/headers'
import { notFound } from 'next/navigation'

import { WalletGate } from '../../components/connect/wallet-gate'
import { ChatHost } from '../../components/intents/chat-host'
import { AppShell } from '../../components/layout/app-shell'
import { tradeCapUsd } from '../../lib/server/trade-cap'
import { BetaChainNotice } from '../../components/layout/beta-chain-notice'
import { ChainProvider } from '../../providers/chain-provider'

/**
Expand All @@ -28,15 +29,6 @@ export default async function ChainLayout({
// showing a different chain than the URL names would be worse than an error.
if (parseChainSegment(chain) === undefined) notFound()

// A misconfigured cap must not take the whole frame down with it; the
// routes that enforce it report the problem where it matters.
let cap: number | undefined
try {
cap = tradeCapUsd()
} catch {
cap = undefined
}

// For the browser tests, which have no wallet. Needs the server's own setting
// as well as the cookie, so a visitor cannot switch the gate off in production.
const bypass =
Expand All @@ -46,7 +38,10 @@ export default async function ChainLayout({
return (
<ChainProvider segment={chain}>
<WalletGate bypass={bypass}>
<AppShell tradeCapUsd={cap}>{children}</AppShell>
<BetaChainNotice />
<AppShell>
<ChatHost key={chain}>{children}</ChatHost>
</AppShell>
</WalletGate>
</ChainProvider>
)
Expand Down
Loading
Loading