From ce89ff5191397d42c4a0ce0d950170352c62eb50 Mon Sep 17 00:00:00 2001 From: Allison Muyideen Opeyemi Date: Thu, 5 Nov 2026 09:17:16 +0100 Subject: [PATCH 1/2] Phase 7: demo mode (wip for fresh-clone check) --- .github/workflows/ci.yml | 24 ++ app/(dashboard)/layout.tsx | 2 + app/api/demo/[action]/route.ts | 77 ++++- app/api/tokens/route.ts | 12 +- app/api/vault/route.ts | 5 +- app/demo/page.tsx | 49 ++- components/fund/DepositPanel.tsx | 3 + components/history/BuyTable.tsx | 7 +- components/history/SkipReason.tsx | 4 +- components/history/TxLinks.tsx | 1 + components/ui/Field.tsx | 2 +- components/vault/DemoBanner.tsx | 49 +++ components/vault/StackColumn.tsx | 10 +- components/wallet/WalletProvider.tsx | 10 +- drizzle/0002_demo_vaults.sql | 12 + drizzle/meta/0002_snapshot.json | 451 +++++++++++++++++++++++++++ drizzle/meta/_journal.json | 7 + e2e/demo-journey.spec.ts | 53 +++- e2e/playwright.config.ts | 23 +- lib/client/api.ts | 2 + lib/client/format.test.ts | 1 + lib/client/format.ts | 7 +- lib/core/cost.test.ts | 7 +- lib/core/cost.ts | 8 + lib/db/queries/buys.ts | 9 +- lib/db/queries/fundingAttempts.ts | 10 +- lib/db/queries/users.ts | 6 +- lib/db/schema.ts | 11 + lib/db/seed-demo.ts | 149 ++++++++- lib/near/demo.ts | 139 ++++++++- lib/oneclick/demo.ts | 171 +++++++++- lib/server/adapters.ts | 19 ++ lib/server/context.ts | 6 +- lib/server/demo.test.ts | 150 +++++++++ lib/server/session.ts | 8 +- next.config.ts | 2 + scripts/seed-demo.ts | 11 +- worker/scheduleBuys.ts | 4 +- worker/worker.test.ts | 2 +- 39 files changed, 1448 insertions(+), 75 deletions(-) create mode 100644 components/vault/DemoBanner.tsx create mode 100644 drizzle/0002_demo_vaults.sql create mode 100644 drizzle/meta/0002_snapshot.json create mode 100644 lib/server/demo.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fdc5ae..3f16405 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,30 @@ jobs: env: NEXT_TELEMETRY_DISABLED: "1" + e2e: + name: E2E (demo journey, desktop + phone) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm exec playwright install --with-deps chromium + - run: pnpm e2e + env: + NEXT_TELEMETRY_DISABLED: "1" + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: playwright-report + path: | + playwright-report + test-results + retention-days: 7 + contracts: name: Contracts (cargo check + test) runs-on: ubuntu-latest diff --git a/app/(dashboard)/layout.tsx b/app/(dashboard)/layout.tsx index eefb26a..2b4282e 100644 --- a/app/(dashboard)/layout.tsx +++ b/app/(dashboard)/layout.tsx @@ -13,6 +13,7 @@ import { Button } from "@/components/ui/Button"; import { Notice } from "@/components/ui/Notice"; import { PauseButton } from "@/components/plan/PauseButton"; import { CreateVault } from "@/components/vault/CreateVault"; +import { DemoBanner } from "@/components/vault/DemoBanner"; import { SignInButton } from "@/components/wallet/SignInButton"; import { useWallet } from "@/components/wallet/WalletProvider"; import { useVault } from "@/lib/client/hooks"; @@ -58,6 +59,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) { ) : null} + {v?.signedIn && v.demo ? : null}