Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
feat: v0.2.0 — Canva-accurate dark theme, 8-tab rail, effects, draw, brand kit, charts, preview & share
Ashiq Hussain Mir9105661d5c9e
diff --git a/.gitignore b/.gitignoreindex 50bccdb..d1252bf 100644--- a/.gitignore+++ b/.gitignore@@ -66,3 +66,6 @@ agent-ctx/*.pid.env.localmini-services/++# sandbox analysis scripts (contains session credentials — never commit)+/scripts/diff --git a/README.md b/README.mdindex 3b1d6d3..4569eb8 100644--- a/README.md+++ b/README.md@@ -30,6 +30,27 @@ watermarks, no paywalls.## 🎨 Features+### v0.2.0 — the Canva-accurate dark refresh++- **Canva-2026 dark theme** — every surface re-skinned from live canva.com research:+ deep-purple app background `#1F142E`, editor workspace `#0F1015`, rail `#1D1F26`,+ cards `#16171D` and the signature **cyan→purple gradient topbar** (`#02C0CC → #7B2FF7`)+- **New 8-tab editor rail** (72 px, exactly like Canva): Templates · Elements · Text ·+ Brand · Uploads · Tools · Projects · Apps+- **New topbar**: File menu, Resize, Editing/Viewing mode toggle, “All changes saved”+ pill, Preview, Share (white Canva pill) and Download+- **Text effects** — Shadow, Lift, Hollow, Neon and Echo presets from the context toolbar+- **Draw tool** — freehand brush (color + size) committed as editable vector strokes+- **Brand kit** — save brand colors & fonts, apply them to any selection (localStorage)+- **Charts** — bar, line and donut charts built from native editable elements (Apps panel)+- **Preview mode** — fullscreen presentation with keyboard navigation+- **Share dialog** — copy link + access levels (local-first)+- **Resize dialog** — preset sizes or custom, elements stay centered+- **Canva-style home** — “What will you design today?” hero, left rail with purple+ Create button, brand-kit section, and the purple “Get help” FAB++### Core (v0.1.0)+- **Drag-and-drop editor** — move, resize and rotate text, shapes, lines, graphics,stickers and images on a smooth HTML5 canvas (Konva.js)- **Typography** — 15 bundled Google Fonts, bold/italic/underline/strike, letter &@@ -48,7 +69,6 @@ watermarks, no paywalls.generated 100% client-side- **Responsive** — the same editor adapts to desktop, tablet and mobile withtouch gestures (pinch-zoom, drag-to-pan)-- **Dark tool rail & contextual toolbars** — a UI that will feel instantly familiar## 🚀 Quick start@@ -97,7 +117,7 @@ src/│ ├── dashboard/ # home screen: presets, templates, recent designs│ └── editor/ # the design editor│ ├── canvas/ # Konva stage, element renderers, export bridge-│ └── panels/ # templates / elements / text / uploads / background / layers+│ └── panels/ # templates / elements / text / brand / uploads / tools / projects / apps├── lib/ # types, editor utilities, template library├── store/ # zustand stores (app + editor)└── hooks/@@ -106,13 +126,14 @@ prisma/ # schema + seed## 🧭 Roadmap+- [x] Canva-accurate dark theme & 8-tab editor rail *(v0.2.0)*+- [x] Text effects, draw tool, brand kit, charts, preview & share *(v0.2.0)*- [ ] PDF export-- [ ] Multi-select grouping & alignment guides toolbar+- [ ] Multi-select grouping- [ ] Gradient fills for shapes & text- [ ] Curated stock photo library- [ ] Real-time collaboration (CRDT)-- [ ] Brand kits (saved fonts & colors)-- [ ] Design duplication & sharing links+- [ ] AI-assisted design (local models)- [ ] Plugin system## 🤝 Contributingdiff --git a/src/app/globals.css b/src/app/globals.cssindex 0c402f3..bb9c5fd 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -124,13 +124,34 @@/* ── Canvix brand utilities ─────────────────────────────────── */:root {- --cv-teal: #00c4cc;- --cv-violet: #7d2ae8;+ /* core brand */+ --cv-teal: #02c0cc;+ --cv-violet: #7630d7; /* CTA purple — real rgb(118,48,215) from canva.com */+ --cv-violet-hover: #8b5cf6;+ --cv-violet-press: #6529c0;--cv-magenta: #ff5c8a;- --cv-ink: #1f2226;- --cv-rail: #17181d;- --cv-rail-active: #26272e;- --cv-workspace: #e9eaf0;++ /* dark chrome */+ --cv-app: #1f142e; /* home app bg — real rgb(31,20,46) */+ --cv-rail: #1c1229; /* home left rail */+ --cv-rail-editor: #1d1f26; /* editor left rail */+ --cv-rail-active: #2a2c35;+ --cv-surface: #16171d; /* cards / chips / icon buttons — real rgb(22,23,29) */+ --cv-surface-2: #232530;+ --cv-panel: #16181d; /* editor side panel */+ --cv-panel-header: #101218;+ --cv-workspace: #0f1015; /* editor canvas workspace */+ --cv-ink: #0f1015;++ /* text */+ --cv-text: rgba(255, 255, 255, 0.9);+ --cv-text-2: rgba(255, 255, 255, 0.7);+ --cv-text-3: rgba(255, 255, 255, 0.55);+ --cv-border: rgba(255, 255, 255, 0.09);++ /* gradients */+ --cv-grad-bar: linear-gradient(90deg, #02c0cc 0%, #7b2ff7 100%);+ --cv-grad-brand: linear-gradient(120deg, #02c0cc 0%, #7630d7 55%, #ff5c8a 100%);}.font-sans {@@ -138,22 +159,65 @@}.bg-brand-gradient {- background: linear-gradient(120deg, #00c4cc 0%, #7d2ae8 55%, #ff5c8a 100%);+ background: var(--cv-grad-bar);}.bg-brand-gradient-soft {- background: linear-gradient(120deg, rgba(0, 196, 204, 0.12), rgba(125, 42, 232, 0.12), rgba(255, 92, 138, 0.12));+ background: linear-gradient(120deg, rgba(2, 192, 204, 0.14), rgba(118, 48, 215, 0.14), rgba(255, 92, 138, 0.14));}.text-brand-gradient {- background: linear-gradient(120deg, #00c4cc 0%, #7d2ae8 55%, #ff5c8a 100%);+ background: var(--cv-grad-brand);-webkit-background-clip: text;background-clip: text;color: transparent;}+/* editor topbar — the signature canva cyan→purple gradient */+.cv-topbar-gradient {+ background: var(--cv-grad-bar);+}++/* primary purple button — canva real CTA style: 14px/600, radius 12 */+.btn-cv {+ background: var(--cv-violet);+ color: #fff;+ border-radius: 12px;+ font-weight: 600;+ transition: background 0.15s ease, transform 0.1s ease;+}+.btn-cv:hover {+ background: var(--cv-violet-hover);+}+.btn-cv:active {+ background: var(--cv-violet-press);+ transform: translateY(1px);+}++/* white pill button (canva "Share") */+.btn-cv-white {+ background: rgba(255, 255, 255, 0.92);+ color: var(--cv-ink);+ border-radius: 12px;+ font-weight: 600;+ transition: background 0.15s ease;+}+.btn-cv-white:hover {+ background: #ffffff;+}++/* ghost button for dark chrome */+.btn-cv-ghost {+ color: var(--cv-text);+ border-radius: 12px;+}+.btn-cv-ghost:hover {+ background: rgba(255, 255, 255, 0.1);+ color: #fff;+}+.btn-brand-gradient {- background: linear-gradient(120deg, #00c4cc 0%, #7d2ae8 100%);+ background: linear-gradient(120deg, #02c0cc 0%, #7630d7 100%);color: #fff;transition: filter 0.15s ease, transform 0.1s ease;}@@ -164,24 +228,21 @@transform: translateY(1px);}-/* thin scrollbars for editor panels */+/* thin scrollbars (dark chrome everywhere now) */.cv-scroll {scrollbar-width: thin;- scrollbar-color: #c5c7d0 transparent;+ scrollbar-color: #3a3b45 transparent;}.cv-scroll::-webkit-scrollbar {width: 8px;height: 8px;}.cv-scroll::-webkit-scrollbar-thumb {- background: #c5c7d0;+ background: #3a3b45;border-radius: 999px;- border: 2px solid transparent;- background-clip: content-box;}.cv-scroll::-webkit-scrollbar-thumb:hover {- background: #a0a2ae;- background-clip: content-box;+ background: #4a4b58;}.cv-scroll-dark {scrollbar-width: thin;@@ -248,7 +309,7 @@ input[type="number"] {position: absolute;background: transparent;border: none;- outline: 2px solid #00c4cc;+ outline: 2px solid var(--cv-violet);resize: none;overflow: hidden;white-space: pre-wrap;@@ -257,3 +318,11 @@ input[type="number"] {padding: 0;margin: 0;}++/* dark surface helpers */+.cv-surface {+ background: var(--cv-surface);+}+.cv-panel-bg {+ background: var(--cv-panel);+}diff --git a/src/components/dashboard/Dashboard.tsx b/src/components/dashboard/Dashboard.tsxindex 6aa8e78..2866d82 100644--- a/src/components/dashboard/Dashboard.tsx+++ b/src/components/dashboard/Dashboard.tsx@@ -17,6 +17,10 @@ import {FileImage,Github,LayoutGrid,+ LayoutTemplate,+ FolderOpen,+ BookMarked,+ CircleHelp,} from 'lucide-react'import { useAppStore } from '@/store/app-store'import { useEditorStore } from '@/store/editor-store'@@ -188,43 +192,100 @@ export function Dashboard() {}return (- <div className="min-h-screen flex flex-col bg-white">+ <div className="min-h-screen flex bg-[#1F142E] text-[#EDEEF2]">+ {/* ── Canva-style left rail (desktop) ── */}+ <nav className="hidden md:flex w-[72px] shrink-0 flex-col items-center bg-[#1C1229] border-r border-white/[0.06] py-3 gap-1 sticky top-0 h-screen" aria-label="Primary">+ <button+ onClick={() => setCustomOpen(true)}+ className="h-9 w-9 rounded-full bg-[#7630D7] hover:bg-[#8B5CF6] text-white flex items-center justify-center shadow-lg shadow-[#7630D7]/40 transition-colors"+ aria-label="Create a design"+ title="Create a design"+ >+ <Plus size={20} />+ </button>+ <div className="h-3" />+ {[+ { label: 'Home', icon: LayoutGrid, active: true },+ { label: 'Templates', icon: LayoutTemplate, target: 'templates' },+ { label: 'Projects', icon: FolderOpen, target: 'recents' },+ { label: 'Brand', icon: BookMarked, target: 'brand' },+ ].map((item) => (+ <button+ key={item.label}+ onClick={() => item.target && document.getElementById(`cv-${item.target}`)?.scrollIntoView({ behavior: 'smooth' })}+ className={cn(+ 'w-14 py-2.5 rounded-2xl flex flex-col items-center gap-1 transition-colors',+ item.active ? 'bg-[#2A2C35] text-white' : 'text-white/60 hover:text-white hover:bg-white/[0.06]'+ )}+ aria-label={item.label}+ aria-current={item.active ? 'page' : undefined}+ >+ <item.icon size={19} />+ <span className="text-[9px] font-medium leading-none">{item.label}</span>+ </button>+ ))}+ <div className="mt-auto flex flex-col items-center gap-2">+ <a+ href="https://github.com/mir-ashiq/canvix"+ target="_blank"+ rel="noreferrer"+ className="w-9 h-9 rounded-full text-white/50 hover:text-white hover:bg-white/10 flex items-center justify-center transition-colors"+ aria-label="GitHub repository"+ title="GitHub repository"+ >+ <Github size={18} />+ </a>+ <button+ onClick={goLanding}+ className="h-9 w-9 rounded-full cv-topbar-gradient text-white text-[13px] font-bold flex items-center justify-center"+ aria-label="About Canvix"+ title="About Canvix"+ >+ C+ </button>+ </div>+ </nav>++ <div className="flex-1 min-w-0 flex flex-col">{/* ── Header ── */}- <header className="sticky top-0 z-40 border-b border-black/5 bg-white/85 backdrop-blur-lg">+ <header className="sticky top-0 z-40 border-b border-white/[0.06] bg-[#1F142E]/90 backdrop-blur-lg"><div className="mx-auto max-w-7xl px-4 sm:px-6 h-16 flex items-center gap-3">- <button onClick={goLanding} aria-label="Canvix home" className="shrink-0">- <Logo size={28} />+ <button onClick={goLanding} aria-label="Canvix home" className="shrink-0 md:hidden">+ <Logo size={26} /></button><div className="relative flex-1 max-w-md">- <Search size={16} className="absolute left-3.5 top-1/2 -translate-y-1/2 text-muted-foreground" />+ <Search size={16} className="absolute left-3.5 top-1/2 -translate-y-1/2 text-white/40" /><Inputvalue={query}onChange={(e) => setQuery(e.target.value)}placeholder="Search your designs"- className="pl-10 h-10 rounded-full bg-[#F4F5F7] border-black/5 focus-visible:ring-[#00C4CC]/40"+ className="pl-10 h-10 rounded-full bg-white/[0.06] border-white/10 text-white placeholder:text-white/35 focus-visible:ring-[#7630D7]/50 focus-visible:border-[#7630D7]/60"aria-label="Search designs"/></div><div className="ml-auto flex items-center gap-2">- <a href="https://github.com/mir-ashiq/canvix" target="_blank" rel="noreferrer">- <Button variant="ghost" size="icon" className="rounded-full hidden sm:inline-flex" aria-label="GitHub repository">- <Github size={18} />- </Button>- </a><Buttonsize="sm"- className="btn-brand-gradient rounded-full px-4 gap-1.5"+ className="btn-cv rounded-full px-4 gap-1.5 h-10"onClick={() => setCustomOpen(true)}>- <Plus size={16} /> Custom size+ <Plus size={16} /> <span className="hidden sm:inline">Custom size</span></Button></div></div></header><main className="flex-1 mx-auto w-full max-w-7xl px-4 sm:px-6 pb-20">+ {/* ── Hero — canva “What will you design today?” ── */}+ <section className="pt-8 pb-2">+ <h1 className="text-2xl sm:text-4xl font-extrabold tracking-tight text-center">+ What will you <span className="text-brand-gradient">design</span> today?+ </h1>+ <p className="mt-2 text-center text-sm text-white/50">Free, open-source, and yours forever.</p>+ </section>+{/* ── Start a new design ── */}- <section className="pt-8">+ <section className="pt-6"><div className="flex items-center justify-between"><h2 className="text-xl font-bold">Start a new design</h2></div>@@ -236,14 +297,14 @@ export function Dashboard() {key={preset.name}onClick={() => startBlank(preset.width, preset.height, preset.name)}disabled={creating}- className="group flex flex-col items-center gap-2 rounded-xl border border-black/8 bg-white p-4 hover:border-[#00C4CC]/50 hover:shadow-md hover:shadow-black/5 transition-all disabled:opacity-50"+ className="group flex flex-col items-center gap-2 rounded-2xl border border-white/10 bg-[#16171D] p-4 hover:border-[#7630D7]/60 hover:bg-[#1C1E28] transition-all disabled:opacity-50"aria-label={`Create ${preset.name}`}>- <span className="h-10 w-10 rounded-lg bg-brand-gradient-soft text-[#7D2AE8] flex items-center justify-center group-hover:scale-110 transition-transform">+ <span className="h-10 w-10 rounded-xl bg-brand-gradient-soft text-[#A78BFA] flex items-center justify-center group-hover:scale-110 transition-transform"><Icon size={19} /></span><span className="text-[13px] font-semibold text-center leading-tight">{preset.name}</span>- <span className="text-[11px] text-muted-foreground">{preset.hint}</span>+ <span className="text-[11px] text-white/40">{preset.hint}</span></button>)})}@@ -251,7 +312,7 @@ export function Dashboard() {</section>{/* ── Templates ── */}- <section className="pt-12">+ <section id="cv-templates" className="pt-12 scroll-mt-20"><div className="flex items-center justify-between flex-wrap gap-3"><h2 className="text-xl font-bold">Templates</h2><div className="flex items-center gap-2 flex-wrap">@@ -260,8 +321,8 @@ export function Dashboard() {className={cn('inline-flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-sm font-medium border transition-colors',category === 'all'- ? 'bg-[#17181D] text-white border-transparent'- : 'bg-white border-black/10 text-muted-foreground hover:border-black/25'+ ? 'bg-[#7630D7] text-white border-transparent'+ : 'bg-transparent border-white/12 text-white/60 hover:border-white/30 hover:text-white')}><LayoutGrid size={14} /> All@@ -275,8 +336,8 @@ export function Dashboard() {className={cn('inline-flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-sm font-medium border transition-colors',category === c.id- ? 'bg-[#17181D] text-white border-transparent'- : 'bg-white border-black/10 text-muted-foreground hover:border-black/25'+ ? 'bg-[#7630D7] text-white border-transparent'+ : 'bg-transparent border-white/12 text-white/60 hover:border-white/30 hover:text-white')}><Icon size={14} /> {c.label}@@ -295,32 +356,59 @@ export function Dashboard() {aria-label={`Open template ${t.name}`}><div- className="relative rounded-xl overflow-hidden border border-black/8 shadow-sm group-hover:shadow-lg group-hover:-translate-y-0.5 transition-all bg-white"+ className="relative rounded-xl overflow-hidden border border-white/10 shadow-lg shadow-black/30 group-hover:shadow-xl group-hover:-translate-y-0.5 transition-all bg-[#0F1015]"style={{ aspectRatio: `${t.width} / ${t.height}` }}><DesignPreview page={t.pages[0]} width={t.width} height={t.height} />- <div className="absolute inset-0 bg-[#7D2AE8]/0 group-hover:bg-[#7D2AE8]/10 transition-colors" />- <span className="absolute top-2 right-2 h-6 w-6 rounded-full bg-black/45 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity">+ <div className="absolute inset-0 bg-[#7630D7]/0 group-hover:bg-[#7630D7]/15 transition-colors" />+ <span className="absolute top-2 right-2 h-6 w-6 rounded-full bg-[#7630D7] text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity"><Plus size={14} /></span></div>- <div className="mt-2 text-sm font-medium truncate group-hover:text-[#7D2AE8] transition-colors">{t.name}</div>- <div className="text-xs text-muted-foreground">{t.width} × {t.height}</div>+ <div className="mt-2 text-sm font-medium truncate text-white/85 group-hover:text-[#A78BFA] transition-colors">{t.name}</div>+ <div className="text-xs text-white/40">{t.width} × {t.height}</div></button>))}</div></section>+ {/* ── Brand kit ── */}+ <section id="cv-brand" className="pt-12 scroll-mt-20">+ <h2 className="text-xl font-bold">Brand kit</h2>+ <div className="mt-4 rounded-2xl border border-white/10 bg-[#16171D] p-5 flex flex-col sm:flex-row items-center gap-6">+ <div className="flex gap-2">+ {(['#7630D7', '#02C0CC', '#FF5C8A', '#1F142E', '#FFD166'] as const).map((c) => (+ <span key={c} className="h-10 w-10 rounded-xl border border-white/15" style={{ background: c }} aria-label={`Brand color ${c}`} />+ ))}+ </div>+ <div className="flex-1 text-center sm:text-left">+ <div className="text-sm font-semibold">Set your brand colors & fonts in the editor</div>+ <div className="text-xs text-white/40 mt-0.5">Open any design → Brand tab. Saved locally, applied anywhere.</div>+ </div>+ <Button+ variant="outline"+ className="rounded-xl border-white/15 bg-transparent text-white hover:bg-white/10 hover:text-white"+ onClick={() => {+ const first = filteredDesigns[0] ?? null+ if (first) void openDesign(first.id)+ else toast({ title: 'Open a design first, then click the Brand tab' })+ }}+ >+ Open editor+ </Button>+ </div>+ </section>+{/* ── Recent designs ── */}- <section className="pt-12">+ <section id="cv-recents" className="pt-12 scroll-mt-20"><h2 className="text-xl font-bold">Recent designs</h2>{filteredDesigns.length === 0 ? (- <div className="mt-6 rounded-2xl border-2 border-dashed border-black/10 p-10 text-center">- <div className="mx-auto h-14 w-14 rounded-2xl bg-brand-gradient-soft flex items-center justify-center text-[#7D2AE8]">+ <div className="mt-6 rounded-2xl border-2 border-dashed border-white/12 p-10 text-center">+ <div className="mx-auto h-14 w-14 rounded-2xl bg-brand-gradient-soft flex items-center justify-center text-[#A78BFA]"><Plus size={24} /></div><p className="mt-4 font-semibold">No designs yet</p>- <p className="mt-1 text-sm text-muted-foreground">Pick a preset or template above to get started.</p>+ <p className="mt-1 text-sm text-white/45">Pick a preset or template above to get started.</p></div>) : (<div className="mt-4 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-4">@@ -328,34 +416,34 @@ export function Dashboard() {<div key={d.id} className="group"><buttononClick={() => openDesign(d.id)}- className="relative block w-full rounded-xl overflow-hidden border border-black/8 shadow-sm group-hover:shadow-lg group-hover:-translate-y-0.5 transition-all bg-[#F4F5F7]"+ className="relative block w-full rounded-xl overflow-hidden border border-white/10 shadow-lg shadow-black/30 group-hover:shadow-xl group-hover:-translate-y-0.5 transition-all bg-[#0F1015]"style={{ aspectRatio: `${d.width} / ${d.height}` }}aria-label={`Open ${d.name}`}>{d.thumbnail ? (<img src={d.thumbnail} alt={d.name} className="w-full h-full object-cover" />) : (- <span className="absolute inset-0 flex items-center justify-center text-muted-foreground text-xs font-medium">+ <span className="absolute inset-0 flex items-center justify-center text-white/30 text-xs font-medium">{d.width} × {d.height}</span>)}</button><div className="mt-2 flex items-start justify-between gap-1"><div className="min-w-0">- <div className="text-sm font-medium truncate">{d.name}</div>- <div className="text-xs text-muted-foreground">{timeAgo(d.updatedAt)}</div>+ <div className="text-sm font-medium truncate text-white/85">{d.name}</div>+ <div className="text-xs text-white/40">{timeAgo(d.updatedAt)}</div></div><DropdownMenu><DropdownMenuTrigger asChild>- <Button variant="ghost" size="icon" className="h-7 w-7 rounded-lg shrink-0" aria-label={`Options for ${d.name}`}>+ <Button variant="ghost" size="icon" className="h-7 w-7 rounded-lg shrink-0 text-white/60 hover:bg-white/10 hover:text-white" aria-label={`Options for ${d.name}`}><MoreHorizontal size={15} /></Button></DropdownMenuTrigger>- <DropdownMenuContent align="end" className="w-44">+ <DropdownMenuContent align="end" className="w-44 bg-[#16181D] border-white/10 text-white"><DropdownMenuItem onClick={() => openDesign(d.id)}><Pencil size={14} className="mr-2" /> Open</DropdownMenuItem>- <DropdownMenuItem onClick={() => setRenameTarget({ id: d.id, name: d.name }) || setRenameValue(d.name)}>+ <DropdownMenuItem onClick={() => { setRenameTarget({ id: d.id, name: d.name }); setRenameValue(d.name) }}><Pencil size={14} className="mr-2" /> Rename</DropdownMenuItem><DropdownMenuItem onClick={() => doDuplicate(d.id)}>@@ -375,8 +463,8 @@ export function Dashboard() {</main>{/* ── Footer ── */}- <footer className="mt-auto border-t border-black/5 bg-white">- <div className="mx-auto max-w-7xl px-4 sm:px-6 py-6 flex flex-col sm:flex-row items-center justify-between gap-3 text-sm text-muted-foreground">+ <footer className="mt-auto border-t border-white/[0.06] bg-[#1C1229]">+ <div className="mx-auto max-w-7xl px-4 sm:px-6 py-6 flex flex-col sm:flex-row items-center justify-between gap-3 text-sm text-white/40"><div className="flex items-center gap-2.5"><Logo size={20} /><span>© 2026 · MIT License</span>@@ -385,34 +473,47 @@ export function Dashboard() {href="https://github.com/mir-ashiq/canvix"target="_blank"rel="noreferrer"- className="inline-flex items-center gap-1.5 hover:text-foreground transition-colors"+ className="inline-flex items-center gap-1.5 hover:text-white/80 transition-colors"><Github size={14} /> {isMobile ? 'GitHub' : 'github.com/mir-ashiq/canvix'}</a></div></footer>+ </div>{/* end flex-1 column */}++ {/* ── Canva-style “Get help” FAB ── */}+ <a+ href="https://github.com/mir-ashiq/canvix/discussions"+ target="_blank"+ rel="noreferrer"+ className="fixed bottom-5 right-5 z-50 h-12 w-12 rounded-full bg-[#7630D7] hover:bg-[#8B5CF6] text-white flex items-center justify-center shadow-xl shadow-[#7630D7]/40 transition-colors"+ aria-label="Get help — GitHub discussions"+ title="Get help"+ >+ <CircleHelp size={22} />+ </a>{/* ── Custom size dialog ── */}<Dialog open={customOpen} onOpenChange={setCustomOpen}>- <DialogContent className="sm:max-w-sm">+ <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Create a custom design</DialogTitle>- <DialogDescription>Pick any pixel size — you can resize later.</DialogDescription>+ <DialogDescription className="text-white/55">Pick any pixel size — you can resize later.</DialogDescription></DialogHeader><div className="grid grid-cols-2 gap-3"><div><label className="text-sm font-medium" htmlFor="custom-w">Width (px)</label>- <Input id="custom-w" type="number" min={40} max={8000} value={customW} onChange={(e) => setCustomW(e.target.value)} className="mt-1" />+ <Input id="custom-w" type="number" min={40} max={8000} value={customW} onChange={(e) => setCustomW(e.target.value)} className="mt-1 bg-white/[0.06] border-white/10 text-white [color-scheme:dark]" /></div><div><label className="text-sm font-medium" htmlFor="custom-h">Height (px)</label>- <Input id="custom-h" type="number" min={40} max={8000} value={customH} onChange={(e) => setCustomH(e.target.value)} className="mt-1" />+ <Input id="custom-h" type="number" min={40} max={8000} value={customH} onChange={(e) => setCustomH(e.target.value)} className="mt-1 bg-white/[0.06] border-white/10 text-white [color-scheme:dark]" /></div></div><DialogFooter>- <Button variant="outline" onClick={() => setCustomOpen(false)}>Cancel</Button>+ <Button variant="outline" className="border-white/15 bg-transparent text-white hover:bg-white/10 hover:text-white" onClick={() => setCustomOpen(false)}>Cancel</Button><Button- className="btn-brand-gradient"+ className="btn-cv"onClick={() => {const w = parseInt(customW, 10)const h = parseInt(customH, 10)@@ -432,27 +533,27 @@ export function Dashboard() {{/* ── Rename dialog ── */}<Dialog open={!!renameTarget} onOpenChange={(open) => !open && setRenameTarget(null)}>- <DialogContent className="sm:max-w-sm">+ <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Rename design</DialogTitle></DialogHeader>- <Input value={renameValue} onChange={(e) => setRenameValue(e.target.value)} autoFocus onKeyDown={(e) => e.key === 'Enter' && doRename()} />+ <Input value={renameValue} onChange={(e) => setRenameValue(e.target.value)} autoFocus onKeyDown={(e) => e.key === 'Enter' && doRename()} className="bg-white/[0.06] border-white/10 text-white" /><DialogFooter>- <Button variant="outline" onClick={() => setRenameTarget(null)}>Cancel</Button>- <Button className="btn-brand-gradient" onClick={doRename}>Save</Button>+ <Button variant="outline" className="border-white/15 bg-transparent text-white hover:bg-white/10 hover:text-white" onClick={() => setRenameTarget(null)}>Cancel</Button>+ <Button className="btn-cv" onClick={doRename}>Save</Button></DialogFooter></DialogContent></Dialog>{/* ── Delete confirm dialog ── */}<Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>- <DialogContent className="sm:max-w-sm">+ <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Delete this design?</DialogTitle>- <DialogDescription>This action can't be undone.</DialogDescription>+ <DialogDescription className="text-white/55">This action can't be undone.</DialogDescription></DialogHeader><DialogFooter>- <Button variant="outline" onClick={() => setDeleteTarget(null)}>Cancel</Button>+ <Button variant="outline" className="border-white/15 bg-transparent text-white hover:bg-white/10 hover:text-white" onClick={() => setDeleteTarget(null)}>Cancel</Button><Button variant="destructive" onClick={() => deleteTarget && doDelete(deleteTarget)}>Delete</Button></DialogFooter></DialogContent>diff --git a/src/components/editor/Editor.tsx b/src/components/editor/Editor.tsxindex b9ade9e..107fde5 100644--- a/src/components/editor/Editor.tsx+++ b/src/components/editor/Editor.tsx@@ -1,8 +1,8 @@'use client'-import { useCallback, useEffect, useRef } from 'react'+import { useCallback, useEffect, useRef, useState } from 'react'import dynamic from 'next/dynamic'-import { X } from 'lucide-react'+import { X, Keyboard } from 'lucide-react'import { useAppStore } from '@/store/app-store'import { useEditorStore, type PanelId } from '@/store/editor-store'import { TopBar } from './TopBar'@@ -10,15 +10,21 @@ import { LeftRail } from './LeftRail'import { PropertiesBar } from './PropertiesBar'import { PageBar } from './PageBar'import { ZoomControls } from './ZoomControls'+import { PreviewOverlay } from './PreviewOverlay'import { TemplatesPanel } from './panels/TemplatesPanel'import { ElementsPanel } from './panels/ElementsPanel'import { TextPanel } from './panels/TextPanel'import { UploadsPanel } from './panels/UploadsPanel'+import { BrandPanel } from './panels/BrandPanel'+import { ToolsPanel } from './panels/ToolsPanel'+import { ProjectsPanel } from './panels/ProjectsPanel'+import { AppsPanel } from './panels/AppsPanel'import { BackgroundPanel } from './panels/BackgroundPanel'import { LayersPanel } from './panels/LayersPanel'import { captureThumbnail, canvasBridge } from './canvas/canvas-bridge'import { useIsMobile } from '@/hooks/use-mobile'import { Button } from '@/components/ui/button'+import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'import { toast } from '@/hooks/use-toast'const CanvasStage = dynamic(() => import('./canvas/CanvasStage'), { ssr: false })@@ -27,11 +33,28 @@ const PANEL_TITLES: Record<Exclude<PanelId, null>, string> = {templates: 'Templates',elements: 'Elements',text: 'Text',+ brand: 'Brand',uploads: 'Uploads',+ tools: 'Tools',+ projects: 'Projects',+ apps: 'Apps',background: 'Background',layers: 'Layers',}+const SHORTCUTS: [string, string][] = [+ ['Ctrl + Z / Ctrl + Shift + Z', 'Undo / redo'],+ ['Ctrl + S', 'Save design'],+ ['Ctrl + D', 'Duplicate selection'],+ ['Ctrl + C / X / V', 'Copy / cut / paste elements'],+ ['Delete / Backspace', 'Delete selection'],+ ['Arrows (+ Shift ×10)', 'Nudge selection'],+ ['+ / −', 'Zoom in / out'],+ ['Double-click text', 'Edit text'],+ ['Escape', 'Deselect / close'],+ ['Ctrl + mouse wheel', 'Zoom at cursor'],+]+export default function Editor() {const pendingDesign = useAppStore((s) => s.pendingDesign)const goDashboard = useAppStore((s) => s.goDashboard)@@ -43,6 +66,7 @@ export default function Editor() {const saving = useEditorStore((s) => s.saving)const version = useEditorStore((s) => s.version)const isMobile = useIsMobile()+ const [shortcutsOpen, setShortcutsOpen] = useState(false)const loadedRef = useRef(false)@@ -195,6 +219,10 @@ export default function Editor() {case 'elements': return <ElementsPanel />case 'text': return <TextPanel />case 'uploads': return <UploadsPanel />+ case 'brand': return <BrandPanel />+ case 'tools': return <ToolsPanel />+ case 'projects': return <ProjectsPanel />+ case 'apps': return <AppsPanel />case 'background': return <BackgroundPanel />case 'layers': return <LayersPanel />default: return null@@ -204,8 +232,8 @@ export default function Editor() {const hasPanel = panel !== nullreturn (- <div className="h-screen w-full flex flex-col bg-[#E9EAF0] overflow-hidden">- <TopBar onSave={() => save(true)} />+ <div className="h-screen w-full flex flex-col bg-[#0F1015] overflow-hidden">+ <TopBar onSave={() => save(true)} onShortcuts={() => setShortcutsOpen(true)} /><div className="flex flex-1 min-h-0">{/* desktop rail */}@@ -218,14 +246,14 @@ export default function Editor() {<asideclassName={isMobile- ? 'fixed inset-x-0 bottom-14 top-14 z-40 bg-white shadow-xl flex flex-col'- : 'w-[300px] bg-white border-r border-black/8 flex flex-col shrink-0'+ ? 'fixed inset-x-0 bottom-14 top-14 z-40 bg-[#16181D] shadow-2xl flex flex-col'+ : 'w-[320px] bg-[#16181D] border-r border-white/[0.07] flex flex-col shrink-0'}>{isMobile && (- <div className="flex items-center justify-between px-4 py-3 border-b border-black/5 shrink-0">- <h2 className="font-bold text-sm">{PANEL_TITLES[panel]}</h2>- <Button variant="ghost" size="icon" className="rounded-full" onClick={() => setPanel(null)} aria-label="Close panel">+ <div className="flex items-center justify-between px-4 py-3 border-b border-white/[0.07] shrink-0">+ <h2 className="font-bold text-sm text-white">{PANEL_TITLES[panel]}</h2>+ <Button variant="ghost" size="icon" className="rounded-full text-white hover:bg-white/10 hover:text-white" onClick={() => setPanel(null)} aria-label="Close panel"><X size={16} /></Button></div>@@ -244,16 +272,36 @@ export default function Editor() {</div>{/* mobile rail */}- <div className="md:hidden border-t border-black/10">+ <div className="md:hidden border-t border-white/[0.07]"><LeftRail vertical={false} /></div>{/* save indicator (mobile) */}{isMobile && saving && (- <div className="fixed top-16 left-1/2 -translate-x-1/2 z-50 text-xs bg-black/70 text-white px-3 py-1 rounded-full">+ <div className="fixed top-16 left-1/2 -translate-x-1/2 z-50 text-xs bg-[#7630D7] text-white px-3 py-1 rounded-full">Saving…</div>)}++ <PreviewOverlay />++ <Dialog open={shortcutsOpen} onOpenChange={setShortcutsOpen}>+ <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-sm">+ <DialogHeader>+ <DialogTitle className="flex items-center gap-2 text-lg font-bold">+ <Keyboard size={18} className="text-[#02C0CC]" /> Keyboard shortcuts+ </DialogTitle>+ </DialogHeader>+ <div className="divide-y divide-white/[0.07]">+ {SHORTCUTS.map(([keys, label]) => (+ <div key={keys} className="flex items-center justify-between py-2">+ <span className="text-[13px] text-white/70">{label}</span>+ <kbd className="text-[11px] font-semibold bg-white/[0.08] border border-white/10 rounded-md px-2 py-1">{keys}</kbd>+ </div>+ ))}+ </div>+ </DialogContent>+ </Dialog></div>)}diff --git a/src/components/editor/LeftRail.tsx b/src/components/editor/LeftRail.tsxindex f5c9e73..d6ed81c 100644--- a/src/components/editor/LeftRail.tsx+++ b/src/components/editor/LeftRail.tsx@@ -1,17 +1,20 @@'use client'-import { LayoutTemplate, Shapes, Type, Upload, Palette, Layers } from 'lucide-react'+import { LayoutTemplate, Shapes, Type, Upload, Palette, Layers, Wrench, FolderOpen, LayoutGrid, BookMarked } from 'lucide-react'import { useEditorStore, type PanelId } from '@/store/editor-store'import { cn } from '@/lib/utils'import { useIsMobile } from '@/hooks/use-mobile'+/** Canva-2026 rail: 8 tabs (72×72), 72px wide — Templates / Elements / Text / Brand / Uploads / Tools / Projects / Apps */const PANELS: { id: Exclude<PanelId, null>; label: string; icon: typeof LayoutTemplate }[] = [{ id: 'templates', label: 'Templates', icon: LayoutTemplate },{ id: 'elements', label: 'Elements', icon: Shapes },{ id: 'text', label: 'Text', icon: Type },+ { id: 'brand', label: 'Brand', icon: BookMarked },{ id: 'uploads', label: 'Uploads', icon: Upload },- { id: 'background', label: 'Background', icon: Palette },- { id: 'layers', label: 'Layers', icon: Layers },+ { id: 'tools', label: 'Tools', icon: Wrench },+ { id: 'projects', label: 'Projects', icon: FolderOpen },+ { id: 'apps', label: 'Apps', icon: LayoutGrid },]export function LeftRail({ vertical = true }: { vertical?: boolean }) {@@ -22,8 +25,8 @@ export function LeftRail({ vertical = true }: { vertical?: boolean }) {return (<navclassName={cn(- 'bg-[#17181D] shrink-0 z-30',- vertical ? 'w-[72px] flex flex-col items-center pt-3 gap-1' : 'flex items-center justify-around px-2 h-14 overflow-x-auto cv-scroll-dark'+ 'bg-[#1D1F26] shrink-0 z-30 border-r border-white/[0.06]',+ vertical ? 'w-[72px] flex flex-col items-center pt-1 gap-0.5' : 'flex items-center justify-around px-2 h-14 overflow-x-auto cv-scroll-dark')}aria-label="Editor tools">@@ -34,19 +37,22 @@ export function LeftRail({ vertical = true }: { vertical?: boolean }) {key={p.id}onClick={() => setPanel(p.id)}className={cn(- 'flex flex-col items-center justify-center gap-1 rounded-xl transition-colors text-white/60 hover:text-white',- vertical ? 'w-14 py-2.5' : 'w-16 h-11 shrink-0',- active && 'bg-[#26272E] text-white'+ 'flex flex-col items-center justify-center gap-1 transition-colors text-white/60 hover:text-white',+ vertical ? 'w-[72px] h-[72px] rounded-2xl' : 'w-16 h-11 shrink-0 rounded-xl',+ active && 'bg-[#2A2C35] text-white')}aria-label={p.label}aria-pressed={active}title={p.label}>- <p.icon size={19} />- <span className="text-[9px] font-medium leading-none">{p.label}</span>+ <p.icon size={22} strokeWidth={active ? 2.2 : 1.9} />+ <span className="text-[10px] font-medium leading-none">{p.label}</span></button>)})}</nav>)}++void Palette+void Layersdiff --git a/src/components/editor/PageBar.tsx b/src/components/editor/PageBar.tsxindex ec2136a..e62e023 100644--- a/src/components/editor/PageBar.tsx+++ b/src/components/editor/PageBar.tsx@@ -27,8 +27,8 @@ export function PageBar() {<buttononClick={() => setCurrentPage(i)}className={cn(- 'block rounded-md overflow-hidden border-2 transition-all bg-white shadow-sm',- i === currentPage ? 'border-[#00C4CC]' : 'border-black/10 hover:border-black/30'+ 'block rounded-md overflow-hidden border-2 transition-all bg-white shadow-md',+ i === currentPage ? 'border-[#02C0CC]' : 'border-white/20 hover:border-white/45')}style={{ height: THUMB_H, width: thumbW }}aria-label={`Go to page ${i + 1}`}@@ -37,7 +37,7 @@ export function PageBar() {<DesignPreview page={p} width={width} height={height} /></div></button>- <span className="absolute -top-1.5 -left-1.5 h-4 min-w-4 px-0.5 rounded-full bg-[#1F2226] text-white text-[9px] font-bold flex items-center justify-center">+ <span className="absolute -top-1.5 -left-1.5 h-4 min-w-4 px-0.5 rounded-full bg-[#7630D7] text-white text-[9px] font-bold flex items-center justify-center shadow">{i + 1}</span>{pages.length > 1 && (@@ -65,7 +65,7 @@ export function PageBar() {</div><buttononClick={addPage}- className="h-9 w-9 rounded-lg border-2 border-dashed border-black/25 text-muted-foreground hover:border-[#00C4CC] hover:text-[#0A8F96] flex items-center justify-center shrink-0 bg-white/70"+ className="h-9 w-9 rounded-lg border-2 border-dashed border-white/25 text-white/60 hover:border-[#02C0CC] hover:text-[#02C0CC] flex items-center justify-center shrink-0 bg-white/[0.06]"title="Add page"aria-label="Add page">diff --git a/src/components/editor/PreviewOverlay.tsx b/src/components/editor/PreviewOverlay.tsxnew file mode 100644index 0000000..bd068ce--- /dev/null+++ b/src/components/editor/PreviewOverlay.tsx@@ -0,0 +1,98 @@+'use client'++import { useCallback, useEffect, useState } from 'react'+import dynamic from 'next/dynamic'+import { ChevronLeft, ChevronRight, X, Play } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { Button } from '@/components/ui/button'+import { cn } from '@/lib/utils'++const PreviewStage = dynamic(() => import('./canvas/preview-stage'), { ssr: false })++/** Canva-style fullscreen Preview — presents pages, arrow-key navigation. */+export function PreviewOverlay() {+ const open = useEditorStore((s) => s.previewOpen)+ const setOpen = useEditorStore((s) => s.setPreviewOpen)+ const pages = useEditorStore((s) => s.pages)+ const width = useEditorStore((s) => s.width)+ const height = useEditorStore((s) => s.height)+ const [index, setIndex] = useState(0)++ // clamp when pages shrink — derived at render, no effect needed+ const safeIndex = Math.max(0, Math.min(index, pages.length - 1))++ const next = useCallback(() => setIndex((i) => Math.min(i + 1, pages.length - 1)), [pages.length])+ const prev = useCallback(() => setIndex((i) => Math.max(i - 1, 0)), [])++ useEffect(() => {+ if (!open) return+ const onKey = (e: KeyboardEvent) => {+ if (e.key === 'Escape') setOpen(false)+ if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); next() }+ if (e.key === 'ArrowLeft') { e.preventDefault(); prev() }+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [open, next, prev, setOpen])++ if (!open) return null+ const page = pages[safeIndex]++ return (+ <div className="fixed inset-0 z-[100] bg-[#0F1015] flex flex-col" role="dialog" aria-label="Design preview">+ <div className="h-14 flex items-center justify-between px-3 shrink-0">+ <span className="text-sm font-semibold text-white/90 px-2">+ Preview <span className="text-white/50 font-normal">— page {safeIndex + 1} of {pages.length}</span>+ </span>+ <Button variant="ghost" size="icon" className="rounded-full text-white hover:bg-white/15 hover:text-white" onClick={() => setOpen(false)} aria-label="Close preview">+ <X size={19} />+ </Button>+ </div>++ <div className="flex-1 min-h-0 relative bg-[#0F1015]">+ <div className="absolute inset-0 p-4 pb-16">+ <div className="w-full h-full max-w-[min(100%,calc((100vh-10rem)*var(--ar)))] mx-auto" style={{ ['--ar' as string]: `${width / height}` }}>+ {page && <PreviewStage page={page} designWidth={width} designHeight={height} />}+ </div>+ </div>++ {pages.length > 1 && (+ <>+ <button+ onClick={prev}+ disabled={safeIndex === 0}+ className={cn('absolute left-3 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-[#16171D]/90 text-white flex items-center justify-center hover:bg-[#7630D7] transition-colors disabled:opacity-30 disabled:hover:bg-[#16171D]/90')}+ aria-label="Previous page"+ >+ <ChevronLeft size={22} />+ </button>+ <button+ onClick={next}+ disabled={safeIndex === pages.length - 1}+ className={cn('absolute right-3 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-[#16171D]/90 text-white flex items-center justify-center hover:bg-[#7630D7] transition-colors disabled:opacity-30 disabled:hover:bg-[#16171D]/90')}+ aria-label="Next page"+ >+ <ChevronRight size={22} />+ </button>+ </>+ )}+ </div>++ {pages.length > 1 && (+ <div className="h-14 flex items-center justify-center gap-2 shrink-0">+ {pages.map((_, i) => (+ <button+ key={i}+ onClick={() => setIndex(i)}+ className={cn('h-2 rounded-full transition-all', i === safeIndex ? 'w-7 bg-[#02C0CC]' : 'w-2 bg-white/25 hover:bg-white/50')}+ aria-label={`Go to page ${i + 1}`}+ aria-current={i === index}+ />+ ))}+ </div>+ )}+ </div>+ )+}++void Playdiff --git a/src/components/editor/PropertiesBar.tsx b/src/components/editor/PropertiesBar.tsxindex 51e1357..90a274c 100644--- a/src/components/editor/PropertiesBar.tsx+++ b/src/components/editor/PropertiesBar.tsx@@ -25,6 +25,7 @@ import {CornerDownRight,ArrowLeftRight,MoveDiagonal,+ Wand2,} from 'lucide-react'import { useEditorStore, selectedElements, currentPageData } from '@/store/editor-store'import { FONTS } from '@/lib/editor-utils'@@ -34,6 +35,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popoverimport { Slider } from '@/components/ui/slider'import { cn } from '@/lib/utils'import type { AnyElement, TextElement, ShapeElement, LineElement, ImageElement, StickerElement } from '@/lib/types'+import { TEXT_EFFECTS, type TextEffect } from '@/lib/types'function ToolButton({onClick,@@ -41,7 +43,7 @@ function ToolButton({title,children,}: {- onClick: () => void+ onClick?: () => voidactive?: booleantitle: stringchildren: React.ReactNode@@ -53,7 +55,7 @@ function ToolButton({aria-label={title}className={cn('h-8 min-w-8 px-1.5 rounded-lg flex items-center justify-center transition-colors',- active ? 'bg-[#E6FAFB] text-[#0A8F96]' : 'text-[#3D3F47] hover:bg-black/[0.06]'+ active ? 'bg-[#7630D7] text-white' : 'text-white/75 hover:bg-white/10 hover:text-white')}>{children}@@ -62,7 +64,7 @@ function ToolButton({}function Divider() {- return <span className="h-5 w-px bg-black/10 mx-1 shrink-0" aria-hidden="true" />+ return <span className="h-5 w-px bg-white/15 mx-1 shrink-0" aria-hidden="true" />}function NumberStepper({@@ -94,8 +96,8 @@ function NumberStepper({}return (- <div className="flex items-center rounded-lg border border-black/10 h-8 bg-white" title={title}>- <button className="h-full px-1.5 text-[#3D3F47] hover:text-[#0A8F96]" aria-label="Decrease" onClick={() => commit(String(value - 1))}>+ <div className="flex items-center rounded-lg border border-white/12 h-8 bg-white/[0.06]" title={title}>+ <button className="h-full px-1.5 text-white/70 hover:text-white" aria-label="Decrease" onClick={() => commit(String(value - 1))}><Minus size={12} /></button><input@@ -103,12 +105,12 @@ function NumberStepper({onChange={(e) => setDraft(e.target.value.replace(/[^\d]/g, ''))}onBlur={() => commit(draft)}onKeyDown={(e) => e.key === 'Enter' && commit(draft)}- className="w-11 text-center text-xs font-semibold outline-none bg-transparent"+ className="w-11 text-center text-xs font-semibold text-white outline-none bg-transparent"inputMode="numeric"aria-label={title}/>- {suffix && <span className="text-[10px] text-muted-foreground pr-1">{suffix}</span>}- <button className="h-full px-1.5 text-[#3D3F47] hover:text-[#0A8F96]" aria-label="Increase" onClick={() => commit(String(value + 1))}>+ {suffix && <span className="text-[10px] text-white/50 pr-1">{suffix}</span>}+ <button className="h-full px-1.5 text-white/70 hover:text-white" aria-label="Increase" onClick={() => commit(String(value + 1))}><Plus size={12} /></button></div>@@ -126,7 +128,7 @@ function OpacityControl({ opacity, onCommit }: { opacity: number; onCommit: (v:</span></ToolButton></PopoverTrigger>- <PopoverContent className="w-52 p-3">+ <PopoverContent className="w-52 p-3 bg-[#16181D] border-white/10 text-white"><div className="flex items-center justify-between text-xs font-medium"><span>Transparency</span><span>{Math.round(local * 100)}%</span>@@ -194,10 +196,10 @@ export function PropertiesBar() {return (<div className="absolute top-3 left-1/2 -translate-x-1/2 z-30 max-w-[calc(100%-2rem)]">- <div className="flex items-center gap-0.5 rounded-2xl bg-white/95 backdrop-blur border border-black/10 shadow-lg shadow-black/10 px-2 py-1.5 overflow-x-auto cv-scroll">+ <div className="flex items-center gap-0.5 rounded-2xl bg-[#1D1F26]/95 backdrop-blur border border-white/10 shadow-xl shadow-black/50 px-2 py-1.5 overflow-x-auto cv-scroll-dark">{isMulti ? (<>- <span className="text-xs font-medium text-muted-foreground px-1.5 shrink-0">{sel.length} selected</span>+ <span className="text-xs font-medium text-white/60 px-1.5 shrink-0">{sel.length} selected</span><Divider /><ToolButton title="Align left" onClick={() => alignSelection('left')}><AlignStartVertical size={15} /></ToolButton><ToolButton title="Align centers" onClick={() => alignSelection('cx')}><AlignCenterVertical size={15} /></ToolButton>@@ -213,7 +215,7 @@ export function PropertiesBar() {<selectvalue={text.fontFamily}onChange={(e) => update(ids, { fontFamily: e.target.value })}- className="h-8 rounded-lg border border-black/10 bg-white px-2 text-xs font-semibold outline-none cursor-pointer max-w-[130px] truncate"+ className="h-8 rounded-lg border border-white/12 bg-white/[0.06] text-white px-2 text-xs font-semibold outline-none cursor-pointer max-w-[130px] truncate [color-scheme:dark]"style={{ fontFamily: text.fontFamily }}aria-label="Font family">@@ -253,6 +255,7 @@ export function PropertiesBar() {onChangeLetter={(v) => update(ids, { letterSpacing: v })}onChangeLine={(v) => update(ids, { lineHeight: v })}/>+ <EffectsControl effect={text.effect ?? 'none'} onChange={(fx) => update(ids, { effect: fx })} /></>) : shape ? (<>@@ -342,7 +345,7 @@ function SpacingControl({<MoveDiagonal size={14} /></ToolButton></PopoverTrigger>- <PopoverContent className="w-56 p-3">+ <PopoverContent className="w-56 p-3 bg-[#16181D] border-white/10 text-white"><div className="flex items-center justify-between text-xs font-medium"><span>Letter spacing</span><span>{letterSpacing.toFixed(0)}px</span>@@ -374,7 +377,7 @@ function ShadowControl({ element }: { element: AnyElement }) {</svg></ToolButton></PopoverTrigger>- <PopoverContent className="w-56 p-3">+ <PopoverContent className="w-56 p-3 bg-[#16181D] border-white/10 text-white"><label className="flex items-center justify-between text-xs font-medium cursor-pointer"><span>Shadow</span><input type="checkbox" checked={enabled} onChange={(e) => setShadow({ enabled: e.target.checked })} className="accent-[#00C4CC]" />@@ -405,3 +408,52 @@ function ShadowControl({ element }: { element: AnyElement }) {</Popover>)}++/** Canva-style text effects: None / Shadow / Lift / Hollow / Neon / Echo */+function EffectsControl({ effect, onChange }: { effect: TextEffect; onChange: (fx: TextEffect) => void }) {+ return (+ <Popover>+ <PopoverTrigger asChild>+ <ToolButton title="Effects" active={effect !== 'none'}>+ <Wand2 size={14} />+ </ToolButton>+ </PopoverTrigger>+ <PopoverContent className="w-64 p-3 bg-[#16181D] border-white/10 text-white">+ <div className="text-xs font-bold uppercase tracking-wide text-white/50 mb-2">Text effects</div>+ <div className="grid grid-cols-3 gap-2">+ {TEXT_EFFECTS.map((fx) => (+ <button+ key={fx.id}+ onClick={() => onChange(fx.id)}+ className={cn(+ 'rounded-xl border px-2 py-2.5 text-center transition-colors',+ effect === fx.id ? 'border-[#7630D7] bg-[#7630D7]/25' : 'border-white/10 bg-white/[0.04] hover:border-white/30'+ )}+ aria-pressed={effect === fx.id}+ >+ <span+ className="block text-[15px] font-bold leading-tight"+ style={+ fx.id === 'shadow'+ ? { textShadow: '0 3px 5px rgba(0,0,0,0.5)' }+ : fx.id === 'lift'+ ? { textShadow: '0 4px 0 rgba(0,0,0,0.55)' }+ : fx.id === 'hollow'+ ? { WebkitTextStroke: '1px #fff', color: 'transparent' }+ : fx.id === 'neon'+ ? { textShadow: '0 0 10px #02C0CC, 0 0 20px #02C0CC' }+ : fx.id === 'echo'+ ? { textShadow: '3px 3px 0 rgba(255,255,255,0.4)' }+ : undefined+ }+ >+ Aa+ </span>+ <span className="block text-[10px] mt-1 text-white/70">{fx.label}</span>+ </button>+ ))}+ </div>+ </PopoverContent>+ </Popover>+ )+}diff --git a/src/components/editor/ResizeDialog.tsx b/src/components/editor/ResizeDialog.tsxnew file mode 100644index 0000000..2a2010b--- /dev/null+++ b/src/components/editor/ResizeDialog.tsx@@ -0,0 +1,125 @@+'use client'++import { useState } from 'react'+import { Presentation, Instagram, Youtube, FileText, Square, RectangleHorizontal, RectangleVertical, Smartphone } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'+import { Button } from '@/components/ui/button'+import { Input } from '@/components/ui/input'+import { cn } from '@/lib/utils'+import { toast } from '@/hooks/use-toast'++const SIZE_GROUPS: { label: string; sizes: { name: string; w: number; h: number; icon: typeof Square }[] }[] = [+ {+ label: 'Story & Reels',+ sizes: [+ { name: 'Instagram Story', w: 1080, h: 1920, icon: Smartphone },+ { name: 'YouTube Short', w: 1080, h: 1920, icon: Youtube },+ ],+ },+ {+ label: 'Posts',+ sizes: [+ { name: 'Instagram Post', w: 1080, h: 1080, icon: Square },+ { name: 'Landscape Post', w: 1920, h: 1080, icon: RectangleHorizontal },+ { name: 'Portrait Post', w: 1080, h: 1350, icon: RectangleVertical },+ ],+ },+ {+ label: 'Docs & Decks',+ sizes: [+ { name: 'Presentation 16:9', w: 1920, h: 1080, icon: Presentation },+ { name: 'Document A4', w: 1240, h: 1754, icon: FileText },+ ],+ },+]++/** Canva-style Resize dialog — change canvas size; elements stay centered. */+export function ResizeDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (v: boolean) => void }) {+ const width = useEditorStore((s) => s.width)+ const height = useEditorStore((s) => s.height)+ const resizeDesign = useEditorStore((s) => s.resizeDesign)+ const [custom, setCustom] = useState({ w: '', h: '' })++ const apply = (w: number, h: number) => {+ resizeDesign(w, h)+ toast({ title: `Design resized to ${w}×${h}` })+ onOpenChange(false)+ }++ const applyCustom = () => {+ const w = parseInt(custom.w, 10)+ const h = parseInt(custom.h, 10)+ if (!w || !h || w < 50 || h < 50 || w > 8000 || h > 8000) {+ toast({ title: 'Enter a size between 50 and 8000 px', variant: 'destructive' })+ return+ }+ apply(w, h)+ }++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-md">+ <DialogHeader>+ <DialogTitle className="text-lg font-bold">Resize design</DialogTitle>+ <DialogDescription className="text-white/60">+ Current size: {width} × {height} px. Your elements stay centered on the new canvas.+ </DialogDescription>+ </DialogHeader>++ <div className="space-y-4 max-h-[55vh] overflow-y-auto cv-scroll pr-1">+ {SIZE_GROUPS.map((g) => (+ <div key={g.label}>+ <h3 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">{g.label}</h3>+ <div className="grid grid-cols-2 gap-2">+ {g.sizes.map((s) => (+ <button+ key={s.name}+ onClick={() => apply(s.w, s.h)}+ className="flex items-center gap-2.5 rounded-xl bg-white/5 hover:bg-[#7630D7] border border-white/10 hover:border-transparent px-3 py-2.5 text-left transition-colors group"+ >+ <s.icon size={18} className="text-white/70 group-hover:text-white shrink-0" />+ <span className="min-w-0">+ <span className="block text-[13px] font-semibold truncate">{s.name}</span>+ <span className="block text-[11px] text-white/50 group-hover:text-white/80">+ {s.w} × {s.h}+ </span>+ </span>+ </button>+ ))}+ </div>+ </div>+ ))}++ <div>+ <h3 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Custom size</h3>+ <div className="flex items-center gap-2">+ <Input+ type="number"+ placeholder="Width"+ value={custom.w}+ onChange={(e) => setCustom((c) => ({ ...c, w: e.target.value }))}+ className="bg-white/5 border-white/10 text-white h-10 [color-scheme:dark]"+ aria-label="Custom width"+ />+ <span className="text-white/40">×</span>+ <Input+ type="number"+ placeholder="Height"+ value={custom.h}+ onChange={(e) => setCustom((c) => ({ ...c, h: e.target.value }))}+ className="bg-white/5 border-white/10 text-white h-10 [color-scheme:dark]"+ aria-label="Custom height"+ />+ <Button className="btn-cv h-10 px-4 shrink-0" onClick={applyCustom}>+ Apply+ </Button>+ </div>+ </div>+ </div>+ </DialogContent>+ </Dialog>+ )+}++void Instagramdiff --git a/src/components/editor/ShareDialog.tsx b/src/components/editor/ShareDialog.tsxnew file mode 100644index 0000000..1766a57--- /dev/null+++ b/src/components/editor/ShareDialog.tsx@@ -0,0 +1,121 @@+'use client'++import { Link2, Check, Copy, Globe, Lock, QrCode } from 'lucide-react'+import { useState } from 'react'+import { useEditorStore } from '@/store/editor-store'+import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'+import { Button } from '@/components/ui/button'+import { cn } from '@/lib/utils'+import { toast } from '@/hooks/use-toast'++type Access = 'private' | 'link' | 'public'++const ACCESS_OPTS: { id: Access; label: string; desc: string; icon: typeof Lock }[] = [+ { id: 'private', label: 'Only me', desc: 'Private to you', icon: Lock },+ { id: 'link', label: 'Anyone with the link', desc: 'Can view or edit', icon: Link2 },+ { id: 'public', label: 'Public', desc: 'Listed in the community gallery', icon: Globe },+]++function readSavedAccess(designId: string | null): Access {+ if (typeof window === 'undefined' || !designId) return 'link'+ const saved = localStorage.getItem(`canvix:share:${designId}`)+ return saved === 'private' || saved === 'public' ? saved : 'link'+}++/** Canva-style Share dialog — copy link + access levels (local-first). */+export function ShareDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (v: boolean) => void }) {+ const designId = useEditorStore((s) => s.designId)+ const designName = useEditorStore((s) => s.designName)+ const [copied, setCopied] = useState(false)++ const link = designId ? `${typeof window !== 'undefined' ? window.location.origin : ''}/?design=${designId}` : ''++ const copy = async () => {+ try {+ await navigator.clipboard.writeText(link)+ setCopied(true)+ toast({ title: 'Share link copied to clipboard' })+ setTimeout(() => setCopied(false), 1800)+ } catch {+ toast({ title: 'Could not copy — select and copy manually', description: link })+ }+ }++ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-md">+ {open && <ShareBody designId={designId} designName={designName} link={link} copied={copied} onCopy={() => void copy()} />}+ </DialogContent>+ </Dialog>+ )+}++function ShareBody({ designId, designName, link, copied, onCopy }: {+ designId: string | null+ designName: string+ link: string+ copied: boolean+ onCopy: () => void+}) {+ const [access, setAccess] = useState<Access>(() => readSavedAccess(designId))++ const setAccessAndPersist = (a: Access) => {+ setAccess(a)+ if (designId) localStorage.setItem(`canvix:share:${designId}`, a)+ }++ return (+ <>+ <DialogHeader>+ <DialogTitle className="text-lg font-bold flex items-center gap-2">+ Share “{designName || 'Untitled design'}”+ </DialogTitle>+ <DialogDescription className="text-white/60">+ Canvix is local-first: the link points back to your Canvix instance.+ </DialogDescription>+ </DialogHeader>++ <div className="space-y-3">+ <div className="flex items-center gap-2 rounded-xl border border-white/10 bg-white/5 pl-3 pr-1.5 py-1.5 h-12">+ <Link2 size={16} className="text-white/50 shrink-0" />+ <input+ readOnly+ value={link}+ className="flex-1 min-w-0 bg-transparent outline-none text-[13px] text-white/80 truncate"+ aria-label="Share link"+ onFocus={(e) => e.currentTarget.select()}+ />+ <Button className="btn-cv h-9 px-4 shrink-0 gap-1.5" onClick={onCopy}>+ {copied ? <Check size={14} /> : <Copy size={14} />}+ {copied ? 'Copied' : 'Copy link'}+ </Button>+ </div>++ <div className="rounded-xl border border-white/10 overflow-hidden divide-y divide-white/10">+ {ACCESS_OPTS.map((o) => (+ <button+ key={o.id}+ onClick={() => setAccessAndPersist(o.id)}+ className={cn(+ 'w-full flex items-center gap-3 px-3 py-3 text-left transition-colors',+ access === o.id ? 'bg-[#7630D7]/25' : 'hover:bg-white/5'+ )}+ aria-pressed={access === o.id}+ >+ <o.icon size={17} className={access === o.id ? 'text-[#a78bfa]' : 'text-white/60'} />+ <span className="flex-1 min-w-0">+ <span className="block text-[13px] font-semibold">{o.label}</span>+ <span className="block text-[11px] text-white/50">{o.desc}</span>+ </span>+ {access === o.id && <Check size={15} className="text-[#a78bfa] shrink-0" />}+ </button>+ ))}+ </div>++ <p className="text-[11px] text-white/40 flex items-center gap-1.5">+ <QrCode size={13} /> In the open-source spirit — access control lives in your deployment, not our cloud.+ </p>+ </div>+ </>+ )+}diff --git a/src/components/editor/TopBar.tsx b/src/components/editor/TopBar.tsxindex 2a6def4..c8c40e7 100644--- a/src/components/editor/TopBar.tsx+++ b/src/components/editor/TopBar.tsx@@ -1,15 +1,18 @@'use client'import { useState } from 'react'-import { ArrowLeft, Undo2, Redo2, Download, Github, Cloud, Check, Loader2 } from 'lucide-react'+import { Home, MessageCircle, Play, Share2, ChevronDown, Undo2, Redo2, Download, Github, Cloud, Check, Loader2 } from 'lucide-react'import { useAppStore } from '@/store/app-store'import { useEditorStore } from '@/store/editor-store'import { Button } from '@/components/ui/button'-import { Logo } from '@/components/logo'+import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'import { cn } from '@/lib/utils'import { ExportDialog } from './ExportDialog'+import { ResizeDialog } from './ResizeDialog'+import { ShareDialog } from './ShareDialog'-export function TopBar({ onSave }: { onSave: () => Promise<void> }) {+/** Canva-2026 editor topbar: 56px cyan→purple gradient, white text, File/Resize/Editing left, Preview/Share right. */+export function TopBar({ onSave, onShortcuts }: { onSave: () => Promise<void>; onShortcuts: () => void }) {const goDashboard = useAppStore((s) => s.goDashboard)const name = useEditorStore((s) => s.designName)const rename = useEditorStore((s) => s.rename)@@ -20,26 +23,87 @@ export function TopBar({ onSave }: { onSave: () => Promise<void> }) {const dirty = useEditorStore((s) => s.dirty)const saving = useEditorStore((s) => s.saving)const savedAt = useEditorStore((s) => s.savedAt)+ const editingMode = useEditorStore((s) => s.editingMode)+ const setEditingMode = useEditorStore((s) => s.setEditingMode)+ const setPreviewOpen = useEditorStore((s) => s.setPreviewOpen)+ const setPanel = useEditorStore((s) => s.setPanel)+const [exportOpen, setExportOpen] = useState(false)+ const [resizeOpen, setResizeOpen] = useState(false)+ const [shareOpen, setShareOpen] = useState(false)++ const item = 'h-10 px-3 rounded-xl text-white/95 hover:bg-white/15 transition-colors text-sm font-semibold flex items-center gap-1.5 select-none'return (- <header className="h-14 bg-white border-b border-black/8 flex items-center gap-2 px-2 sm:px-3 z-40 shrink-0">- <Button variant="ghost" size="icon" className="rounded-full shrink-0" onClick={goDashboard} aria-label="Back to home">- <ArrowLeft size={18} />+ <header className="h-14 cv-topbar-gradient flex items-center gap-1 px-2 sm:px-3 z-40 shrink-0 shadow-[0_1px_0_rgba(0,0,0,0.15)]">+ <Button variant="ghost" size="icon" className="rounded-full text-white hover:bg-white/15 hover:text-white shrink-0" onClick={goDashboard} aria-label="Back to home" title="Home">+ <Home size={19} /></Button>- <Logo size={26} className="hidden sm:inline-flex shrink-0" />- <div className="flex items-center gap-2 min-w-0">+ {/* File menu */}+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button className={item} aria-label="File menu">+ File <ChevronDown size={12} className="opacity-70" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-56 bg-[#16181D] border-white/10 text-white">+ <DropdownMenuItem className="gap-2" onClick={goDashboard}>+ <Home size={15} /> Home+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" onClick={() => void onSave()}>+ <Cloud size={15} /> Save changes+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" onClick={() => setResizeOpen(true)}>+ <Play size={15} /> Resize design+ </DropdownMenuItem>+ <DropdownMenuSeparator className="bg-white/10" />+ <DropdownMenuItem className="gap-2" onClick={() => setExportOpen(true)}>+ <Download size={15} /> Download+ </DropdownMenuItem>+ <DropdownMenuSeparator className="bg-white/10" />+ <DropdownMenuItem className="gap-2" onClick={onShortcuts}>+ Keyboard shortcuts+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" asChild>+ <a href="https://github.com/mir-ashiq/canvix" target="_blank" rel="noreferrer">+ <Github size={15} /> GitHub repository+ </a>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>++ {/* Resize */}+ <button className={cn(item, 'hidden sm:flex')} onClick={() => setResizeOpen(true)} aria-label="Resize design">+ Resize+ </button>++ {/* Editing / Viewing mode */}+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button className={item} aria-label="Editing mode">+ {editingMode === 'editing' ? 'Editing' : 'Viewing'} <ChevronDown size={12} className="opacity-70" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-44 bg-[#16181D] border-white/10 text-white">+ <DropdownMenuItem onClick={() => setEditingMode('editing')}>✏️ Editing — make changes</DropdownMenuItem>+ <DropdownMenuItem onClick={() => setEditingMode('viewing')}>👁 Viewing — read only</DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>++ {/* title + save state */}+ <div className="flex items-center gap-2 min-w-0 ml-1"><inputvalue={name}onChange={(e) => rename(e.target.value)}onBlur={() => void onSave()}onKeyDown={(e) => e.key === 'Enter' && e.currentTarget.blur()}- className="text-sm font-semibold bg-transparent outline-none rounded-lg px-2 py-1.5 hover:bg-black/[0.04] focus:bg-black/[0.04] min-w-0 w-36 sm:w-56 truncate"+ className="text-sm font-semibold bg-transparent text-white outline-none rounded-lg px-2 py-1.5 hover:bg-white/15 focus:bg-white/20 min-w-0 w-32 sm:w-48 truncate placeholder:text-white/60"aria-label="Design name"maxLength={80}+ placeholder="Untitled design"/>- <span className={cn('hidden sm:inline-flex items-center gap-1 text-xs shrink-0', saving ? 'text-[#0A8F96]' : 'text-muted-foreground')}>+ <span className="hidden md:inline-flex items-center gap-1 text-xs text-white/85 shrink-0">{saving ? (<><Loader2 size={12} className="animate-spin" /> Saving…@@ -50,30 +114,36 @@ export function TopBar({ onSave }: { onSave: () => Promise<void> }) {</>) : savedAt ? (<>- <Check size={12} className="text-[#34C77B]" /> Saved+ <Check size={12} /> All changes saved</>) : null}</span></div>- <div className="ml-auto flex items-center gap-1 sm:gap-1.5 shrink-0">- <Button variant="ghost" size="icon" className="rounded-lg" onClick={undo} disabled={!canUndo} aria-label="Undo" title="Undo (Ctrl+Z)">+ <div className="ml-auto flex items-center gap-0.5 sm:gap-1 shrink-0">+ <Button variant="ghost" size="icon" className="rounded-lg text-white hover:bg-white/15 hover:text-white" onClick={undo} disabled={!canUndo} aria-label="Undo" title="Undo (Ctrl+Z)"><Undo2 size={17} /></Button>- <Button variant="ghost" size="icon" className="rounded-lg" onClick={redo} disabled={!canRedo} aria-label="Redo" title="Redo (Ctrl+Shift+Z)">+ <Button variant="ghost" size="icon" className="rounded-lg text-white hover:bg-white/15 hover:text-white" onClick={redo} disabled={!canRedo} aria-label="Redo" title="Redo (Ctrl+Shift+Z)"><Redo2 size={17} /></Button>- <a href="https://github.com/mir-ashiq/canvix" target="_blank" rel="noreferrer" className="hidden md:block">- <Button variant="ghost" size="icon" className="rounded-lg" aria-label="GitHub repository">- <Github size={17} />- </Button>- </a>- <Button size="sm" className="btn-brand-gradient rounded-full px-4 sm:px-5 gap-1.5 h-9" onClick={() => setExportOpen(true)}>- <Download size={15} /> <span className="hidden sm:inline">Download</span>+ <Button variant="ghost" size="icon" className="hidden lg:inline-flex rounded-lg text-white hover:bg-white/15 hover:text-white" onClick={() => setPanel('projects')} aria-label="Comments" title="Comments">+ <MessageCircle size={17} />+ </Button>+ <button className={cn(item, 'hidden sm:flex')} onClick={() => setPreviewOpen(true)} aria-label="Preview design">+ <Play size={14} /> Preview+ </button>+ <Button size="sm" className="btn-cv-white h-10 px-4 sm:px-5 gap-1.5 font-semibold" onClick={() => setShareOpen(true)}>+ <Share2 size={15} /> <span className="hidden sm:inline">Share</span>+ </Button>+ <Button size="icon" variant="ghost" className="rounded-lg text-white hover:bg-white/15 hover:text-white" onClick={() => setExportOpen(true)} aria-label="Download" title="Download">+ <Download size={17} /></Button></div><ExportDialog open={exportOpen} onOpenChange={setExportOpen} />+ <ResizeDialog open={resizeOpen} onOpenChange={setResizeOpen} />+ <ShareDialog open={shareOpen} onOpenChange={setShareOpen} /></header>)}diff --git a/src/components/editor/ZoomControls.tsx b/src/components/editor/ZoomControls.tsxindex 04cf7ec..2cf4775 100644--- a/src/components/editor/ZoomControls.tsx+++ b/src/components/editor/ZoomControls.tsx@@ -13,24 +13,24 @@ export function ZoomControls() {const percent = Math.round(zoom * 100)return (- <div className="absolute bottom-3 right-3 z-30 flex items-center gap-0.5 rounded-xl bg-white/95 backdrop-blur border border-black/10 shadow-md px-1 py-1">- <button className="h-8 w-8 rounded-lg flex items-center justify-center text-[#3D3F47] hover:bg-black/[0.06]" onClick={zoomOut} aria-label="Zoom out" title="Zoom out">+ <div className="absolute bottom-3 right-3 z-30 flex items-center gap-0.5 rounded-xl bg-[#1D1F26]/95 backdrop-blur border border-white/10 shadow-xl shadow-black/40 px-1 py-1">+ <button className="h-8 w-8 rounded-lg flex items-center justify-center text-white/75 hover:bg-white/10 hover:text-white" onClick={zoomOut} aria-label="Zoom out" title="Zoom out"><ZoomOut size={15} /></button><button- className="h-8 min-w-12 px-1 rounded-lg text-xs font-semibold text-[#3D3F47] hover:bg-black/[0.06]"+ className="h-8 min-w-12 px-1 rounded-lg text-xs font-semibold text-white/85 hover:bg-white/10 hover:text-white"onClick={resetZoom}aria-label="Reset zoom to 100%"title="Reset zoom">{percent}%</button>- <button className="h-8 w-8 rounded-lg flex items-center justify-center text-[#3D3F47] hover:bg-black/[0.06]" onClick={zoomIn} aria-label="Zoom in" title="Zoom in">+ <button className="h-8 w-8 rounded-lg flex items-center justify-center text-white/75 hover:bg-white/10 hover:text-white" onClick={zoomIn} aria-label="Zoom in" title="Zoom in"><ZoomIn size={15} /></button>- <span className="h-5 w-px bg-black/10 mx-0.5" aria-hidden="true" />+ <span className="h-5 w-px bg-white/15 mx-0.5" aria-hidden="true" /><button- className="h-8 w-8 rounded-lg flex items-center justify-center text-[#3D3F47] hover:bg-black/[0.06]"+ className="h-8 w-8 rounded-lg flex items-center justify-center text-white/75 hover:bg-white/10 hover:text-white"onClick={() => canvasBridge.fitToScreen?.()}aria-label="Fit to screen"title="Fit to screen"diff --git a/src/components/editor/canvas/CanvasStage.tsx b/src/components/editor/canvas/CanvasStage.tsxindex 478a9b7..e223cf0 100644--- a/src/components/editor/canvas/CanvasStage.tsx+++ b/src/components/editor/canvas/CanvasStage.tsx@@ -2,13 +2,14 @@import { useCallback, useEffect, useRef, useState } from 'react'import type Konva from 'konva'-import { Group, Layer, Rect, Stage, Transformer } from 'react-konva'+import { Group, Layer, Line, Rect, Stage, Transformer } from 'react-konva'import type { KonvaEventObject } from 'konva/lib/Node'import { useEditorStore, currentPageData } from '@/store/editor-store'import { gradientProps, computeSnap, clamp, type GuideLine } from '@/lib/editor-utils'import { canvasBridge } from './canvas-bridge'import { ElementNode } from './element-node'import type { TextElement } from '@/lib/types'+import { createStrokeElement } from '@/lib/types'const GUIDE_COLOR = '#FF33AA'@@ -27,12 +28,21 @@ export default function CanvasStage() {const setZoom = useEditorStore((s) => s.setZoom)const clearSelection = useEditorStore((s) => s.clearSelection)const selectedIds = useEditorStore((s) => s.selectedIds)+ const tool = useEditorStore((s) => s.tool)+ const drawColor = useEditorStore((s) => s.drawColor)+ const drawSize = useEditorStore((s) => s.drawSize)+ const editingMode = useEditorStore((s) => s.editingMode)const [containerSize, setContainerSize] = useState({ w: 0, h: 0 })const [pan, setPan] = useState({ x: 0, y: 0 })const [guides, setGuides] = useState<GuideLine[]>([])const [editingTextId, setEditingTextId] = useState<string | null>(null)const [editValue, setEditValue] = useState('')+ /** freehand draft: [x0,y0,x1,y1,…] in page coords */+ const [draft, setDraft] = useState<number[] | null>(null)+ const drawingRef = useRef(false)++ const interactive = editingMode === 'editing' && tool === 'select'const userZoomedRef = useRef(false)const prevZoomRef = useRef(zoom)@@ -230,6 +240,17 @@ export default function CanvasStage() {}const handleStageMouseDown = (e: KonvaEventObject<MouseEvent>) => {+ if (editingMode !== 'editing') return+ if (tool === 'draw') {+ const stage = stageRef.current+ const pointer = stage?.getPointerPosition()+ if (!pointer) return+ const px = (pointer.x - pan.x) / zoom+ const py = (pointer.y - pan.y) / zoom+ drawingRef.current = true+ setDraft([px, py, px, py])+ return+ }const target = e.targetif (target === e.target.getStage() || target.name() === 'page-bg') {clearSelection()@@ -237,6 +258,7 @@ export default function CanvasStage() {}}const handleStageTouchStart = (e: KonvaEventObject<TouchEvent>) => {+ if (editingMode !== 'editing' || tool === 'draw') returnif (e.evt.touches.length === 2) {const [a, b] = [e.evt.touches[0], e.evt.touches[1]]const container = containerRef.current?.getBoundingClientRect()@@ -327,6 +349,47 @@ export default function CanvasStage() {}}+ // ── freehand drawing (window-level so strokes continue off-element) ────+ useEffect(() => {+ if (!drawingRef.current && draft === null) return+ const onMove = (e: MouseEvent) => {+ if (!drawingRef.current) return+ const stage = stageRef.current+ const container = containerRef.current?.getBoundingClientRect()+ if (!stage || !container) return+ const px = (e.clientX - container.left - pan.x) / zoom+ const py = (e.clientY - container.top - pan.y) / zoom+ setDraft((d) => (d ? [...d, px, py] : [px, py, px, py]))+ }+ const commit = () => {+ if (!drawingRef.current) return+ drawingRef.current = false+ setDraft((d) => {+ if (d && d.length >= 6) {+ const minX = Math.min(...d.filter((_, i) => i % 2 === 0))+ const minY = Math.min(...d.filter((_, i) => i % 2 === 1))+ const rel = d.map((v, i) => (i % 2 === 0 ? v - minX : v - minY))+ useEditorStore.getState().addElement(+ createStrokeElement({+ x: Math.round(minX),+ y: Math.round(minY),+ points: rel.map((v) => Math.round(v)),+ stroke: drawColor,+ strokeWidth: drawSize,+ })+ )+ }+ return null+ })+ }+ window.addEventListener('mousemove', onMove)+ window.addEventListener('mouseup', commit)+ return () => {+ window.removeEventListener('mousemove', onMove)+ window.removeEventListener('mouseup', commit)+ }+ }, [draft, pan, zoom, drawColor, drawSize])+// ── render ─────────────────────────────────────────────────const bg = page.backgroundconst bgProps =@@ -355,7 +418,11 @@ export default function CanvasStage() {: nullreturn (- <div ref={containerRef} className="relative w-full h-full overflow-hidden" style={{ touchAction: 'none' }}>+ <div+ ref={containerRef}+ className="relative w-full h-full overflow-hidden"+ style={{ touchAction: 'none', cursor: tool === 'draw' && editingMode === 'editing' ? 'crosshair' : editingMode === 'viewing' ? 'default' : undefined }}+ >{containerSize.w > 0 && (<Stageref={stageRef}@@ -372,7 +439,7 @@ export default function CanvasStage() {<ElementNodekey={el.id}element={el}- interactive+ interactive={interactive}registerNode={registerNode}onDragMoveNode={handleDragMoveNode}onDragEndNode={() => setGuides([])}@@ -393,6 +460,18 @@ export default function CanvasStage() {<Rect key={i} x={0} y={g.position} width={width} height={1 / zoom} fill={GUIDE_COLOR} listening={false} />))}+ {/* freehand draft */}+ {draft && draft.length >= 4 && (+ <Line+ points={draft}+ stroke={drawColor}+ strokeWidth={drawSize}+ lineCap="round"+ lineJoin="round"+ tension={0.25}+ listening={false}+ />+ )}</Group></Layer></Stage>diff --git a/src/components/editor/canvas/element-node.tsx b/src/components/editor/canvas/element-node.tsxindex 3e083c9..fafe358 100644--- a/src/components/editor/canvas/element-node.tsx+++ b/src/components/editor/canvas/element-node.tsx@@ -1,7 +1,7 @@'use client'import Konva from 'konva'-import { Circle, Ellipse, Group, Image as KonvaImage, Line, Path, Rect, Star, Text } from 'react-konva'+import { Ellipse, Group, Image as KonvaImage, Line, Path, Rect, Star, Text } from 'react-konva'import type { KonvaEventObject } from 'konva/lib/Node'import type {AnyElement,@@ -9,9 +9,10 @@ import type {LineElement,ShapeElement,StickerElement,+ StrokeElement,TextElement,} from '@/lib/types'-import { isLine } from '@/lib/types'+import { isLine, withAlpha } from '@/lib/types'import { useEditorStore } from '@/store/editor-store'import { useLoadedImage } from './use-loaded-image'@@ -48,6 +49,24 @@ function shadowProps(el: AnyElement) {}}+/** canva-style text effect presets → Konva text attrs */+function textEffectProps(t: TextElement): Record<string, string | number> {+ switch (t.effect) {+ case 'shadow':+ return { shadowColor: withAlpha('#000000', 0.35), shadowBlur: 14, shadowOffsetX: 0, shadowOffsetY: 5 }+ case 'lift':+ return { shadowColor: withAlpha('#000000', 0.55), shadowBlur: 0, shadowOffsetX: 0, shadowOffsetY: 9 }+ case 'hollow':+ return { fill: 'transparent', stroke: t.fill, strokeWidth: Math.max(1, t.fontSize * 0.05), lineJoin: 'round' as unknown as string }+ case 'neon':+ return { shadowColor: t.fill, shadowBlur: 26, shadowOffsetX: 0, shadowOffsetY: 0 }+ case 'echo':+ return { shadowColor: withAlpha(t.fill, 0.45), shadowBlur: 0, shadowOffsetX: Math.max(4, t.fontSize * 0.12), shadowOffsetY: Math.max(4, t.fontSize * 0.12) }+ default:+ return {}+ }+}+export function ElementNode({ element: el, interactive, hiding, registerNode, onDragMoveNode, onDragEndNode, onDoubleClick }: ElementNodeProps) {const store = useEditorStore()const image = useLoadedImage(el.type === 'image' ? (el as ImageElement).src : undefined)@@ -108,6 +127,18 @@ export function ElementNode({ element: el, interactive, hiding, registerNode, onpatch.height = newHpatch.x = node.x()patch.y = node.y()+ } else if (el.type === 'stroke') {+ // bake the scale into the point list (points are relative to x/y)+ const s = el as StrokeElement+ const scaled = s.points.map((v, i) => (i % 2 === 0 ? v * sx : v * sy))+ store.updateElementsLive([el.id], {+ points: scaled,+ strokeWidth: Math.max(1, s.strokeWidth * (sx + sy) / 2),+ rotation: node.rotation(),+ x: node.x(),+ y: node.y(),+ })+ return} else if (isLine(el)) {patch.width = Math.max(12, el.width * sx)patch.x = node.x()@@ -172,9 +203,11 @@ export function ElementNode({ element: el, interactive, hiding, registerNode, onswitch (el.type) {case 'text': {const t = el as TextElement+ const effect = t.effect && t.effect !== 'none' ? textEffectProps(t) : {}return (<Text{...common}+ {...effect}text={t.text}fontSize={t.fontSize}fontFamily={t.fontFamily}@@ -245,6 +278,22 @@ export function ElementNode({ element: el, interactive, hiding, registerNode, onreturn <Line {...shared} hitStrokeWidth={Math.max(12, l.strokeWidth)} />}+ case 'stroke': {+ const s = el as StrokeElement+ return (+ <Line+ {...common}+ points={s.points}+ stroke={s.stroke}+ strokeWidth={s.strokeWidth}+ lineCap="round"+ lineJoin="round"+ tension={0.25}+ hitStrokeWidth={Math.max(14, s.strokeWidth)}+ />+ )+ }+case 'image': {const im = el as ImageElementreturn <KonvaImage {...common} image={image ?? undefined} width={im.width} height={im.height} cornerRadius={im.radius} />@@ -255,8 +304,10 @@ export function ElementNode({ element: el, interactive, hiding, registerNode, onreturn <Text {...common} text={sk.char} fontSize={sk.fontSize} fontFamily="'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif" width={sk.width} height={sk.height} align="center" />}- default:- return <Circle {...common} radius={Math.min(el.width, el.height) / 2} />+ default: {+ // exhaustive: every ElementType is handled above+ return null+ }}}diff --git a/src/components/editor/panels/AppsPanel.tsx b/src/components/editor/panels/AppsPanel.tsxnew file mode 100644index 0000000..09f477b--- /dev/null+++ b/src/components/editor/panels/AppsPanel.tsx@@ -0,0 +1,206 @@+'use client'++import { useState } from 'react'+import { BarChart3, PieChart, LineChart, Smile, QrCode, Table2, Code2, Sparkles, ArrowRight } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { PanelShell } from './panel-shell'+import { createShapeElement, createTextElement, createLineElement, type AnyElement } from '@/lib/types'+import { addSticker } from '../add-element'+import { cn } from '@/lib/utils'+import { toast } from '@/hooks/use-toast'++const STICKERS = ['😀', '😍', '🤩', '🥳', '😎', '🤔', '😴', '🤯', '🥰', '😭', '😡', '🤡', '👻', ' 💀', '👽', '🤖', '🎃', '🎉', '🎈', '🎁', '🏆', '🥇', '⚽', '🏀', '🎮', '🎵', '🎸', '🎬', '📷', '🔥', '✨', '⚡', '🌈', '☀️', '🌙', '⭐', '❤️', '💜', '✅', '❌']++/** Canva Apps panel — connectable mini-apps. Charts & Stickers are live; others roadmap. */+export function AppsPanel() {+ const [tab, setTab] = useState<'apps' | 'stickers'>('apps')++ return (+ <PanelShell title="Apps" subtitle="Superpowers for your design">+ <div className="flex gap-1 mt-1 mb-3 bg-white/[0.05] rounded-xl p-1">+ <button+ onClick={() => setTab('apps')}+ className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', tab === 'apps' ? 'bg-[#7630D7] text-white' : 'text-white/60 hover:text-white hover:bg-white/10')}+ aria-pressed={tab === 'apps'}+ >+ All apps+ </button>+ <button+ onClick={() => setTab('stickers')}+ className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', tab === 'stickers' ? 'bg-[#7630D7] text-white' : 'text-white/60 hover:text-white hover:bg-white/10')}+ aria-pressed={tab === 'stickers'}+ >+ Stickers+ </button>+ </div>++ {tab === 'apps' ? <AppsGrid /> : <StickersGrid />}+ </PanelShell>+ )+}++function AppsGrid() {+ return (+ <div className="grid grid-cols-2 gap-2.5">+ <AppCard icon={BarChart3} name="Bar chart" desc="Data-driven bars" cta="Add" color="#7630D7" onClick={() => addBarChart()} />+ <AppCard icon={LineChart} name="Line chart" desc="Trend as a path" cta="Add" color="#02C0CC" onClick={() => addLineChart()} />+ <AppCard icon={PieChart} name="Donut chart" desc="Progress ring" cta="Add" color="#FF5C8A" onClick={() => addDonut()} />+ <AppCard icon={Smile} name="Stickers" desc="Emoji stickers" cta="Open" color="#FFD166" onClick={() => { /* switches via parent tab */ }} switchTab="stickers" />+ <AppCard icon={QrCode} name="QR code" desc="Link to anywhere" cta="Soon" color="#3B82F6" soon />+ <AppCard icon={Table2} name="Tables" desc="Rows & columns" cta="Soon" color="#22C55E" soon />+ <AppCard icon={Code2} name="Embed" desc="Web content" cta="Soon" color="#F97316" soon />+ <AppCard icon={Sparkles} name="Magic Studio" desc="AI toolkit" cta="Soon" color="#A78BFA" soon />+ </div>+ )+}++function AppCard({ icon: Icon, name, desc, cta, color, onClick, soon, switchTab }: {+ icon: typeof BarChart3+ name: string+ desc: string+ cta: string+ color: string+ onClick?: () => void+ soon?: boolean+ switchTab?: 'stickers'+}) {+ const handleClick = () => {+ if (soon) {+ toast({ title: `${name} is on the open-source roadmap`, description: 'Star the repo to follow along: github.com/mir-ashiq/canvix' })+ return+ }+ if (switchTab) {+ // click the Stickers tab button in the parent+ const btn = document.querySelector<HTMLButtonElement>('[aria-pressed].flex-1 + button')+ btn?.click()+ return+ }+ onClick?.()+ }++ return (+ <div className="rounded-xl border border-white/10 bg-white/[0.03] p-3 hover:border-[#7630D7] transition-colors flex flex-col">+ <div className="w-10 h-10 rounded-xl flex items-center justify-center shrink-0" style={{ background: `${color}22` }}>+ <Icon size={20} style={{ color }} />+ </div>+ <div className="mt-2 text-[13px] font-semibold">{name}</div>+ <div className="text-[11px] text-white/45 leading-tight">{desc}</div>+ <button+ className={cn('mt-2.5 h-8 rounded-lg text-[11px] font-semibold flex items-center justify-center gap-1 transition-colors', soon ? 'bg-white/5 text-white/40' : 'bg-[#7630D7] hover:bg-[#8B5CF6] text-white')}+ onClick={handleClick}+ >+ {cta} {!soon && <ArrowRight size={11} />}+ </button>+ </div>+ )+}++function StickersGrid() {+ return (+ <div className="grid grid-cols-5 gap-1.5">+ {STICKERS.map((s) => (+ <button+ key={s}+ onClick={() => addSticker(s)}+ className="aspect-square rounded-xl bg-white/[0.04] hover:bg-[#7630D7]/30 border border-white/10 hover:border-[#7630D7] text-2xl flex items-center justify-center transition-colors"+ aria-label={`Add sticker ${s}`}+ >+ {s}+ </button>+ ))}+ </div>+ )+}++// ── chart generators (native elements — fully editable) ────────++const PALETTE = ['#7630D7', '#02C0CC', '#FF5C8A', '#FFD166', '#22C55E', '#3B82F6', '#F97316', '#EF4444']+const DATA = [42, 68, 55, 90, 37, 74]++function chartBase(w: number, h: number) {+ const state = useEditorStore.getState()+ return { x: Math.round((state.width - w) / 2), y: Math.round((state.height - h) / 2) }+}++function addBarChart() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const W = 700, H = 420, padL = 40, padB = 46, padT = 20+ const max = Math.max(...DATA)+ const n = DATA.length+ const bandW = (W - padL - 12) / n+ const barW = bandW * 0.6+ const { x, y } = chartBase(W, H)+ const els: AnyElement[] = []++ // baseline+ els.push(createLineElement({ x: x + padL, y: y + H - padB, width: W - padL - 12, height: 0, stroke: '#9CA3AF', strokeWidth: 3 }))+ DATA.forEach((v, i) => {+ const barH = Math.round(((H - padB - padT) * v) / max)+ const bx = x + padL + i * bandW + (bandW - barW) / 2+ const by = y + H - padB - barH+ els.push(createShapeElement('rect', { x: Math.round(bx), y: by, width: Math.round(barW), height: barH, fill: PALETTE[i % PALETTE.length], cornerRadius: 8 }))+ // label+ els.push(createTextElement({ x: Math.round(bx), y: y + H - padB + 10, width: Math.round(barW), text: `Q${i + 1}`, fontSize: 22, fill: '#6B7280', align: 'center' }))+ })+ els.forEach((el) => store.addElement(el))+ toast({ title: 'Bar chart added — edit any bar like a shape' })+}++function addLineChart() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const W = 700, H = 380, padL = 30, padB = 40, padT = 20+ const max = Math.max(...DATA)+ const { x, y } = chartBase(W, H)+ const pts = DATA.map((v, i) => {+ const px = padL + (i * (W - padL - 20)) / (DATA.length - 1)+ const py = padT + (1 - v / max) * (H - padB - padT)+ return { px: Math.round(px), py: Math.round(py) }+ })+ pts.forEach((p, i) => {+ if (i === 0) return+ const a = pts[i - 1]+ const dx = p.px - a.px+ const dy = p.py - a.py+ const len = Math.round(Math.hypot(dx, dy))+ const angle = Math.round((Math.atan2(dy, dx) * 180) / Math.PI)+ store.addElement(createLineElement({ x: x + a.px, y: y + a.py, width: len, height: 0, rotation: angle, stroke: '#02C0CC', strokeWidth: 6 }))+ // vertex dot+ store.addElement(createShapeElement('ellipse', { x: x + p.px - 9, y: y + p.py - 9, width: 18, height: 18, fill: '#02C0CC' }))+ })+ toast({ title: 'Line chart added' })+}++function addDonut() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const { x, y } = chartBase(320, 320)+ // donut = ring of arc segments as thick-stroked ellipse arcs; approximate with ring + progress arc using two circles is not possible → use ring via 12 rotated capsule segments+ const segments = 12+ const filled = 8+ const cx = x + 160, cy = y + 160, r = 110+ for (let i = 0; i < segments; i++) {+ const a0 = (i / segments) * Math.PI * 2 - Math.PI / 2+ const chord = 2 * r * Math.sin(Math.PI / segments)+ const midA = a0 + Math.PI / segments+ const len = Math.round(chord * 0.82)+ const ang = Math.round((midA * 180) / Math.PI)+ const px = cx + r * Math.cos(midA) - len / 2+ const py = cy + r * Math.sin(midA)+ store.addElement(+ createLineElement({+ x: Math.round(px),+ y: Math.round(py),+ width: len,+ height: 0,+ rotation: ang,+ stroke: i < filled ? '#7630D7' : '#2A2C35',+ strokeWidth: 34,+ })+ )+ }+ // center label+ store.addElement(createTextElement({ x: x + 60, y: y + 130, width: 200, text: '68%', fontSize: 64, bold: true, fill: '#FFFFFF', align: 'center' }))+ toast({ title: 'Donut chart added — tweak segments as lines' })+}diff --git a/src/components/editor/panels/BackgroundPanel.tsx b/src/components/editor/panels/BackgroundPanel.tsxindex 65cfe90..469ce5c 100644--- a/src/components/editor/panels/BackgroundPanel.tsx+++ b/src/components/editor/panels/BackgroundPanel.tsx@@ -21,19 +21,19 @@ export function BackgroundPanel() {return (<div className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07]"><h3 className="font-bold text-sm">Background</h3>- <p className="text-xs text-muted-foreground mt-0.5">Applies to the current page. White works great for print.</p>+ <p className="text-xs text-white/50 mt-0.5">Applies to the current page. White works great for print.</p></div>- <div className="flex-1 overflow-y-auto cv-scroll p-4">- <h4 className="text-xs font-semibold text-muted-foreground mb-2">Solid colors</h4>+ <div className="flex-1 overflow-y-auto cv-scroll-dark p-4">+ <h4 className="text-xs font-semibold text-white/50 mb-2">Solid colors</h4><div className="grid grid-cols-8 gap-1.5">{SOLID_SWATCHES.map((c) => (<buttonkey={c}onClick={() => applySolid(c)}- className={`h-7 w-7 rounded-md border border-black/10 hover:scale-110 transition-transform ${- bg?.type === 'solid' && bg.color === c ? 'ring-2 ring-[#00C4CC] ring-offset-1' : ''+ className={`h-7 w-7 rounded-md border border-white/15 hover:scale-110 transition-transform ${+ bg?.type === 'solid' && bg.color === c ? 'ring-2 ring-[#02C0CC] ring-offset-1 ring-offset-[#16181D]' : ''}`}style={{ background: c }}aria-label={`Background ${c}`}@@ -42,7 +42,7 @@ export function BackgroundPanel() {</div><div className="mt-4 flex items-center gap-3">- <span className="text-xs font-semibold text-muted-foreground">Custom</span>+ <span className="text-xs font-semibold text-white/50">Custom</span><ColorPickervalue={bg?.type === 'solid' ? bg.color : '#FFFFFF'}onChange={(color) => applySolid(color)}@@ -50,14 +50,14 @@ export function BackgroundPanel() {/></div>- <h4 className="text-xs font-semibold text-muted-foreground mt-6 mb-2">Gradients</h4>+ <h4 className="text-xs font-semibold text-white/50 mt-6 mb-2">Gradients</h4><div className="grid grid-cols-4 gap-2">{GRADIENT_PRESETS.map((g, i) => (<buttonkey={i}onClick={() => applyGradient(g.from, g.to, g.angle)}- className={`h-16 rounded-lg border border-black/10 hover:scale-[1.03] transition-transform ${- bg?.type === 'gradient' && bg.from === g.from && bg.to === g.to ? 'ring-2 ring-[#00C4CC] ring-offset-1' : ''+ className={`h-16 rounded-lg border border-white/15 hover:scale-[1.03] transition-transform ${+ bg?.type === 'gradient' && bg.from === g.from && bg.to === g.to ? 'ring-2 ring-[#02C0CC] ring-offset-1 ring-offset-[#16181D]' : ''}`}style={{ background: `linear-gradient(${g.angle}deg, ${g.from}, ${g.to})` }}aria-label={`Gradient ${g.from} to ${g.to}`}diff --git a/src/components/editor/panels/BrandPanel.tsx b/src/components/editor/panels/BrandPanel.tsxnew file mode 100644index 0000000..c1f8bba--- /dev/null+++ b/src/components/editor/panels/BrandPanel.tsx@@ -0,0 +1,172 @@+'use client'++import { useState } from 'react'+import { BookMarked, Wand2, Check, Plus } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { selectedElements } from '@/store/editor-store'+import { PanelShell } from './panel-shell'+import { DEFAULT_BRAND, type BrandKit } from '@/lib/types'+import { FONTS } from '@/lib/editor-utils'+import { toast } from '@/hooks/use-toast'+import { cn } from '@/lib/utils'++const BRAND_KEY = 'canvix:brandkit'++/** Canva Brand panel — brand colors + fonts, apply to selection, persisted to localStorage. */+export function BrandPanel() {+ const state = useEditorStore()+ const brand = state.brand+ const setBrand = state.setBrand+ const updateElements = state.updateElements+ const selected = selectedElements(state)++ const [local, setLocal] = useState<BrandKit>(() => {+ if (typeof window === 'undefined') return brand ?? DEFAULT_BRAND+ try {+ const saved = localStorage.getItem(BRAND_KEY)+ if (saved) return { ...DEFAULT_BRAND, ...JSON.parse(saved) }+ } catch { /* ignore */ }+ return brand ?? DEFAULT_BRAND+ })++ const persist = (b: BrandKit) => {+ setLocal(b)+ setBrand(b)+ try { localStorage.setItem(BRAND_KEY, JSON.stringify(b)) } catch { /* ignore */ }+ }++ const setColor = (i: number, c: string) => {+ const colors = [...local.colors]+ colors[i] = c+ persist({ ...local, colors })+ }++ const applyColor = (c: string) => {+ if (!selected.length) {+ toast({ title: 'Select an element first' })+ return+ }+ const ids = selected.map((e) => e.id)+ const patches = selected.map((el) => {+ if (el.type === 'text' || (el.type.startsWith('rect') || ['ellipse', 'triangle', 'star', 'path'].includes(el.type))) {+ return { fill: c }+ }+ if (el.type === 'line') return { stroke: c }+ return {}+ })+ // single uniform patch when possible+ const uniform = patches.every((p) => JSON.stringify(p) === JSON.stringify(patches[0]))+ if (uniform) updateElements(ids, patches[0])+ else selected.forEach((el, i) => updateElements([el.id], patches[i]))+ toast({ title: 'Brand color applied' })+ }++ const applyFont = (family: string, heading: boolean) => {+ const texts = selected.filter((e) => e.type === 'text')+ if (!texts.length) {+ toast({ title: 'Select a text element first' })+ return+ }+ updateElements(+ texts.map((t) => t.id),+ { fontFamily: family, bold: heading }+ )+ toast({ title: `Brand ${heading ? 'heading' : 'body'} font applied` })+ }++ return (+ <PanelShell title="Brand" subtitle="Your colors and fonts, applied anywhere.">+ <h4 className="mt-2 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">+ <BookMarked size={13} /> Brand colors+ </h4>+ <div className="grid grid-cols-5 gap-2">+ {local.colors.map((c, i) => (+ <div key={i} className="relative group">+ <label+ className="block w-full aspect-square rounded-xl border-2 border-white/15 cursor-pointer overflow-hidden hover:scale-105 transition-transform"+ style={{ background: c }}+ title={`Brand color ${i + 1}: ${c}`}+ >+ <input+ type="color"+ value={c}+ onChange={(e) => setColor(i, e.target.value)}+ className="absolute inset-0 opacity-0 cursor-pointer w-full h-full"+ aria-label={`Edit brand color ${i + 1}`}+ />+ </label>+ <button+ onClick={() => applyColor(c)}+ className="absolute -top-1.5 -right-1.5 w-6 h-6 rounded-full bg-[#7630D7] text-white items-center justify-center hidden group-hover:flex hover:bg-[#8B5CF6] shadow-lg"+ aria-label={`Apply ${c} to selection`}+ title="Apply to selection"+ >+ <Check size={13} />+ </button>+ </div>+ ))}+ </div>+ <p className="text-[11px] text-white/40 mt-2">Click a swatch to edit • hover and hit ✓ to apply to selection</p>++ <h4 className="mt-6 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">+ <Wand2 size={13} /> Brand fonts+ </h4>+ <div className="space-y-2">+ <FontRow+ label="Heading"+ font={local.headingFont}+ onChange={(f) => persist({ ...local, headingFont: f })}+ onApply={() => applyFont(local.headingFont, true)}+ />+ <FontRow+ label="Body"+ font={local.bodyFont}+ onChange={(f) => persist({ ...local, bodyFont: f })}+ onApply={() => applyFont(local.bodyFont, false)}+ />+ </div>++ <div className="mt-6 rounded-xl border border-dashed border-white/15 p-4 text-center">+ <div className="text-white/70 text-sm font-semibold">Brand kit preview</div>+ <div className="mt-2 rounded-lg p-3" style={{ background: local.colors[0], color: '#fff' }}>+ <div style={{ fontFamily: local.headingFont, fontWeight: 800, fontSize: 20, lineHeight: 1.1 }}>Aa Your brand heading</div>+ <div style={{ fontFamily: local.bodyFont, fontSize: 12, marginTop: 6, opacity: 0.85 }}>Body text in your brand voice — consistent everywhere.</div>+ </div>+ </div>++ <button+ className="w-full h-10 rounded-xl bg-[#7630D7] hover:bg-[#8B5CF6] text-white text-[13px] font-semibold mt-3 transition-colors"+ onClick={() => persist(DEFAULT_BRAND)}+ >+ Reset to defaults+ </button>+ </PanelShell>+ )+}++function FontRow({ label, font, onChange, onApply }: { label: string; font: string; onChange: (f: string) => void; onApply: () => void }) {+ return (+ <div className="flex items-center gap-2">+ <span className="text-[11px] text-white/50 w-14 shrink-0">{label}</span>+ <select+ value={font}+ onChange={(e) => onChange(e.target.value)}+ className="flex-1 min-w-0 h-10 rounded-xl bg-white/[0.05] border border-white/10 text-white text-[13px] px-2 outline-none focus:border-[#7630D7] [color-scheme:dark]"+ aria-label={`Brand ${label} font`}+ >+ {FONTS.map((f) => (+ <option key={f.family} value={f.family}>+ {f.label}+ </option>+ ))}+ </select>+ <button+ className={cn('h-10 px-3 rounded-xl border border-white/12 bg-white/[0.05] hover:bg-[#7630D7] hover:border-transparent text-white text-[12px] font-semibold flex items-center gap-1 shrink-0 transition-colors')}+ onClick={onApply}+ title={`Apply as ${label.toLowerCase()} font`}+ >+ <Plus size={13} /> Apply+ </button>+ </div>+ )+}diff --git a/src/components/editor/panels/ElementsPanel.tsx b/src/components/editor/panels/ElementsPanel.tsxindex ee7fd79..5a0c4d2 100644--- a/src/components/editor/panels/ElementsPanel.tsx+++ b/src/components/editor/panels/ElementsPanel.tsx@@ -19,18 +19,19 @@ export function ElementsPanel() {const [tab, setTab] = useState('shapes')return (- <Tabs value={tab} onValueChange={setTab} className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">+ <Tabs value={tab} onValueChange={setTab} className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07]"><h3 className="font-bold text-sm">Elements</h3>- <TabsList className="mt-3 w-full grid grid-cols-4 h-8">- <TabsTrigger value="shapes" className="text-xs">Shapes</TabsTrigger>- <TabsTrigger value="lines" className="text-xs">Lines</TabsTrigger>- <TabsTrigger value="graphics" className="text-xs">Graphics</TabsTrigger>- <TabsTrigger value="stickers" className="text-xs">Stickers</TabsTrigger>+ <p className="text-xs text-white/50 mt-0.5">Shapes, lines, graphics, stickers.</p>+ <TabsList className="mt-3 w-full grid grid-cols-4 h-8 bg-white/[0.05]">+ <TabsTrigger value="shapes" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Shapes</TabsTrigger>+ <TabsTrigger value="lines" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Lines</TabsTrigger>+ <TabsTrigger value="graphics" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Graphics</TabsTrigger>+ <TabsTrigger value="stickers" className="text-xs data-[state=active]:bg-[#7630D7] data-[state=active]:text-white">Stickers</TabsTrigger></TabsList></div>- <TabsContent value="shapes" className="flex-1 overflow-y-auto cv-scroll p-4 mt-0">+ <TabsContent value="shapes" className="flex-1 overflow-y-auto cv-scroll-dark p-4 mt-0"><div className="grid grid-cols-3 gap-2">{[{ id: 'rect', label: 'Square', icon: Square },@@ -42,21 +43,21 @@ export function ElementsPanel() {<buttonkey={s.id}onClick={() => addShape(s.id as 'rect')}- className="flex flex-col items-center gap-1.5 rounded-xl border border-black/8 p-3 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all"+ className="flex flex-col items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.03] p-3 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all"aria-label={`Add ${s.label}`}>{s.icon ? (- <s.icon size={26} strokeWidth={1.6} className="text-[#3D3F47]" />+ <s.icon size={26} strokeWidth={1.6} className="text-white/80" />) : (- <span className="h-[22px] w-[22px] rounded-md border-2 border-[#3D3F47]" aria-hidden="true" />+ <span className="h-[22px] w-[22px] rounded-md border-2 border-white/80" aria-hidden="true" />)}- <span className="text-[11px] text-muted-foreground">{s.label}</span>+ <span className="text-[11px] text-white/55">{s.label}</span></button>))}</div></TabsContent>- <TabsContent value="lines" className="flex-1 overflow-y-auto cv-scroll p-4 mt-0">+ <TabsContent value="lines" className="flex-1 overflow-y-auto cv-scroll-dark p-4 mt-0"><div className="grid grid-cols-2 gap-2">{[{ id: 'solid', label: 'Line', icon: Minus },@@ -67,42 +68,42 @@ export function ElementsPanel() {<buttonkey={l.id}onClick={() => addLine(l.id as 'solid')}- className="flex flex-col items-center gap-1.5 rounded-xl border border-black/8 p-4 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all"+ className="flex flex-col items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.03] p-4 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all"aria-label={`Add ${l.label}`}>- <l.icon size={24} strokeWidth={1.6} className="text-[#3D3F47]" />- <span className="text-[11px] text-muted-foreground">{l.label}</span>+ <l.icon size={24} strokeWidth={1.6} className="text-white/80" />+ <span className="text-[11px] text-white/55">{l.label}</span></button>))}</div></TabsContent>- <TabsContent value="graphics" className="flex-1 overflow-y-auto cv-scroll p-4 mt-0">+ <TabsContent value="graphics" className="flex-1 overflow-y-auto cv-scroll-dark p-4 mt-0"><div className="grid grid-cols-3 gap-2">{GRAPHICS.map((g) => (<buttonkey={g.id}onClick={() => addGraphic(g.id)}- className="flex flex-col items-center gap-1.5 rounded-xl border border-black/8 p-3 text-[#3D3F47] hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all"+ className="flex flex-col items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.03] p-3 text-white/80 hover:border-[#7630D7] hover:bg-[#7630D7]/10 hover:text-white transition-all"aria-label={`Add ${g.name}`}><GraphicIcon path={g.path} />- <span className="text-[11px] text-muted-foreground">{g.name}</span>+ <span className="text-[11px] text-white/55">{g.name}</span></button>))}</div></TabsContent>- <TabsContent value="stickers" className="flex-1 overflow-y-auto cv-scroll p-4 mt-0">+ <TabsContent value="stickers" className="flex-1 overflow-y-auto cv-scroll-dark p-4 mt-0">{STICKER_GROUPS.map((group) => (<div key={group.name} className="mb-5">- <h4 className="text-xs font-semibold text-muted-foreground mb-2">{group.name}</h4>+ <h4 className="text-xs font-semibold text-white/50 mb-2">{group.name}</h4><div className="grid grid-cols-6 gap-1">{group.emojis.map((e) => (<buttonkey={e}onClick={() => addSticker(e)}- className="h-9 w-9 rounded-lg text-xl leading-none flex items-center justify-center hover:bg-[#F0FBFC] hover:scale-110 transition-all"+ className="h-9 w-9 rounded-lg text-xl leading-none flex items-center justify-center hover:bg-[#7630D7]/25 hover:scale-110 transition-all"aria-label={`Add sticker ${e}`}>{e}diff --git a/src/components/editor/panels/LayersPanel.tsx b/src/components/editor/panels/LayersPanel.tsxindex 9cdec6b..fcbe4f8 100644--- a/src/components/editor/panels/LayersPanel.tsx+++ b/src/components/editor/panels/LayersPanel.tsx@@ -10,6 +10,7 @@ function elementIcon(el: AnyElement) {case 'text': return Typecase 'image': return ImageIconcase 'line': return Minus+ case 'stroke': return PenToolcase 'sticker': return Smilecase 'path': return PenTooldefault: return Square@@ -21,6 +22,7 @@ function elementLabel(el: AnyElement): string {if (el.type === 'sticker') return `Sticker ${el.char}`if (el.type === 'image') return 'Image'if (el.type === 'line') return 'Line'+ if (el.type === 'stroke') return 'Stroke'if (el.type === 'path') return 'Graphic'return el.type.charAt(0).toUpperCase() + el.type.slice(1)}@@ -41,13 +43,13 @@ export function LayersPanel() {return (<div className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07]"><h3 className="font-bold text-sm">Layers</h3>- <p className="text-xs text-muted-foreground mt-0.5">Top of the list is the front-most element.</p>+ <p className="text-xs text-white/50 mt-0.5">Top of the list is the front-most element.</p></div>- <div className="flex-1 overflow-y-auto cv-scroll p-2">+ <div className="flex-1 overflow-y-auto cv-scroll-dark p-2">{ordered.length === 0 && (- <div className="text-center text-xs text-muted-foreground pt-10">Nothing on this page yet.<br />Add text, shapes or images.</div>+ <div className="text-center text-xs text-white/40 pt-10">Nothing on this page yet.<br />Add text, shapes or images.</div>)}{ordered.map((el) => {const Icon = elementIcon(el)@@ -57,7 +59,7 @@ export function LayersPanel() {key={el.id}className={cn('group flex items-center gap-2 rounded-lg px-2 py-2 cursor-pointer text-sm',- selected ? 'bg-[#E6FAFB] text-[#0A8F96]' : 'hover:bg-black/[0.04]'+ selected ? 'bg-[#7630D7]/25 text-white' : 'text-white/75 hover:bg-white/[0.06]')}onClick={() => setSelection([el.id])}>@@ -65,25 +67,25 @@ export function LayersPanel() {<span className={cn('flex-1 truncate', !el.visible && 'opacity-40')}>{elementLabel(el)}</span><div className="hidden group-hover:flex items-center gap-0.5">- <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-black/10" title="Bring to front" aria-label="Bring to front" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'front') }}>+ <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-white/10" title="Bring to front" aria-label="Bring to front" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'front') }}><ChevronsUp size={13} /></button>- <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-black/10" title="Move up" aria-label="Move up" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'up') }}>+ <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-white/10" title="Move up" aria-label="Move up" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'up') }}><ChevronUp size={13} /></button>- <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-black/10" title="Move down" aria-label="Move down" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'down') }}>+ <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-white/10" title="Move down" aria-label="Move down" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'down') }}><ChevronDown size={13} /></button>- <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-black/10" title="Send to back" aria-label="Send to back" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'back') }}>+ <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-white/10" title="Send to back" aria-label="Send to back" onClick={(e) => { e.stopPropagation(); moveLayer(el.id, 'back') }}><ChevronsDown size={13} /></button>- <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-red-50 hover:text-red-600" title="Delete" aria-label="Delete layer" onClick={(e) => { e.stopPropagation(); setSelection([el.id]); deleteSelection() }}>+ <button className="h-6 w-6 flex items-center justify-center rounded hover:bg-red-500/20 hover:text-red-400" title="Delete" aria-label="Delete layer" onClick={(e) => { e.stopPropagation(); setSelection([el.id]); deleteSelection() }}><Trash2 size={13} /></button></div><button- className={cn('h-6 w-6 flex items-center justify-center rounded hover:bg-black/10 shrink-0', !el.locked && 'opacity-0 group-hover:opacity-100', el.locked && 'opacity-100')}+ className={cn('h-6 w-6 flex items-center justify-center rounded hover:bg-white/10 shrink-0', !el.locked && 'opacity-0 group-hover:opacity-100', el.locked && 'opacity-100')}title={el.locked ? 'Unlock' : 'Lock'}aria-label={el.locked ? 'Unlock layer' : 'Lock layer'}onClick={(e) => { e.stopPropagation(); setLock([el.id], !el.locked) }}@@ -91,7 +93,7 @@ export function LayersPanel() {{el.locked ? <Lock size={12} /> : <LockOpen size={12} />}</button><button- className={cn('h-6 w-6 flex items-center justify-center rounded hover:bg-black/10 shrink-0', el.visible && 'opacity-0 group-hover:opacity-100', !el.visible && 'opacity-100')}+ className={cn('h-6 w-6 flex items-center justify-center rounded hover:bg-white/10 shrink-0', el.visible && 'opacity-0 group-hover:opacity-100', !el.visible && 'opacity-100')}title={el.visible ? 'Hide' : 'Show'}aria-label={el.visible ? 'Hide layer' : 'Show layer'}onClick={(e) => { e.stopPropagation(); setVisible([el.id], !el.visible) }}diff --git a/src/components/editor/panels/ProjectsPanel.tsx b/src/components/editor/panels/ProjectsPanel.tsxnew file mode 100644index 0000000..3f37968--- /dev/null+++ b/src/components/editor/panels/ProjectsPanel.tsx@@ -0,0 +1,100 @@+'use client'++import { useEffect, useState } from 'react'+import { Clock, FolderOpen, Search, X } from 'lucide-react'+import { useAppStore } from '@/store/app-store'+import { useEditorStore } from '@/store/editor-store'+import { PanelShell } from './panel-shell'+import { DesignPreview } from '@/components/design-preview'+import type { DesignRecord } from '@/lib/types'+import { toast } from '@/hooks/use-toast'+import { cn } from '@/lib/utils'++interface DesignRow {+ id: string+ name: string+ width: number+ height: number+ updatedAt: string+ thumbnail?: string | null+}++/** Canva Projects panel — your recent designs, open one straight in the editor. */+export function ProjectsPanel() {+ const openEditor = useAppStore((s) => s.openEditor)+ const designId = useEditorStore((s) => s.designId)+ const [designs, setDesigns] = useState<DesignRow[] | null>(null)+ const [query, setQuery] = useState('')++ useEffect(() => {+ let alive = true+ fetch('/api/designs')+ .then((r) => (r.ok ? r.json() : []))+ .then((rows: DesignRow[]) => { if (alive) setDesigns(rows) })+ .catch(() => { if (alive) setDesigns([]) })+ return () => { alive = false }+ }, [])++ const open = (row: DesignRow) => {+ // fetch full record then load into editor+ fetch(`/api/designs/${row.id}`)+ .then((r) => (r.ok ? r.json() : Promise.reject(new Error('failed'))))+ .then((d: DesignRecord) => {+ openEditor(d)+ toast({ title: `Opened “${d.name}”` })+ })+ .catch(() => toast({ title: 'Could not open that design', variant: 'destructive' }))+ }++ const filtered = (designs ?? []).filter((d) => d.name.toLowerCase().includes(query.toLowerCase()))++ return (+ <PanelShell title="Projects" subtitle="Your saved designs" searchPlaceholder="Search your designs" onSearch={setQuery}>+ {designs === null ? (+ <div className="py-10 text-center text-white/40 text-sm">Loading your projects…</div>+ ) : filtered.length === 0 ? (+ <div className="py-10 text-center">+ <FolderOpen size={28} className="mx-auto text-white/25" />+ <p className="mt-2 text-sm text-white/50">{designs.length === 0 ? 'No saved designs yet' : 'No matches'}</p>+ </div>+ ) : (+ <div className="grid grid-cols-2 gap-2.5 pt-2">+ {filtered.map((d) => (+ <button+ key={d.id}+ onClick={() => open(d)}+ className={cn(+ 'group text-left rounded-xl overflow-hidden border transition-colors hover:border-[#7630D7]',+ d.id === designId ? 'border-[#02C0CC]' : 'border-white/10'+ )}+ aria-label={`Open design ${d.name}`}+ >+ <div className="aspect-[4/3] bg-[#0F1015] overflow-hidden relative">+ {d.thumbnail ? (++ <img src={d.thumbnail} alt="" className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-200" />+ ) : (+ <div className="w-full h-full flex items-center justify-center text-white/20">+ <FolderOpen size={22} />+ </div>+ )}+ {d.id === designId && (+ <span className="absolute top-1.5 left-1.5 text-[9px] font-bold bg-[#02C0CC] text-black px-1.5 py-0.5 rounded-md uppercase">Open</span>+ )}+ </div>+ <div className="px-2 py-1.5 bg-[#16181D]">+ <div className="text-[11px] font-semibold truncate text-white/90">{d.name}</div>+ <div className="text-[9px] text-white/40 flex items-center gap-1">+ <Clock size={9} /> {new Date(d.updatedAt).toLocaleDateString()}+ </div>+ </div>+ </button>+ ))}+ </div>+ )}+ </PanelShell>+ )+}++void Search+void Xdiff --git a/src/components/editor/panels/TemplatesPanel.tsx b/src/components/editor/panels/TemplatesPanel.tsxindex d2f1971..c22a822 100644--- a/src/components/editor/panels/TemplatesPanel.tsx+++ b/src/components/editor/panels/TemplatesPanel.tsx@@ -14,10 +14,10 @@ export function TemplatesPanel() {const list = useMemo(() => TEMPLATES.filter((t) => category === 'all' || t.category === category), [category])return (- <div className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">+ <div className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07]"><h3 className="font-bold text-sm">Templates</h3>- <p className="text-xs text-muted-foreground mt-0.5">Applying a template replaces this design's pages.</p>+ <p className="text-xs text-white/50 mt-0.5">Applying a template replaces this design's pages.</p><div className="mt-3 flex gap-1.5 flex-wrap">{[{ id: 'all', label: 'All' }, ...TEMPLATE_CATEGORIES.map((c) => ({ id: c.id, label: c.label }))].map((c) => (<button@@ -25,7 +25,7 @@ export function TemplatesPanel() {onClick={() => setCategory(c.id)}className={cn('rounded-full px-3 py-1 text-xs font-medium border transition-colors',- category === c.id ? 'bg-[#17181D] text-white border-transparent' : 'border-black/10 text-muted-foreground hover:border-black/25'+ category === c.id ? 'bg-[#7630D7] text-white border-transparent' : 'border-white/12 text-white/60 hover:border-white/30 hover:text-white')}>{c.label}@@ -33,19 +33,19 @@ export function TemplatesPanel() {))}</div></div>- <div className="flex-1 overflow-y-auto cv-scroll p-4">+ <div className="flex-1 overflow-y-auto cv-scroll-dark p-4"><div className="grid grid-cols-2 gap-3">{list.map((t) => (<buttonkey={t.slug}onClick={() => applyTemplate(t)}- className="group text-left rounded-lg overflow-hidden border border-black/8 hover:border-[#00C4CC] hover:shadow-md transition-all"+ className="group text-left rounded-lg overflow-hidden border border-white/10 hover:border-[#7630D7] transition-all"aria-label={`Apply template ${t.name}`}>- <div className="bg-[#F4F5F7]" style={{ aspectRatio: `${t.width} / ${t.height}` }}>+ <div className="bg-[#0F1015]" style={{ aspectRatio: `${t.width} / ${t.height}` }}><DesignPreview page={t.pages[0]} width={t.width} height={t.height} /></div>- <div className="px-2 py-1.5 text-[11px] font-medium truncate bg-white">{t.name}</div>+ <div className="px-2 py-1.5 text-[11px] font-medium truncate bg-[#16181D] text-white/80">{t.name}</div></button>))}</div>diff --git a/src/components/editor/panels/TextPanel.tsx b/src/components/editor/panels/TextPanel.tsxindex 14e29c6..cc4c6f5 100644--- a/src/components/editor/panels/TextPanel.tsx+++ b/src/components/editor/panels/TextPanel.tsx@@ -1,85 +1,129 @@'use client'-import { Heading1, Heading2, Type as TypeIcon } from 'lucide-react'+import { Heading1, Heading2, Type as TypeIcon, Plus, Sparkles, BookMarked } from 'lucide-react'import { addText, addTextStyled } from '../add-element'import { FONT_STYLES } from '@/lib/editor-utils'+import { useEditorStore } from '@/store/editor-store'+import { PanelShell } from './panel-shell'export function TextPanel() {+ const brand = useEditorStore((s) => s.brand)+return (- <div className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">- <h3 className="font-bold text-sm">Text</h3>- <p className="text-xs text-muted-foreground mt-0.5">Click to add — style it from the toolbar above the canvas.</p>+ <PanelShell title="Text" subtitle="Click to add — style it from the toolbar above the canvas.">+ {/* canva signature purple pill */}+ <button+ onClick={() => addText('body')}+ className="w-full h-11 rounded-full bg-[#7630D7] hover:bg-[#8B5CF6] text-white text-[14px] font-semibold flex items-center justify-center gap-2 transition-colors mt-1 shadow-lg shadow-[#7630D7]/25"+ aria-label="Add a text box"+ >+ <Plus size={16} /> Add a text box+ </button>++ <div className="flex gap-2 mt-2">+ <button+ className="flex-1 h-10 rounded-xl border border-white/12 bg-white/[0.05] hover:bg-white/10 text-[12px] font-semibold flex items-center justify-center gap-1.5 text-white/85 transition-colors"+ onClick={() => addTextStyled({ text: 'Draft magic copy with Canvix AI…', fontSize: 28, fontFamily: 'Poppins', width: 640 })}+ aria-label="Magic Write"+ >+ <Sparkles size={13} className="text-[#02C0CC]" /> Magic Write+ </button>+ </div>++ <div className="space-y-2 mt-5">+ <button+ onClick={() => addText('heading')}+ className="w-full rounded-xl border border-white/10 bg-white/[0.03] px-4 py-4 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all flex items-center gap-3"+ aria-label="Add a heading"+ >+ <Heading1 size={20} className="text-white/50" />+ <span style={{ fontFamily: 'Montserrat', fontWeight: 800, fontSize: 26 }} className="leading-none text-white">Add a heading</span>+ </button>+ <button+ onClick={() => addText('subheading')}+ className="w-full rounded-xl border border-white/10 bg-white/[0.03] px-4 py-4 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all flex items-center gap-3"+ aria-label="Add a subheading"+ >+ <Heading2 size={18} className="text-white/50" />+ <span style={{ fontFamily: 'Poppins', fontWeight: 700, fontSize: 19 }} className="leading-none text-white">Add a subheading</span>+ </button>+ <button+ onClick={() => addText('body')}+ className="w-full rounded-xl border border-white/10 bg-white/[0.03] px-4 py-4 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all flex items-center gap-3"+ aria-label="Add body text"+ >+ <TypeIcon size={16} className="text-white/50" />+ <span style={{ fontFamily: 'Poppins', fontSize: 15 }} className="leading-none text-white/90">Add a little bit of body text</span>+ </button></div>- <div className="flex-1 overflow-y-auto cv-scroll p-4">- <div className="space-y-2">++ <h4 className="mt-6 mb-3 text-xs font-semibold text-white/50 uppercase tracking-wide">Font combinations</h4>+ <div className="grid grid-cols-2 gap-3">+ {FONT_STYLES.map((style) => (<button- onClick={() => addText('heading')}- className="w-full rounded-xl border border-black/8 px-4 py-4 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all flex items-center gap-3"- aria-label="Add a heading"+ key={style.id}+ onClick={() => {+ addTextStyled({+ text: style.name.replace(/&/g, 'and'),+ fontFamily: style.heading.family,+ bold: style.heading.weight >= 700,+ fontSize: 72,+ width: 700,+ })+ addTextStyled({+ text: 'Pair it with a clean, readable body font.',+ fontFamily: style.body.family,+ bold: false,+ fontSize: 30,+ width: 620,+ y: undefined,+ })+ }}+ className="rounded-xl border border-white/10 bg-white/[0.03] p-4 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all text-left"+ aria-label={`Add ${style.name} font pairing`}>- <Heading1 size={20} className="text-muted-foreground" />- <span style={{ fontFamily: 'Montserrat', fontWeight: 800, fontSize: 26 }} className="leading-none">Add a heading</span>+ <div+ style={{ fontFamily: style.heading.family, fontWeight: style.heading.weight, fontSize: 22, lineHeight: 1.15 }}+ className="truncate text-white"+ >+ {style.name.split(' ')[0]}+ </div>+ <div+ style={{ fontFamily: style.body.family, fontWeight: style.body.weight, fontSize: 13, lineHeight: 1.4 }}+ className="mt-1 text-white/55 truncate"+ >+ Body text sample+ </div></button>- <button- onClick={() => addText('subheading')}- className="w-full rounded-xl border border-black/8 px-4 py-4 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all flex items-center gap-3"- aria-label="Add a subheading"+ ))}+ </div>++ {/* brand kit section — canva-style */}+ <div className="mt-6 rounded-xl border border-white/10 overflow-hidden">+ <div className="flex items-center gap-1.5 px-3 py-2.5 bg-white/[0.04]">+ <BookMarked size={13} className="text-white/60" />+ <span className="text-[11px] font-bold uppercase tracking-wide text-white/70">Brand Kit</span>+ </div>+ <div className="p-3 flex items-center gap-3">+ <span+ className="text-white truncate"+ style={{ fontFamily: brand.headingFont, fontWeight: 800, fontSize: 18 }}>- <Heading2 size={18} className="text-muted-foreground" />- <span style={{ fontFamily: 'Poppins', fontWeight: 700, fontSize: 19 }} className="leading-none">Add a subheading</span>- </button>+ {brand.headingFont}+ </span>+ <span className="text-white/40 text-[11px]">+ body font</span><button- onClick={() => addText('body')}- className="w-full rounded-xl border border-black/8 px-4 py-4 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all flex items-center gap-3"- aria-label="Add body text"+ className="ml-auto h-8 px-3 rounded-lg bg-white/10 hover:bg-[#7630D7] text-[11px] font-semibold text-white transition-colors shrink-0"+ onClick={() => {+ addTextStyled({ text: 'Brand heading sample', fontFamily: brand.headingFont, bold: true, fontSize: 64, width: 700 })+ addTextStyled({ text: 'And its matching brand body font.', fontFamily: brand.bodyFont, fontSize: 26, width: 620 })+ }}+ aria-label="Add brand font pair">- <TypeIcon size={16} className="text-muted-foreground" />- <span style={{ fontFamily: 'Poppins', fontSize: 15 }} className="leading-none">Add a little bit of body text</span>+ Use</button></div>-- <h4 className="mt-6 mb-3 text-xs font-semibold text-muted-foreground">Font combinations</h4>- <div className="grid grid-cols-2 gap-3">- {FONT_STYLES.map((style) => (- <button- key={style.id}- onClick={() => {- addTextStyled({- text: style.name.replace(/&/g, 'and'),- fontFamily: style.heading.family,- bold: style.heading.weight >= 700,- fontSize: 72,- width: 700,- })- addTextStyled({- text: 'Pair it with a clean, readable body font.',- fontFamily: style.body.family,- bold: false,- fontSize: 30,- width: 620,- y: undefined,- })- }}- className="rounded-xl border border-black/8 p-4 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all text-left"- aria-label={`Add ${style.name} font pairing`}- >- <div- style={{ fontFamily: style.heading.family, fontWeight: style.heading.weight, fontSize: 22, lineHeight: 1.15 }}- className="truncate"- >- {style.name.split(' ')[0]}- </div>- <div- style={{ fontFamily: style.body.family, fontWeight: style.body.weight, fontSize: 13, lineHeight: 1.4 }}- className="mt-1 text-muted-foreground truncate"- >- Body text sample- </div>- </button>- ))}- </div></div>- </div>+ </PanelShell>)}diff --git a/src/components/editor/panels/ToolsPanel.tsx b/src/components/editor/panels/ToolsPanel.tsxnew file mode 100644index 0000000..2654024--- /dev/null+++ b/src/components/editor/panels/ToolsPanel.tsx@@ -0,0 +1,248 @@+'use client'++import { useState } from 'react'+import { Brush, Eraser, MousePointer2, BringToFront, SendToBack, ArrowUp, ArrowDown, AlignLeft, AlignCenter, AlignRight, AlignVerticalJustifyCenter, AlignHorizontalJustifyCenter, FlipHorizontal2, FlipVertical2, Palette, Layers as LayersIcon } from 'lucide-react'+import { useEditorStore, selectedElements, currentPageData } from '@/store/editor-store'+import { PanelShell } from './panel-shell'+import { BackgroundPanel } from './BackgroundPanel'+import { LayersPanel } from './LayersPanel'+import { cn } from '@/lib/utils'+import { toast } from '@/hooks/use-toast'++const SUB_TABS = [+ { id: 'draw', label: 'Draw', icon: Brush },+ { id: 'position', label: 'Position', icon: ArrowUp },+ { id: 'background', label: 'Background', icon: Palette },+ { id: 'layers', label: 'Layers', icon: LayersIcon },+] as const++type SubTab = (typeof SUB_TABS)[number]['id']++/** Canva Tools panel — Draw (freehand), Position (arrange/align/flip), Background, Layers. */+export function ToolsPanel() {+ const [tab, setTab] = useState<SubTab>('draw')++ return (+ <div className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07] shrink-0">+ <h3 className="font-bold text-sm">Tools</h3>+ <div className="flex gap-1 mt-2.5 bg-white/[0.05] rounded-xl p-1">+ {SUB_TABS.map((t) => (+ <button+ key={t.id}+ onClick={() => setTab(t.id)}+ className={cn(+ 'flex-1 h-8 rounded-lg text-[11px] font-semibold flex items-center justify-center gap-1 transition-colors',+ tab === t.id ? 'bg-[#7630D7] text-white' : 'text-white/60 hover:text-white hover:bg-white/10'+ )}+ aria-pressed={tab === t.id}+ >+ <t.icon size={12} /> {t.label}+ </button>+ ))}+ </div>+ </div>+ <div className="flex-1 min-h-0 overflow-y-auto">+ {tab === 'draw' && <DrawTab />}+ {tab === 'position' && <PositionTab />}+ {tab === 'background' && <div className="text-[#EDEEF2]"><BackgroundPanel /></div>}+ {tab === 'layers' && <div className="text-[#EDEEF2]"><LayersPanel /></div>}+ </div>+ </div>+ )+}++function DrawTab() {+ const tool = useEditorStore((s) => s.tool)+ const setTool = useEditorStore((s) => s.setTool)+ const drawColor = useEditorStore((s) => s.drawColor)+ const setDrawColor = useEditorStore((s) => s.setDrawColor)+ const drawSize = useEditorStore((s) => s.drawSize)+ const setDrawSize = useEditorStore((s) => s.setDrawSize)++ const swatches = ['#FFFFFF', '#0F1015', '#7630D7', '#02C0CC', '#FF5C8A', '#FFD166', '#22C55E', '#3B82F6', '#F97316', '#EF4444']++ return (+ <div className="p-4 space-y-4">+ <div className="flex gap-2">+ <button+ onClick={() => setTool('draw')}+ className={cn(+ 'flex-1 h-11 rounded-xl border font-semibold text-[13px] flex items-center justify-center gap-2 transition-colors',+ tool === 'draw' ? 'bg-[#7630D7] border-transparent text-white' : 'bg-white/[0.05] border-white/10 text-white/70 hover:bg-white/10'+ )}+ aria-pressed={tool === 'draw'}+ >+ <Brush size={15} /> Draw+ </button>+ <button+ onClick={() => setTool('select')}+ className={cn(+ 'flex-1 h-11 rounded-xl border font-semibold text-[13px] flex items-center justify-center gap-2 transition-colors',+ tool === 'select' ? 'bg-[#7630D7] border-transparent text-white' : 'bg-white/[0.05] border-white/10 text-white/70 hover:bg-white/10'+ )}+ aria-pressed={tool === 'select'}+ >+ <MousePointer2 size={15} /> Select+ </button>+ </div>++ <div>+ <h4 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Brush color</h4>+ <div className="grid grid-cols-5 gap-2">+ {swatches.map((c) => (+ <button+ key={c}+ onClick={() => setDrawColor(c)}+ className={cn('aspect-square rounded-xl border-2 transition-transform hover:scale-105', drawColor === c ? 'border-[#02C0CC] scale-105' : 'border-white/15')}+ style={{ background: c }}+ aria-label={`Brush color ${c}`}+ aria-pressed={drawColor === c}+ />+ ))}+ </div>+ <label className="mt-2 flex items-center gap-2 text-[11px] text-white/50">+ Custom+ <input+ type="color"+ value={drawColor}+ onChange={(e) => setDrawColor(e.target.value)}+ className="w-8 h-8 rounded-lg bg-transparent border border-white/15 cursor-pointer"+ aria-label="Custom brush color"+ />+ </label>+ </div>++ <div>+ <h4 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Brush size — {drawSize}px</h4>+ <input+ type="range"+ min={1}+ max={48}+ value={drawSize}+ onChange={(e) => setDrawSize(parseInt(e.target.value, 10))}+ className="w-full accent-[#7630D7]"+ aria-label="Brush size"+ />+ <div className="mt-2 h-10 rounded-xl bg-white/[0.05] flex items-center justify-center">+ <div className="rounded-full bg-white" style={{ width: Math.min(drawSize, 36), height: Math.min(drawSize, 36) }} />+ </div>+ </div>++ <p className="text-[11px] text-white/40 leading-relaxed">+ Drag on the canvas to sketch. Each stroke becomes an editable path element — recolor, resize or layer it like any element.+ </p>+ <p className="text-[11px] text-white/40 flex items-center gap-1.5">+ <Eraser size={12} /> Use Select then Delete to erase strokes.+ </p>+ </div>+ )+}++function PositionTab() {+ const store = useEditorStore()+ const selected = selectedElements(store)+ const page = currentPageData(store)+ const width = store.width+ const height = store.height+ const moveLayer = store.moveLayer+ const updateElements = store.updateElements++ if (!selected.length) {+ return (+ <div className="p-4">+ <p className="text-[13px] text-white/50 text-center py-10">Select an element to arrange, align or flip it.</p>+ </div>+ )+ }++ const ids = selected.map((e) => e.id)+ const applyAlign = (mode: 'left' | 'center-h' | 'right' | 'top' | 'center-v' | 'bottom') => {+ if (selected.length === 1) {+ const el = selected[0]+ let x = el.x, y = el.y+ if (mode === 'left') x = 0+ if (mode === 'center-h') x = Math.round((width - el.width) / 2)+ if (mode === 'right') x = width - el.width+ if (mode === 'top') y = 0+ if (mode === 'center-v') y = Math.round((height - el.height) / 2)+ if (mode === 'bottom') y = height - el.height+ updateElements(ids, { x, y })+ } else {+ // align multiple to their bounding box+ const minX = Math.min(...selected.map((e) => e.x))+ const maxX = Math.max(...selected.map((e) => e.x + e.width))+ const minY = Math.min(...selected.map((e) => e.y))+ const maxY = Math.max(...selected.map((e) => e.y + e.height))+ const patches = selected.map((el) => {+ let x = el.x, y = el.y+ if (mode === 'left') x = minX+ if (mode === 'center-h') x = Math.round((minX + maxX - el.width) / 2)+ if (mode === 'right') x = maxX - el.width+ if (mode === 'top') y = minY+ if (mode === 'center-v') y = Math.round((minY + maxY - el.height) / 2)+ if (mode === 'bottom') y = maxY - el.height+ return { id: el.id, x, y }+ })+ patches.forEach((p) => updateElements([p.id], { x: p.x, y: p.y }))+ }+ toast({ title: 'Aligned' })+ }++ const flip = (axis: 'x' | 'y') => {+ if (selected.length !== 1) {+ toast({ title: 'Flip works on a single element' })+ return+ }+ const el = selected[0]+ updateElements([el.id], { rotation: axis === 'x' ? (360 - el.rotation) % 360 : (el.rotation + 180) % 360 })+ }++ void page++ const btn = 'flex-1 h-10 rounded-xl bg-white/[0.05] hover:bg-[#7630D7] text-white flex items-center justify-center transition-colors'++ return (+ <div className="p-4 space-y-4">+ <div>+ <h4 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Arrange</h4>+ <div className="grid grid-cols-4 gap-2">+ <button className={btn} onClick={() => moveLayer(ids[0], 'front')} aria-label="Bring to front" title="Bring to front"><BringToFront size={16} /></button>+ <button className={btn} onClick={() => moveLayer(ids[0], 'up')} aria-label="Forward" title="Forward"><ArrowUp size={16} /></button>+ <button className={btn} onClick={() => moveLayer(ids[0], 'down')} aria-label="Backward" title="Backward"><ArrowDown size={16} /></button>+ <button className={btn} onClick={() => moveLayer(ids[0], 'back')} aria-label="Send to back" title="Send to back"><SendToBack size={16} /></button>+ </div>+ </div>++ <div>+ <h4 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Align</h4>+ <div className="grid grid-cols-3 gap-2">+ <button className={btn} onClick={() => applyAlign('left')} aria-label="Align left"><AlignLeft size={15} /></button>+ <button className={btn} onClick={() => applyAlign('center-h')} aria-label="Align horizontal center"><AlignVerticalJustifyCenter size={15} className="rotate-90" /></button>+ <button className={btn} onClick={() => applyAlign('right')} aria-label="Align right"><AlignRight size={15} /></button>+ <button className={btn} onClick={() => applyAlign('top')} aria-label="Align top"><AlignLeft size={15} className="rotate-90" /></button>+ <button className={btn} onClick={() => applyAlign('center-v')} aria-label="Align vertical center"><AlignHorizontalJustifyCenter size={15} /></button>+ <button className={btn} onClick={() => applyAlign('bottom')} aria-label="Align bottom"><AlignRight size={15} className="-rotate-90" /></button>+ </div>+ </div>++ <div>+ <h4 className="text-xs font-semibold text-white/50 uppercase tracking-wide mb-2">Flip</h4>+ <div className="grid grid-cols-2 gap-2">+ <button className="h-10 rounded-xl bg-white/[0.05] hover:bg-[#7630D7] text-white text-[12px] font-semibold flex items-center justify-center gap-1.5 transition-colors" onClick={() => flip('x')}>+ <FlipHorizontal2 size={15} /> Horizontal+ </button>+ <button className="h-10 rounded-xl bg-white/[0.05] hover:bg-[#7630D7] text-white text-[12px] font-semibold flex items-center justify-center gap-1.5 transition-colors" onClick={() => flip('y')}>+ <FlipVertical2 size={15} /> Vertical+ </button>+ </div>+ </div>++ <div className="rounded-xl border border-white/10 bg-white/[0.03] p-3 text-[12px] text-white/60">+ <span className="text-white/90 font-semibold">{selected.length}</span> element{selected.length > 1 ? 's' : ''} selected on this page+ </div>+ </div>+ )+}++void PanelShelldiff --git a/src/components/editor/panels/UploadsPanel.tsx b/src/components/editor/panels/UploadsPanel.tsxindex 8f236c6..b979d69 100644--- a/src/components/editor/panels/UploadsPanel.tsx+++ b/src/components/editor/panels/UploadsPanel.tsx@@ -48,13 +48,13 @@ export function UploadsPanel() {}return (- <div className="flex flex-col h-full">- <div className="px-4 pt-4 pb-3 border-b border-black/5">+ <div className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07]"><h3 className="font-bold text-sm">Uploads</h3>- <p className="text-xs text-muted-foreground mt-0.5">Images stay in this browser session.</p>+ <p className="text-xs text-white/50 mt-0.5">Images stay in this browser session.</p></div><div- className="flex-1 overflow-y-auto cv-scroll p-4"+ className="flex-1 overflow-y-auto cv-scroll-dark p-4"onDragOver={(e) => e.preventDefault()}onDrop={(e) => {e.preventDefault()@@ -63,11 +63,11 @@ export function UploadsPanel() {><buttononClick={() => fileRef.current?.click()}- className="w-full rounded-xl border-2 border-dashed border-black/15 hover:border-[#00C4CC] hover:bg-[#F0FBFC] transition-all py-8 flex flex-col items-center gap-2 text-muted-foreground"+ className="w-full rounded-xl border-2 border-dashed border-white/15 hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all py-8 flex flex-col items-center gap-2 text-white/50"aria-label="Upload images"><Upload size={22} />- <span className="text-sm font-medium">Click or drag images here</span>+ <span className="text-sm font-medium text-white/80">Click or drag images here</span><span className="text-xs">PNG, JPG, SVG, GIF</span></button><input@@ -86,9 +86,9 @@ export function UploadsPanel() {{uploadGallery.items.length > 0 && (<><div className="flex items-center justify-between mt-6 mb-2">- <h4 className="text-xs font-semibold text-muted-foreground">Session uploads</h4>+ <h4 className="text-xs font-semibold text-white/50">Session uploads</h4><button- className="text-xs text-muted-foreground hover:text-red-600 inline-flex items-center gap-1"+ className="text-xs text-white/50 hover:text-red-400 inline-flex items-center gap-1"onClick={() => {uploadGallery.items = []force((n) => n + 1)@@ -102,7 +102,7 @@ export function UploadsPanel() {<buttonkey={i}onClick={() => addImageFromSrc(item.src, item.w, item.h)}- className={cn('rounded-lg overflow-hidden border border-black/8 hover:border-[#00C4CC] transition-all aspect-square bg-[#F4F5F7]')}+ className={cn('rounded-lg overflow-hidden border border-white/10 hover:border-[#7630D7] transition-all aspect-square bg-[#0F1015]')}aria-label="Add uploaded image to canvas"><img src={item.src} alt="Uploaded" className="w-full h-full object-cover" />diff --git a/src/components/editor/panels/panel-shell.tsx b/src/components/editor/panels/panel-shell.tsxnew file mode 100644index 0000000..b77c156--- /dev/null+++ b/src/components/editor/panels/panel-shell.tsx@@ -0,0 +1,76 @@+'use client'++import { useState, type ReactNode } from 'react'+import { Search, Sparkles, Mic, X } from 'lucide-react'+import { cn } from '@/lib/utils'++interface PanelShellProps {+ title: string+ subtitle?: string+ /** canva-style AI prompt + Generate/Search row */+ searchPlaceholder?: string+ onSearch?: (q: string) => void+ children: ReactNode+ /** extra row under the search bar (e.g. filter chips) */+ belowSearch?: ReactNode+ onClose?: () => void+}++/** Dark side-panel shell matching canva.com 2026: header, AI prompt row, purple Search button. */+export function PanelShell({ title, subtitle, searchPlaceholder, onSearch, children, belowSearch, onClose }: PanelShellProps) {+ const [q, setQ] = useState('')+ const submit = () => onSearch?.(q.trim())++ return (+ <div className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07] shrink-0">+ <div className="flex items-center justify-between">+ <h3 className="font-bold text-sm">{title}</h3>+ {onClose && (+ <button onClick={onClose} className="w-7 h-7 rounded-lg flex items-center justify-center text-white/60 hover:text-white hover:bg-white/10 md:hidden" aria-label="Close panel">+ <X size={15} />+ </button>+ )}+ </div>+ {subtitle && <p className="text-xs text-white/50 mt-0.5">{subtitle}</p>}+ </div>++ {searchPlaceholder && (+ <div className="px-4 pt-3 pb-2 shrink-0">+ <div className="flex rounded-xl border border-white/10 bg-white/[0.05] focus-within:border-[#7630D7] transition-colors h-10 items-center px-3 gap-2">+ <Search size={15} className="text-white/40 shrink-0" />+ <input+ value={q}+ onChange={(e) => setQ(e.target.value)}+ onKeyDown={(e) => e.key === 'Enter' && submit()}+ placeholder={searchPlaceholder}+ className="flex-1 min-w-0 bg-transparent outline-none text-[13px] placeholder:text-white/35"+ aria-label={`${title} search`}+ />+ <button className="w-6 h-6 rounded-full flex items-center justify-center text-white/40 hover:text-white shrink-0" aria-label="Describe with AI" title="Describe with AI">+ <Mic size={13} />+ </button>+ </div>++ {/* canva AI row: Generate (split-radius) + purple Search */}+ <div className="flex gap-2 mt-2">+ <button+ className="flex-1 h-10 rounded-l-xl rounded-r-none border border-white/12 bg-white/[0.05] hover:bg-white/10 text-[13px] font-semibold flex items-center justify-center gap-1.5 transition-colors"+ onClick={submit}+ aria-label="Generate with AI"+ title="Generate with AI (open-source roadmap)"+ >+ <Sparkles size={14} className="text-[#02C0CC]" /> Generate+ </button>+ <button className="w-[104px] h-10 rounded-r-xl rounded-l-none bg-[#7630D7] hover:bg-[#8B5CF6] text-white text-[13px] font-semibold transition-colors" onClick={submit} aria-label="Search">+ Search+ </button>+ </div>+ {belowSearch}+ </div>+ )}++ <div className={cn('flex-1 overflow-y-auto cv-scroll-dark', searchPlaceholder ? 'px-4 pb-4 pt-1' : 'p-4')}>{children}</div>+ </div>+ )+}diff --git a/src/lib/types.ts b/src/lib/types.tsindex 21962fa..e4dc449 100644--- a/src/lib/types.ts+++ b/src/lib/types.ts@@ -10,11 +10,24 @@ export type ElementType =| 'star'| 'line'| 'path'+ | 'stroke'| 'image'| 'sticker'export type TextAlign = 'left' | 'center' | 'right'+/** Canva-style text effects */+export type TextEffect = 'none' | 'shadow' | 'lift' | 'hollow' | 'neon' | 'echo'++export const TEXT_EFFECTS: { id: TextEffect; label: string }[] = [+ { id: 'none', label: 'None' },+ { id: 'shadow', label: 'Shadow' },+ { id: 'lift', label: 'Lift' },+ { id: 'hollow', label: 'Hollow' },+ { id: 'neon', label: 'Neon' },+ { id: 'echo', label: 'Echo' },+]+export interface ShadowConfig {enabled: booleancolor: string@@ -50,6 +63,8 @@ export interface TextElement extends BaseElement {align: TextAlignlineHeight: numberletterSpacing: number+ /** canva-style effect preset */+ effect?: TextEffect}export interface ShapeElement extends BaseElement {@@ -85,10 +100,32 @@ export interface StickerElement extends BaseElement {fontSize: number}+/** Freehand stroke — points are [x0,y0,x1,y1,…] relative to (x, y). */+export interface StrokeElement extends BaseElement {+ type: 'stroke'+ points: number[]+ stroke: string+ strokeWidth: number+}++/** Brand kit — persisted per browser (localStorage) */+export interface BrandKit {+ colors: string[]+ headingFont: string+ bodyFont: string+}++export const DEFAULT_BRAND: BrandKit = {+ colors: ['#7630D7', '#02C0CC', '#FF5C8A', '#1F142E', '#FFD166'],+ headingFont: 'Archivo Black',+ bodyFont: 'Inter',+}+export type AnyElement =| TextElement| ShapeElement| LineElement+ | StrokeElement| ImageElement| StickerElement@@ -250,6 +287,31 @@ export function createStickerElement(char: string, init: BaseInit & Partial<Stic}}+export function createStrokeElement(init: BaseInit & Partial<StrokeElement>): StrokeElement {+ return {+ ...baseElement('stroke', init),+ type: 'stroke',+ points: [],+ stroke: '#FFFFFF',+ strokeWidth: 6,+ ...init,+ }+}++/** hex/rgb → rgba with alpha — used by text effect rendering */+export function withAlpha(color: string, alpha: number): string {+ if (color.startsWith('#')) {+ const hex = color.slice(1)+ const full = hex.length === 3 ? hex.split('').map((c) => c + c).join('') : hex+ const r = parseInt(full.slice(0, 2), 16)+ const g = parseInt(full.slice(2, 4), 16)+ const b = parseInt(full.slice(4, 6), 16)+ return `rgba(${r}, ${g}, ${b}, ${alpha})`+ }+ if (color.startsWith('rgb(')) return color.replace('rgb(', 'rgba(').replace(')', `, ${alpha})`)+ return color+}+export function createPage(background: Background = { type: 'solid', color: '#FFFFFF' }): PageData {return { id: uid('page'), background, elements: [] }}@@ -265,6 +327,9 @@ export function isShape(el: AnyElement): el is ShapeElement {export function isLine(el: AnyElement): el is LineElement {return el.type === 'line'}+export function isStroke(el: AnyElement): el is StrokeElement {+ return el.type === 'stroke'+}export function isImage(el: AnyElement): el is ImageElement {return el.type === 'image'}diff --git a/src/store/editor-store.ts b/src/store/editor-store.tsindex ab86be9..0362986 100644--- a/src/store/editor-store.ts+++ b/src/store/editor-store.ts@@ -5,12 +5,25 @@ import {uid,type AnyElement,type Background,+ type BrandKit,+ DEFAULT_BRAND,type DesignRecord,type PageData,} from '@/lib/types'import type { TemplateDef } from '@/lib/templates'-export type PanelId = 'templates' | 'elements' | 'text' | 'uploads' | 'background' | 'layers' | null+export type PanelId =+ | 'templates'+ | 'elements'+ | 'text'+ | 'brand'+ | 'uploads'+ | 'tools'+ | 'projects'+ | 'apps'+ | 'background'+ | 'layers'+ | nullinterface HistoryEntry {pages: PageData[]@@ -38,6 +51,15 @@ interface EditorState {/** increments on every content mutation — used by autosave */version: number+ // canva-2026 chrome+ editingMode: 'editing' | 'viewing'+ previewOpen: boolean+ /** freehand draw tool */+ tool: 'select' | 'draw'+ drawColor: string+ drawSize: number+ brand: BrandKit+// lifecycleloadDesign: (d: DesignRecord) => voidrename: (name: string) => void@@ -79,6 +101,15 @@ interface EditorState {zoomOut: () => voidresetZoom: () => void+ // canva-2026 chrome+ setEditingMode: (m: 'editing' | 'viewing') => void+ setPreviewOpen: (open: boolean) => void+ setTool: (t: 'select' | 'draw') => void+ setDrawColor: (c: string) => void+ setDrawSize: (n: number) => void+ setBrand: (b: BrandKit) => void+ resizeDesign: (width: number, height: number) => void+// panels & savesetPanel: (p: PanelId) => voidmarkSaving: () => void@@ -108,6 +139,13 @@ export const useEditorStore = create<EditorState>((set, get) => ({saving: false,version: 0,+ editingMode: 'editing',+ previewOpen: false,+ tool: 'select',+ drawColor: '#FFFFFF',+ drawSize: 6,+ brand: DEFAULT_BRAND,+loadDesign: (d) =>set({designId: d.id,@@ -123,6 +161,8 @@ export const useEditorStore = create<EditorState>((set, get) => ({dirty: false,savedAt: Date.now(),saving: false,+ previewOpen: false,+ tool: 'select',}),rename: (name) => set({ designName: name, dirty: true }),@@ -320,6 +360,27 @@ export const useEditorStore = create<EditorState>((set, get) => ({zoomOut: () => set({ zoom: Math.max(ZOOM_MIN, get().zoom / 1.2) }),resetZoom: () => set({ zoom: 1 }),+ setEditingMode: (m) => set({ editingMode: m }),+ setPreviewOpen: (open) => set({ previewOpen: open }),+ setTool: (t) => set({ tool: t, selectedIds: [] }),+ setDrawColor: (c) => set({ drawColor: c }),+ setDrawSize: (n) => set({ drawSize: Math.min(64, Math.max(1, n)) }),+ setBrand: (b) => set({ brand: b }),++ resizeDesign: (width, height) => {+ get().pushHistory()+ const { pages } = get()+ const next = clone(pages)+ // keep elements centered when canvas size changes+ for (const page of next) {+ for (const el of page.elements) {+ el.x = Math.round((width - el.width) / 2)+ el.y = Math.round((height - el.height) / 2)+ }+ }+ set({ width, height, pages: next, selectedIds: [], zoom: 1 })+ },+setPanel: (p) => set({ panel: get().panel === p ? null : p }),markSaving: () => set({ saving: true }),