-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuibootstrap.ps1
More file actions
561 lines (509 loc) · 17.3 KB
/
uibootstrap.ps1
File metadata and controls
561 lines (509 loc) · 17.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# ui-bootstrap.ps1
# CASTQUEST V3 — Full UI/UX scaffolding for apps/web
# - User dashboard
# - Admin dashboard
# - Dev dashboard
# - Shared UI components
# - V3 architecture SVG
$ErrorActionPreference = "Stop"
$webRoot = "apps/web"
$appRoot = Join-Path $webRoot "app"
$componentsRoot = Join-Path $webRoot "components"
$publicRoot = Join-Path $webRoot "public"
function Ensure-Dir($path) {
if (-not (Test-Path $path)) {
New-Item -ItemType Directory -Path $path | Out-Null
}
}
function Write-File($path, $content) {
$dir = Split-Path $path
Ensure-Dir $dir
$content | Set-Content -Path $path -Encoding UTF8
Write-Host "Wrote $path" -ForegroundColor Green
}
Write-Host "CASTQUEST V3 — UI Bootstrap starting..." -ForegroundColor Cyan
# -------------------------------------------------
# 1. Ensure base folders
# -------------------------------------------------
Ensure-Dir $webRoot
Ensure-Dir $appRoot
Ensure-Dir $componentsRoot
Ensure-Dir (Join-Path $componentsRoot "ui")
Ensure-Dir (Join-Path $componentsRoot "charts")
Ensure-Dir (Join-Path $componentsRoot "layout")
Ensure-Dir (Join-Path $componentsRoot "flows")
Ensure-Dir (Join-Path $publicRoot)
Ensure-Dir (Join-Path $publicRoot "assets")
Ensure-Dir (Join-Path $publicRoot "assets/diagrams")
Ensure-Dir (Join-Path $publicRoot "assets/ui-templates")
# -------------------------------------------------
# 2. Shared layout components
# -------------------------------------------------
$layoutShell = @"
"use client";
import React from "react";
import { Sidebar } from "../ui/Sidebar";
import { Topbar } from "../ui/Topbar";
export function ShellLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<div className="cq-shell flex h-screen bg-slate-950 text-slate-50">
<Sidebar />
<div className="flex flex-1 flex-col">
<Topbar />
<main className="flex-1 overflow-y-auto p-6">
{children}
</main>
</div>
</div>
);
}
"@
Write-File (Join-Path $componentsRoot "layout/ShellLayout.tsx") $layoutShell
$sidebar = @"
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
const navItems = [
{ href: "/dashboard", label: "User Dashboard" },
{ href: "/admin", label: "Admin Dashboard" },
{ href: "/dev", label: "Dev Dashboard" },
{ href: "/marketplace", label: "Marketplace" },
{ href: "/builders/code", label: "Code Builder" },
{ href: "/builders/frame", label: "Frame Builder" },
{ href: "/builders/game", label: "Game Builder" },
{ href: "/builders/ui", label: "UI Builder" },
{ href: "/dao", label: "DAO" },
{ href: "/farcaster/timeline", label: "Farcaster Timeline" },
];
export function Sidebar() {
const pathname = usePathname();
return (
<aside className="cq-sidebar w-64 border-r border-slate-800 bg-slate-950/80">
<div className="px-4 py-4 text-lg font-semibold tracking-tight">
CASTQUEST V3
</div>
<nav className="flex flex-col gap-1 px-2 pb-4">
{navItems.map((item) => {
const active = pathname === item.href;
return (
<Link
key={item.href}
href={item.href}
className={`rounded-md px-3 py-2 text-sm ${
active
? "bg-slate-800 text-slate-50"
: "text-slate-400 hover:bg-slate-900 hover:text-slate-50"
}`}
>
{item.label}
</Link>
);
})}
</nav>
</aside>
);
}
"@
Write-File (Join-Path $componentsRoot "ui/Sidebar.tsx") $sidebar
$topbar = @"
"use client";
import React from "react";
export function Topbar() {
return (
<header className="cq-topbar flex items-center justify-between border-b border-slate-800 bg-slate-950/60 px-4 py-3">
<div className="text-sm font-medium text-slate-200">
CASTQUEST V3 — Autonomous Creative Economy
</div>
<div className="flex items-center gap-3 text-xs text-slate-400">
<span>Network: Base + L2s + L3s + Solana</span>
<span className="h-1 w-1 rounded-full bg-emerald-400" />
<span>PR48–PR66 aligned</span>
</div>
</header>
);
}
"@
Write-File (Join-Path $componentsRoot "ui/Topbar.tsx") $topbar
# -------------------------------------------------
# 3. Shared UI primitives
# -------------------------------------------------
$card = @"
import React from "react";
export function Card({
title,
children,
className = "",
}: {
title?: string;
children: React.ReactNode;
className?: string;
}) {
return (
<section
className={`cq-card rounded-xl border border-slate-800 bg-slate-950/60 p-4 ${className}`}
>
{title && (
<h2 className="mb-2 text-sm font-semibold tracking-tight text-slate-100">
{title}
</h2>
)}
<div className="text-xs text-slate-300">{children}</div>
</section>
);
}
"@
Write-File (Join-Path $componentsRoot "ui/Card.tsx") $card
$metric = @"
import React from "react";
export function Metric({
label,
value,
hint,
}: {
label: string;
value: string;
hint?: string;
}) {
return (
<div className="cq-metric flex flex-col gap-1">
<span className="text-[11px] uppercase tracking-wide text-slate-400">
{label}
</span>
<span className="text-lg font-semibold text-slate-50">{value}</span>
{hint && (
<span className="text-[11px] text-slate-500">
{hint}
</span>
)}
</div>
);
}
"@
Write-File (Join-Path $componentsRoot "ui/Metric.tsx") $metric
# -------------------------------------------------
# 4. Charts + flows placeholders
# -------------------------------------------------
$mcGraph = @"
import React from "react";
import { Card } from "../ui/Card";
export function McGraph() {
return (
<Card title="Market Cap (MC) — V1 → V2 → V3">
<div className="h-40 rounded-md border border-dashed border-slate-700 bg-slate-950/40 p-3 text-[11px] text-slate-400">
[MC chart placeholder]
MC = Σ(MEDIA + FRAM + GAME + CODE + SubDAO + L3) + buyback_multiplier
• V1: MEDIA-only, Base-only
• V2: Multi-chain, multi-asset
• V3: Adds sponsorship, AI DAO, treasury yield
</div>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "charts/McGraph.tsx") $mcGraph
$tokenBalances = @"
import React from "react";
import { Card } from "../ui/Card";
const tokens = [
{ symbol: "CAST", label: "Governance" },
{ symbol: "QUEST", label: "Fees + Buybacks" },
{ symbol: "MEDIA", label: "Content" },
{ symbol: "FRAM", label: "Frames / UI" },
{ symbol: "GAME", label: "Games" },
{ symbol: "CODE", label: "Code Modules" },
{ symbol: "SPONSOR", label: "Sponsorship" },
];
export function TokenBalances() {
return (
<Card title="Token Balances">
<div className="grid grid-cols-2 gap-2 text-[11px]">
{tokens.map((t) => (
<div
key={t.symbol}
className="flex items-center justify-between rounded-md border border-slate-800 bg-slate-950/40 px-2 py-1"
>
<div className="flex flex-col">
<span className="font-semibold text-slate-100">
{t.symbol}
</span>
<span className="text-[10px] text-slate-500">
{t.label}
</span>
</div>
<span className="text-[11px] text-slate-300">
0.00
</span>
</div>
))}
</div>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "charts/TokenBalances.tsx") $tokenBalances
$activityStream = @"
import React from "react";
import { Card } from "../ui/Card";
const events = [
"[Farcaster] Frame minted → FRAM",
"[Marketplace] MEDIA listed on Base",
"[DAO] Proposal #12: Adjust buyback multiplier",
"[Treasury] Yield strategy rebalanced",
"[Social] X bot posted auction summary",
];
export function ActivityStream() {
return (
<Card title="Activity Stream (On-chain + Social)">
<ul className="flex flex-col gap-1 text-[11px] text-slate-300">
{events.map((e, idx) => (
<li
key={idx}
className="rounded-md border border-slate-800 bg-slate-950/40 px-2 py-1"
>
{e}
</li>
))}
</ul>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "charts/ActivityStream.tsx") $activityStream
$buybackFlow = @"
import React from "react";
import { Card } from "../ui/Card";
export function BuybackFlowDiagram() {
return (
<Card title="Buyback Flow — V3">
<pre className="whitespace-pre-wrap text-[10px] text-slate-300">
{`User Action
→ FeeManager (QUEST)
→ BuybackRouter
→ CAST buybacks (multi-chain)
→ Treasury + pools
→ MC update via indexers
→ Dashboards + agents`}
</pre>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "flows/BuybackFlowDiagram.tsx") $buybackFlow
$builderFlow = @"
import React from "react";
import { Card } from "../ui/Card";
export function BuilderToProtocolMap() {
return (
<Card title="Builder → Protocol Integration Map">
<pre className="whitespace-pre-wrap text-[10px] text-slate-300">
{`AI Builder (Code / Frame / Game / UI)
→ SDK (media / fram / game / code)
→ Contracts (MediaToken / FramToken / GameToken / CodeToken)
→ Marketplace (listings, auctions, sponsors)
→ MC + SubDAO + L3
→ Dashboards + agents + social automation`}
</pre>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "flows/BuilderToProtocolMap.tsx") $builderFlow
$govFlow = @"
import React from "react";
import { Card } from "../ui/Card";
export function GovernanceFlowDiagram() {
return (
<Card title="Governance + AI DAO Flow">
<pre className="whitespace-pre-wrap text-[10px] text-slate-300">
{`CAST holders
→ GovernanceV2
→ Proposals (parameters, agents, treasury)
→ AI DAO (advisory, analysis)
→ Execution (timelock, contracts)
→ Indexers + dashboards`}
</pre>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "flows/GovernanceFlowDiagram.tsx") $govFlow
$socialFlow = @"
import React from "react";
import { Card } from "../ui/Card";
export function SocialAutomationFlow() {
return (
<Card title="Social Automation Flow">
<pre className="whitespace-pre-wrap text-[10px] text-slate-300">
{`On-chain events
→ SocialAutomationAgent
→ Bots (Farcaster / Reddit / X / Discord / Telegram)
→ Timeline + dashboards
→ Feedback into agents + governance`}
</pre>
</Card>
);
}
"@
Write-File (Join-Path $componentsRoot "flows/SocialAutomationFlow.tsx") $socialFlow
# -------------------------------------------------
# 5. Dashboard pages
# -------------------------------------------------
$dashboardPage = @"
import { ShellLayout } from "../../components/layout/ShellLayout";
import { McGraph } from "../../components/charts/McGraph";
import { TokenBalances } from "../../components/charts/TokenBalances";
import { ActivityStream } from "../../components/charts/ActivityStream";
import { BuybackFlowDiagram } from "../../components/flows/BuybackFlowDiagram";
import { BuilderToProtocolMap } from "../../components/flows/BuilderToProtocolMap";
export default function DashboardPage() {
return (
<ShellLayout>
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
<div className="lg:col-span-2 space-y-4">
<McGraph />
<ActivityStream />
</div>
<div className="space-y-4">
<TokenBalances />
<BuybackFlowDiagram />
<BuilderToProtocolMap />
</div>
</div>
</ShellLayout>
);
}
"@
Write-File (Join-Path $appRoot "dashboard/page.tsx") $dashboardPage
# -------------------------------------------------
# 6. Admin page
# -------------------------------------------------
$adminPage = @"
import { ShellLayout } from "../../components/layout/ShellLayout";
import { Card } from "../../components/ui/Card";
import { GovernanceFlowDiagram } from "../../components/flows/GovernanceFlowDiagram";
export default function AdminPage() {
return (
<ShellLayout>
<div className="grid grid-cols-1 gap-4 lg:grid-cols-3">
<div className="space-y-4 lg:col-span-2">
<Card title="System Health (PR48–PR66)">
<ul className="text-[11px] text-slate-300">
<li>• Contracts compiled</li>
<li>• SDK built</li>
<li>• Agents registered</li>
<li>• Docs-site generated</li>
<li>• Dependency health (Issue #66) — surfaced via CI</li>
</ul>
</Card>
<Card title="Agent Control">
<p className="text-[11px] text-slate-300">
Placeholder for enabling/disabling agents (Creation, Frame, Game, Pricing, Auction, Curation, Fraud, Sync, UI, Portfolio, SocialAutomation).
</p>
</Card>
<GovernanceFlowDiagram />
</div>
<div className="space-y-4">
<Card title="Treasury + Yield Strategies">
<p className="text-[11px] text-slate-300">
Placeholder for autonomous treasury strategies, yield allocations, and sponsor overlays.
</p>
</Card>
<Card title="DAO + SubDAOs">
<p className="text-[11px] text-slate-300">
Placeholder for DAO metrics, SubDAO list, and governance status.
</p>
</Card>
</div>
</div>
</ShellLayout>
);
}
"@
Write-File (Join-Path $appRoot "admin/page.tsx") $adminPage
# -------------------------------------------------
# 7. Dev page
# -------------------------------------------------
$devPage = @"
import { ShellLayout } from "../../components/layout/ShellLayout";
import { Card } from "../../components/ui/Card";
export default function DevPage() {
return (
<ShellLayout>
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
<Card title="Contract Map">
<p className="text-[11px] text-slate-300">
Placeholder for mapping contracts (core, economy, governance, marketplace, L3, social) to networks and addresses.
</p>
</Card>
<Card title="SDK Playground">
<p className="text-[11px] text-slate-300">
Placeholder for interactive SDK calls (wallet, media, fram, game, code, marketplace, agents, l3, bridge, governance, profile).
</p>
</Card>
<Card title="Docs Links">
<ul className="text-[11px] text-slate-300">
<li>• docs-site/index.md</li>
<li>• overview/architecture.md</li>
<li>• protocol/constitution.md</li>
<li>• protocol/ai-dao-constitution.md</li>
<li>• marketplace/cross-chain-marketplace.md</li>
</ul>
</Card>
<Card title="CI / Workflow Status">
<p className="text-[11px] text-slate-300">
Placeholder for surfacing buildui.yaml status, dependency health, and orchestration scripts.
</p>
</Card>
</div>
</ShellLayout>
);
}
"@
Write-File (Join-Path $appRoot "dev/page.tsx") $devPage
# -------------------------------------------------
# 8. V3 architecture SVG
# -------------------------------------------------
$svg = @"
<svg viewBox="0 0 1200 900" xmlns="http://www.w3.org/2000/svg">
<style>
text { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
</style>
<text x="600" y="60" text-anchor="middle" font-size="28" font-weight="bold">
CASTQUEST V3 — AUTONOMOUS CREATIVE ECONOMY
</text>
<rect x="150" y="100" width="900" height="80" fill="#111827" stroke="#4B5563"/>
<text x="600" y="145" text-anchor="middle" fill="#F9FAFB" font-size="18">
INTERFACE LAYER — Web, L3 UIs, Bots (User / Admin / Dev Dashboards)
</text>
<rect x="150" y="200" width="900" height="80" fill="#1F2937" stroke="#4B5563"/>
<text x="600" y="245" text-anchor="middle" fill="#F9FAFB" font-size="18">
AI BUILDER LAYER — Code / Frame / Game / UI Builders
</text>
<rect x="150" y="300" width="900" height="80" fill="#111827" stroke="#4B5563"/>
<text x="600" y="345" text-anchor="middle" fill="#F9FAFB" font-size="18">
AGENT LAYER — Creation / Pricing / Auction / Curation / Fraud / Sync / UI / Portfolio / Social
</text>
<rect x="150" y="400" width="900" height="80" fill="#1F2937" stroke="#4B5563"/>
<text x="600" y="445" text-anchor="middle" fill="#F9FAFB" font-size="18">
PROTOCOL LAYER — CAST / QUEST / MEDIA / FRAM / GAME / CODE / UserProfile / SubDAOs
</text>
<rect x="150" y="500" width="900" height="80" fill="#111827" stroke="#4B5563"/>
<text x="600" y="545" text-anchor="middle" fill="#F9FAFB" font-size="18">
MULTI-CHAIN + L3 LAYER — Base / L2s / Solana / Creator L3s
</text>
<rect x="150" y="600" width="900" height="80" fill="#1F2937" stroke="#4B5563"/>
<text x="600" y="645" text-anchor="middle" fill="#F9FAFB" font-size="18">
MARKETPLACE LAYER — Global / L3 / Solana / Sponsor (PR #58)
</text>
<rect x="150" y="700" width="900" height="80" fill="#111827" stroke="#4B5563"/>
<text x="600" y="745" text-anchor="middle" fill="#F9FAFB" font-size="18">
GOVERNANCE + TREASURY LAYER — DAO / AI DAO / SubDAOs / Autonomous Treasury + Yield
</text>
</svg>
"@
Write-File (Join-Path $publicRoot "assets/diagrams/v3-architecture.svg") $svg
Write-Host "CASTQUEST V3 — UI Bootstrap complete." -ForegroundColor Cyan