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.

Video guides: Help menu in the top bar, 0.11 video in Other devices, 0.12 video in What's new

Gabriele Lozupone97c584904f39
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 62aa812..be6328b 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -259,7 +259,8 @@ fn open_folder(app: tauri::AppHandle, path: String) -> Result<(), String> {
#[tauri::command]
fn open_link(app: tauri::AppHandle, url: String) -> Result<(), String> {
use tauri_plugin_opener::OpenerExt;
- let allowed = ["https://github.com/", "https://huggingface.co/", "https://kokon.app/"];
+ // youtu.be: the video guides (src/lib/videos.ts), opened in the browser, never embedded.
+ let allowed = ["https://github.com/", "https://huggingface.co/", "https://kokon.app/", "https://youtu.be/"];
if !allowed.iter().any(|p| url.starts_with(p)) || url.chars().any(|c| c.is_whitespace() || c == '"') {
return Err("This link cannot be opened from the app.".into());
}
diff --git a/src/components/RemoteAccess.tsx b/src/components/RemoteAccess.tsx
index 98f0ee5..7200b6c 100644
--- a/src/components/RemoteAccess.tsx
+++ b/src/components/RemoteAccess.tsx
@@ -2,12 +2,13 @@
// laptop on the same network. Off until the user sets a password and turns it on; the service
// opens the network port only then (crates/qls-service/src/remote.rs).
-import { Copy, ExternalLink } from "lucide-react";
+import { CirclePlay, Copy, ExternalLink } from "lucide-react";
import { useEffect, useMemo, useState } from "react";
import { writeText } from "@tauri-apps/plugin-clipboard-manager";
import { encode } from "uqr";
import { api, type RemoteStatus } from "../lib/api";
import { native } from "../lib/native";
+import { VIDEOS } from "../lib/videos";
import { toastError, toastInfo } from "../lib/store";
import { Switch } from "./ui";
@@ -154,9 +155,14 @@ export function RemoteAccess() {
network: allow it on private networks.
</span>
</div>
- <button className="btn" onClick={() => native.openLink(GUIDE_URL).catch(toastError)}>
- <ExternalLink size={14} /> Guide
- </button>
+ <div className="row-btns">
+ <button className="btn" onClick={() => native.openLink(VIDEOS.remote011.url).catch(toastError)} title="A video of setting it up on a phone, on YouTube (opens in your browser)">
+ <CirclePlay size={14} /> Video
+ </button>
+ <button className="btn" onClick={() => native.openLink(GUIDE_URL).catch(toastError)}>
+ <ExternalLink size={14} /> Guide
+ </button>
+ </div>
</div>
</>
);
diff --git a/src/components/TopBar.tsx b/src/components/TopBar.tsx
index c473b72..66cdc5d 100644
--- a/src/components/TopBar.tsx
+++ b/src/components/TopBar.tsx
@@ -1,7 +1,8 @@
// The top bar: the project's title, then undo/redo, the update pill, the status capsule,
-// private mode, shortcuts and (only while the sidebar is hidden) Settings, then the window's
+// private mode, the Help menu (shortcuts, video guides, prompt tips) and (only while the sidebar is hidden) Settings, then the window's
// buttons. Its own file so the launch video (marketing/video) shows the same bar.
-import { ArrowDownToLine, CircleHelp, EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2 } from "lucide-react";
+import { ArrowDownToLine, CircleHelp, CirclePlay, EyeOff, Keyboard, Lightbulb, PanelLeft, Redo2, Settings, SquarePen, Undo2 } from "lucide-react";
+import type { ReactNode } from "react";
import { api } from "../lib/api";
import { native } from "../lib/native";
import { haptic } from "../lib/haptics";
@@ -11,7 +12,8 @@ import { installUpdate } from "../lib/updates";
import { SilkSpin } from "./Cocoon";
import { ProjectTitle, Wordmark } from "./Sidebar";
import { WindowControls } from "./TitleBar";
-import { IconButton } from "./ui";
+import { VIDEOS } from "../lib/videos";
+import { IconButton, Popover } from "./ui";
/** `quiet`: nothing while the model is loaded and idle (the phone bar has no room for "all is well"). */
export function StatusIndicator({ quiet = false }: { quiet?: boolean }) {
@@ -117,6 +119,42 @@ export function togglePrivateMode() {
setPrivateMode(!getState().privateMode, () => native.confirm("Turn off private mode? The images made in private mode will be deleted.", "Private mode"));
}
+/** The "?" button: shortcuts, the video guides on YouTube (opened in the browser) and the prompt tips. */
+export function HelpMenu() {
+ const item = (icon: ReactNode, label: string, onClick: () => void, sub?: string) => (
+ <button className="opt" role="menuitem" onClick={onClick}>
+ <span className="check">{icon}</span>
+ <span>{label}</span>
+ {sub && <span className="sub">{sub}</span>}
+ </button>
+ );
+ const video = (v: { url: string; title: string }, close: () => void) =>
+ item(<CirclePlay size={15} />, v.title, () => (close(), native.openLink(v.url).catch(toastError)));
+ return (
+ <Popover
+ className="help-menu"
+ placement="bottom-end"
+ trigger={(open, toggle) => (
+ <button className={`icon-btn ${open ? "active" : ""}`} title="Help" aria-label="Help" aria-haspopup="menu" aria-expanded={open} onClick={toggle}>
+ <CircleHelp size={18} />
+ </button>
+ )}
+ >
+ {(close) => (
+ <div role="menu" aria-label="Help">
+ {item(<Keyboard size={15} />, "Keyboard shortcuts", () => (close(), setState({ overlay: "shortcuts" })), "?")}
+ {item(<Lightbulb size={15} />, "Prompt tips", () => (close(), setState({ overlay: "prompt-tips" })))}
+ <div className="menu-sep" />
+ <div className="label">Video guides · YouTube</div>
+ {video(VIDEOS.useCases, close)}
+ {video(VIDEOS.update012, close)}
+ {video(VIDEOS.remote011, close)}
+ </div>
+ )}
+ </Popover>
+ );
+}
+
export function TopBar() {
const overlay = useStore((s) => s.overlay);
const needsSetup = useStore((s) => s.needsSetup);
@@ -142,9 +180,7 @@ export function TopBar() {
<UpdatePill />
<StatusIndicator />
{!needsSetup && <PrivateToggle />}
- <IconButton title="Shortcuts (?)" onClick={() => setState({ overlay: "shortcuts" })}>
- <CircleHelp size={18} />
- </IconButton>
+ <HelpMenu />
{/* Settings lives at the foot of the sidebar; here only while the sidebar is hidden. */}
{(!sidebar || needsSetup) && (
<IconButton title="Settings" onClick={() => setState({ overlay: "settings" })}>
diff --git a/src/components/WhatsNew.tsx b/src/components/WhatsNew.tsx
index fc01c78..e2bfae5 100644
--- a/src/components/WhatsNew.tsx
+++ b/src/components/WhatsNew.tsx
@@ -1,9 +1,11 @@
-import { CircleAlert, FolderTree, Layers, Palette, ShieldCheck, Sparkles, WandSparkles } from "lucide-react";
+import { CircleAlert, CirclePlay, FolderTree, Layers, Palette, ShieldCheck, Sparkles, WandSparkles } from "lucide-react";
import { useEffect, useState } from "react";
import { api } from "../lib/api";
import { formatBytes, installProgress, installStep, installTimeLeft, modelChoiceUi, modelOfferDue, whatsNewDue as due } from "../lib/logic";
import { afterStartScreens, refreshStatus, setState, toastError, useStore } from "../lib/store";
import type { GpuBackend, InstallItem, InstallStatus, ModelsStatus } from "../lib/types";
+import { native } from "../lib/native";
+import { VIDEOS } from "../lib/videos";
import { KokonMark } from "./Welcome";
/** The release these notes describe. Shown once to people updating from an earlier version. */
@@ -14,6 +16,7 @@ const NEWS = [
icon: Layers,
title: "Layers lab (experimental)",
text: "Split a photo into layers: click the objects, Kokon cuts them out and fills the background behind them. Move, resize, hide or edit each one, draw new objects with the pencil, then save one image or a PSD for Photoshop.",
+ video: VIDEOS.update012.url,
},
{
icon: Sparkles,
@@ -179,11 +182,21 @@ export function WhatsNew() {
<KokonMark size={44} />
<h1>What's new in Kokon {WHATS_NEW_VERSION}</h1>
<div className="welcome-grid">
- {NEWS.map(({ icon: Icon, title, text }) => (
+ {NEWS.map(({ icon: Icon, title, text, video }: { icon: typeof Layers; title: string; text: string; video?: string }) => (
<div className="welcome-item" key={title}>
<Icon size={20} />
<strong>{title}</strong>
- <span>{text}</span>
+ <span>
+ {text}
+ {video && (
+ <>
+ {" "}
+ <button className="link-btn" onClick={() => native.openLink(video).catch(toastError)} title="On YouTube (opens in your browser)">
+ <CirclePlay size={13} /> Watch the 0.12 video
+ </button>
+ </>
+ )}
+ </span>
</div>
))}
</div>
diff --git a/src/lib/native.ts b/src/lib/native.ts
index c20d699..82327a1 100644
--- a/src/lib/native.ts
+++ b/src/lib/native.ts
@@ -60,7 +60,7 @@ export const native = {
reveal: (path: string) => invoke<void>("reveal", { path }),
openFolder: (path: string) => invoke<void>("open_folder", { path }),
dataFolder: () => invoke<string>("data_folder"),
- /** https links to github.com / huggingface.co only (desktop). */
+ /** https links to github.com / huggingface.co / kokon.app / youtu.be only (desktop). */
openLink: async (url: string) => {
if (inBrowser) window.open(url, "_blank", "noopener,noreferrer");
else await invoke<void>("open_link", { url });
diff --git a/src/lib/videos.ts b/src/lib/videos.ts
new file mode 100644
index 0000000..3124649
--- /dev/null
+++ b/src/lib/videos.ts
@@ -0,0 +1,11 @@
+// Video guides on YouTube (decision 11-04): opened in the browser, never embedded, so nothing is
+// fetched from Google until the user clicks. src-tauri open_link allows https://youtu.be/.
+export const VIDEOS = {
+ /** What Kokon can do: remove people, restore, colorize, try-ons, home, text (85 s). */
+ useCases: { url: "https://youtu.be/WDbHxkbpU4s", title: "What you can do with Kokon" },
+ /** 0.12: Layers lab, Blend into scene, PSD, paint with colours, Mac engine (2:21). */
+ update012: { url: "https://youtu.be/eGr9yYe7NVc", title: "What's new in 0.12: Layers lab, colours" },
+ /** 0.11: use Kokon from your phone or another computer (77 s). */
+ remote011: { url: "https://youtu.be/XnC_7P2_cww", title: "Use Kokon from your phone" },
+} as const;
+
diff --git a/src/styles.css b/src/styles.css
index c2e78c4..18fd2d8 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -1330,3 +1330,10 @@ kbd { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; display
.blend-buttons { display: flex; gap: 8px; }
@media (max-width: 560px) { .blend-fields { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .split-choice, .split-card { animation: none; transition: none; } }
+/* Help menu ("?" in the top bar): shortcuts, prompt tips, the video guides. */
+.popover.help-menu { width: 300px; }
+.popover.help-menu .opt > span:not(.check):not(.sub) { flex: 1; min-width: 0; }
+.popover.help-menu .opt .check { flex: none; color: var(--text-2); }
+.welcome-item .link-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; vertical-align: baseline; }
+.welcome-item .link-btn svg { margin: 0; }
+.row-btns { display: flex; gap: 6px; flex: none; }