Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Add a welcome screen, a showcase during setup and first-steps tips

Gabriele Lozupone72a6bb076338
diff --git a/src/App.tsx b/src/App.tsx
index 22a23e5..a66799d 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -16,6 +16,7 @@ import { ProjectTitle, Sidebar } from "./components/Sidebar";
import { Stage } from "./components/Stage";
import { IconButton } from "./components/ui";
import { shortcut } from "./lib/platform";
+import { Welcome } from "./components/Welcome";
const IMAGE_EXT = /\.(png|jpe?g|webp|bmp|gif|tiff?|heic|heif)$/i;
@@ -150,7 +151,9 @@ export default function App() {
startEvents();
const cfg = await api.config();
const st = await refreshStatus();
- setState({ needsSetup: !cfg.setupComplete });
+ // First launch: the welcome screen, once (Settings → General shows it again).
+ const welcomeSeen = !!(cfg.ui as Record<string, unknown> | null)?.welcomeSeen;
+ setState({ needsSetup: !cfg.setupComplete, ...(welcomeSeen ? {} : { overlay: "welcome" }) });
setBoot("ok");
// Preload the model so the first generation starts immediately.
if (cfg.setupComplete && st && st.server.state === "stopped") api.startBackend().then(refreshStatus, () => refreshStatus());
@@ -295,6 +298,7 @@ export default function App() {
{!needsSetup && overlay !== "inpaint" && overlay !== "expand" && overlay !== "gallery" && <Composer />}
</div>
{overlay === "settings" && <SettingsDialog />}
+ {overlay === "welcome" && <Welcome />}
<Toasts />
</div>
);
diff --git a/src/assets/kokon-mark.svg b/src/assets/kokon-mark.svg
new file mode 100644
index 0000000..47c1732
--- /dev/null
+++ b/src/assets/kokon-mark.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1024" height="1024">
+<path fill="#0D0D0D" d="M0.00 242.81 C0.00 112.17 70.23 25.08 175.59 25.08 C280.94 25.08 351.17 112.17 351.17 242.81 L351.17 781.19 C351.17 911.83 280.94 998.92 175.59 998.92 C70.23 998.92 0.00 911.83 0.00 781.19 Z M389.53 548.95 C389.53 250.35 662.35 25.08 1024.00 25.08 C1024.00 323.68 751.18 548.95 389.53 548.95 Z M389.53 587.31 C389.53 821.93 618.71 998.92 922.49 998.92 C922.49 764.30 693.31 587.31 389.53 587.31 Z"/>
+</svg>
diff --git a/src/assets/showcase/expand.jpg b/src/assets/showcase/expand.jpg
new file mode 100644
index 0000000..6f25519
Binary files /dev/null and b/src/assets/showcase/expand.jpg differ
diff --git a/src/assets/showcase/fatto-in-casa.jpg b/src/assets/showcase/fatto-in-casa.jpg
new file mode 100644
index 0000000..e03343f
Binary files /dev/null and b/src/assets/showcase/fatto-in-casa.jpg differ
diff --git a/src/assets/showcase/kokon-demo.mp4 b/src/assets/showcase/kokon-demo.mp4
new file mode 100644
index 0000000..4126549
Binary files /dev/null and b/src/assets/showcase/kokon-demo.mp4 differ
diff --git a/src/assets/showcase/relight.jpg b/src/assets/showcase/relight.jpg
new file mode 100644
index 0000000..6c8d496
Binary files /dev/null and b/src/assets/showcase/relight.jpg differ
diff --git a/src/assets/showcase/remove.jpg b/src/assets/showcase/remove.jpg
new file mode 100644
index 0000000..06a692f
Binary files /dev/null and b/src/assets/showcase/remove.jpg differ
diff --git a/src/assets/showcase/replace.jpg b/src/assets/showcase/replace.jpg
new file mode 100644
index 0000000..55fe261
Binary files /dev/null and b/src/assets/showcase/replace.jpg differ
diff --git a/src/assets/showcase/restyle.jpg b/src/assets/showcase/restyle.jpg
new file mode 100644
index 0000000..d3382f5
Binary files /dev/null and b/src/assets/showcase/restyle.jpg differ
diff --git a/src/assets/showcase/text.jpg b/src/assets/showcase/text.jpg
new file mode 100644
index 0000000..10633b9
Binary files /dev/null and b/src/assets/showcase/text.jpg differ
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 35d75cc..d6934e3 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -173,6 +173,12 @@ export function Settings() {
<input className="input" type="number" min={0} max={1440} style={{ width: 90 }} value={cfg.idleUnloadMinutes} onChange={(e) => set({ idleUnloadMinutes: Math.max(0, Number(e.target.value) || 0) })} />
</label>
<span className="muted" style={{ marginTop: -10 }}>Applies to MCP and API use without the desktop window. 0 keeps it loaded.</span>
+ <div className="field-row">
+ <span>Welcome screen: what Kokon is and how it keeps your work private</span>
+ <button className="btn" onClick={() => setState({ overlay: "welcome" })}>
+ Show
+ </button>
+ </div>
</>
)}
diff --git a/src/components/Setup.tsx b/src/components/Setup.tsx
index bedb57c..69d21c5 100644
--- a/src/components/Setup.tsx
+++ b/src/components/Setup.tsx
@@ -6,6 +6,7 @@ import { native } from "../lib/native";
import { refreshStatus, setState, toastError, useStore } from "../lib/store";
import type { GpuBackend, HardwareReport, InstallItem, InstallStatus, SetupReport } from "../lib/types";
import { Seg, Switch } from "./ui";
+import { ReadyTips, Showcase } from "./Welcome";
const gb = (mib: number) => `${Math.round(mib / 1024)} GB`;
@@ -319,6 +320,8 @@ export function Setup() {
<span>{hw.current === chosen?.id || !chosen ? "Everything is installed." : `The ${chosen.label} files are already here.`}</span>
</div>
)}
+ {presetInstalled && !running && !setupDone && <ReadyTips />}
+ {(running || paused) && <Showcase />}
{/* What gets installed. */}
<div className="field">
diff --git a/src/components/Welcome.tsx b/src/components/Welcome.tsx
new file mode 100644
index 0000000..a6a84ba
--- /dev/null
+++ b/src/components/Welcome.tsx
@@ -0,0 +1,154 @@
+import { ChevronLeft, ChevronRight, CloudOff, Cpu, EyeOff, Infinity as Unlimited } from "lucide-react";
+import { useEffect, useRef, useState } from "react";
+import mark from "../assets/kokon-mark.svg?raw";
+import demo from "../assets/showcase/kokon-demo.mp4";
+import expand from "../assets/showcase/expand.jpg";
+import poster from "../assets/showcase/fatto-in-casa.jpg";
+import relight from "../assets/showcase/relight.jpg";
+import remove from "../assets/showcase/remove.jpg";
+import replace from "../assets/showcase/replace.jpg";
+import restyle from "../assets/showcase/restyle.jpg";
+import text from "../assets/showcase/text.jpg";
+import { api } from "../lib/api";
+import { isMac } from "../lib/platform";
+import { setState, toastError, useStore } from "../lib/store";
+
+const machine = isMac ? "Mac" : "PC";
+
+/** The Kokon mark in the current text color (light and dark themes). */
+export function KokonMark({ size = 40 }: { size?: number }) {
+ const svg = mark.replace(/fill="#[0-9A-Fa-f]{6}"/g, 'fill="currentColor"').replace(/width="\d+" height="\d+"/, `width="${size}" height="${size}"`);
+ return <span className="kokon-mark" aria-hidden dangerouslySetInnerHTML={{ __html: svg }} />;
+}
+
+/** Remembers that the welcome screen was seen (in the app config, so it survives updates). */
+async function markSeen() {
+ try {
+ const cfg = await api.config();
+ const ui = (cfg.ui ?? {}) as Record<string, unknown>;
+ if (!ui.welcomeSeen) await api.saveConfig({ ...cfg, ui: { ...ui, welcomeSeen: true } });
+ } catch (e) {
+ toastError(e);
+ }
+}
+
+const PROMISES = [
+ { icon: Cpu, title: `Made on your ${machine}`, text: "Your graphics chip creates every image. Photos and prompts never leave this computer." },
+ { icon: CloudOff, title: "Online only once", text: "Setup downloads the model. After that Kokon works without an internet connection." },
+ { icon: Unlimited, title: "No limits", text: "No account, no credits, no subscription, no queue. Create as much as you like." },
+ { icon: EyeOff, title: "Private mode", text: "Click the eye icon and nothing is kept: no gallery, no files, no history." },
+];
+
+/** First launch (and Settings → General → Show welcome screen): what Kokon is and why it is private. */
+export function Welcome() {
+ const needsSetup = useStore((s) => s.needsSetup);
+ const close = () => {
+ setState({ overlay: null });
+ markSeen();
+ };
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => e.key === "Escape" && close();
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, []);
+ return (
+ <div className="modal-scrim">
+ <div className="welcome" role="dialog" aria-label="Welcome to Kokon">
+ <KokonMark size={44} />
+ <h1>Welcome to Kokon</h1>
+ <p className="welcome-lead">
+ A private image studio that lives on your {machine}. Describe a new image, or a change to a photo, in plain words. Like a cocoon, Kokon is a closed space where something new
+ takes shape, and nothing gets out unless you take it out.
+ </p>
+ <div className="welcome-grid">
+ {PROMISES.map(({ icon: Icon, title, text }) => (
+ <div className="welcome-item" key={title}>
+ <Icon size={20} />
+ <strong>{title}</strong>
+ <span>{text}</span>
+ </div>
+ ))}
+ </div>
+ <button className="btn primary big" onClick={close}>
+ {needsSetup ? "Set up Kokon" : "Start creating"}
+ </button>
+ <span className="muted welcome-foot">You can open this again from Settings → General.</span>
+ </div>
+ </div>
+ );
+}
+
+const SLIDES: { src: string; video?: boolean; title: string; prompt: string }[] = [
+ { src: demo, video: true, title: "One project, start to finish", prompt: "Create, edit, combine and expand: the whole flow in under a minute." },
+ { src: remove, title: "Remove", prompt: "“Remove all the people from the beach”" },
+ { src: replace, title: "Replace", prompt: "“Replace the orange car with a blue vintage Vespa scooter”" },
+ { src: relight, title: "Relight", prompt: "“Make it golden hour, warm low sunlight”" },
+ { src: restyle, title: "Restyle", prompt: "“Turn it into a watercolor illustration”" },
+ { src: text, title: "Change text", prompt: "“Change the neon sign to say ‘OPEN LATE’”" },
+ { src: expand, title: "Expand", prompt: "Expand to 16:9 · “continue the beach”" },
+];
+
+/** What Kokon can do, shown while the model downloads (the wait is the best moment for it). */
+export function Showcase() {
+ const [i, setI] = useState(0);
+ const video = useRef<HTMLVideoElement>(null);
+ const slide = SLIDES[i];
+ const go = (d: number) => setI((n) => (n + d + SLIDES.length) % SLIDES.length);
+ // Photos advance every 6 s; the video advances when it ends.
+ useEffect(() => {
+ if (slide.video) return;
+ const t = window.setTimeout(() => go(1), 6000);
+ return () => window.clearTimeout(t);
+ }, [i]);
+ return (
+ <div className="showcase">
+ <div className="showcase-head">
+ <strong>While you wait: what you can do</strong>
+ <span className="muted">
+ {i + 1} / {SLIDES.length}
+ </span>
+ </div>
+ <div className="showcase-media">
+ {slide.video ? (
+ <video ref={video} key={slide.src} src={slide.src} poster={poster} autoPlay muted playsInline onEnded={() => go(1)} />
+ ) : (
+ <img key={slide.src} src={slide.src} alt={`${slide.title}: before and after`} />
+ )}
+ <button className="showcase-nav prev" onClick={() => go(-1)} aria-label="Previous">
+ <ChevronLeft size={18} />
+ </button>
+ <button className="showcase-nav next" onClick={() => go(1)} aria-label="Next">
+ <ChevronRight size={18} />
+ </button>
+ </div>
+ <div className="showcase-caption">
+ <strong>{slide.title}</strong>
+ <span>{slide.prompt}</span>
+ </div>
+ <div className="showcase-dots">
+ {SLIDES.map((s, n) => (
+ <button key={s.src} className={n === i ? "on" : ""} onClick={() => setI(n)} aria-label={s.title} />
+ ))}
+ </div>
+ </div>
+ );
+}
+
+/** Shown once everything is installed, before the first Start. */
+export function ReadyTips() {
+ return (
+ <div className="ready-tips">
+ <strong>Three ways to begin</strong>
+ <ol>
+ <li>Drop or paste a photo, then describe the change: “make it golden hour”.</li>
+ <li>
+ Switch to <b>New image</b> and describe something that does not exist yet.
+ </li>
+ <li>
+ Use <b>Paint area</b> to brush over part of a photo, and only that part changes.
+ </li>
+ </ol>
+ <span className="muted">Want nothing saved? Turn on Private mode with the eye icon at the top.</span>
+ </div>
+ );
+}
diff --git a/src/lib/store.ts b/src/lib/store.ts
index e54c637..ce2e6e9 100644
--- a/src/lib/store.ts
+++ b/src/lib/store.ts
@@ -10,7 +10,7 @@ import { api, ApiError, setPrivateInputs, subscribe } from "./api";
import { buildRequest, emptyComposer, needsPrompt, newKey, persistentAdvanced, refFromGen, refFromInput, timelineLinks, undoTarget, versionLabels, type CompareMode, type Composer, type Ref } from "./logic";
import type { AppErrorBody, GenerationRecord, GenerationRequest, InputRecord, JobView, ServerState, StatusResponse } from "./types";
-export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand";
+export type Overlay = null | "gallery" | "settings" | "inpaint" | "expand" | "welcome";
export interface SessionItem {
key: string;
diff --git a/src/styles.css b/src/styles.css
index 06cae6b..313f989 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -444,3 +444,38 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
/* a thumbnail dragged from the timeline */
.drag-ghost { position: fixed; z-index: 100; width: 56px; height: 56px; object-fit: cover; border-radius: 10px; pointer-events: none; transform: translate(-50%, -60%) rotate(-3deg); box-shadow: var(--shadow); opacity: 0.85; }
.drag-ghost.over { opacity: 1; transform: translate(-50%, -60%) scale(1.08); }
+
+/* Welcome (first launch), showcase (while downloading), ready tips (end of setup). */
+.kokon-mark { display: inline-flex; color: var(--text); }
+.kokon-mark svg { display: block; }
+.welcome { width: min(620px, 92vw); max-height: 90vh; overflow-y: auto; background: var(--bg); border-radius: 22px; box-shadow: var(--shadow); padding: 36px 36px 26px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; animation: welcome-in 0.35s ease-out; }
+.welcome h1 { font-size: 26px; letter-spacing: -0.02em; margin: 4px 0 0; }
+.welcome-lead { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; max-width: 500px; text-wrap: balance; }
+.welcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin: 8px 0 6px; text-align: left; }
+.welcome-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border-radius: 14px; font-size: 13px; line-height: 1.45; }
+.welcome-item svg { margin-bottom: 4px; }
+.welcome-item strong { font-size: 14px; }
+.welcome-item span { color: var(--text-2); }
+.welcome .btn.big { min-width: 200px; justify-content: center; }
+.welcome-foot { font-size: 12px; }
+@keyframes welcome-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
+@media (max-width: 560px) { .welcome-grid { grid-template-columns: 1fr; } .welcome { padding: 28px 20px 20px; } }
+
+.showcase { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; }
+.showcase-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
+.showcase-media { position: relative; aspect-ratio: 2 / 1; border-radius: 10px; overflow: hidden; background: var(--surface); }
+.showcase-media img, .showcase-media video { width: 100%; height: 100%; object-fit: contain; display: block; animation: welcome-fade 0.4s ease-out; }
+.showcase-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--text); box-shadow: var(--shadow); opacity: 0; transition: opacity 0.15s; }
+.showcase-media:hover .showcase-nav { opacity: 0.92; }
+.showcase-nav.prev { left: 10px; }
+.showcase-nav.next { right: 10px; }
+.showcase-caption { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
+.showcase-caption span { color: var(--text-2); }
+.showcase-dots { display: flex; gap: 6px; justify-content: center; }
+.showcase-dots button { width: 6px; height: 6px; padding: 0; border-radius: 50%; background: var(--surface-3); }
+.showcase-dots button.on { background: var(--text); }
+@keyframes welcome-fade { from { opacity: 0; } to { opacity: 1; } }
+
+.ready-tips { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; background: var(--surface); border-radius: 14px; font-size: 13px; line-height: 1.5; }
+.ready-tips ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
+@media (prefers-reduced-motion: reduce) { .welcome, .showcase-media img, .showcase-media video { animation: none; } }