Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
polish onboarding layout and disable zoom (#17885)
Eva H5ad1681cf17f
diff --git a/app/cmd/app/webview.go b/app/cmd/app/webview.goindex f920ee64e..9178a1119 100644--- a/app/cmd/app/webview.go+++ b/app/cmd/app/webview.go@@ -203,6 +203,19 @@ func (w *Webview) Run(path string) unsafe.Pointer {// Add keyboard handler for zoomwv.Init(`window.addEventListener('keydown', function(e) {+ const isZoomShortcut = (e.metaKey || e.ctrlKey) && (+ e.key === '+' || e.key === '=' || e.key === '-' ||+ e.key === '_' || e.key === '0' ||+ e.code === 'NumpadAdd' || e.code === 'NumpadSubtract'+ );++ // Keep the fixed onboarding experience at its intended scale.+ if (window.location.pathname === '/onboarding' && isZoomShortcut) {+ e.preventDefault();+ e.stopImmediatePropagation();+ return false;+ }+// CMD/Ctrl + Plus/Equals (zoom in)if ((e.metaKey || e.ctrlKey) && (e.key === '+' || e.key === '=')) {e.preventDefault();diff --git a/app/ui/app/src/components/Onboarding.test.tsx b/app/ui/app/src/components/Onboarding.test.tsxindex 90b3ded63..dca3b6767 100644--- a/app/ui/app/src/components/Onboarding.test.tsx+++ b/app/ui/app/src/components/Onboarding.test.tsx@@ -9,6 +9,7 @@ import {} from "./Onboarding";import {authenticationTimeoutAction,+ isOnboardingZoomShortcut,nextOnboardingStep,onboardingConnectUrl,} from "@/lib/onboarding";@@ -21,7 +22,9 @@ describe("Onboarding", () => {expect(html.indexOf('alt="Ollama waving"')).toBeLessThan(html.indexOf("Welcome to Ollama!"),);- expect(html).not.toContain("Run open models locally or in the cloud.");+ expect(html).toContain(+ "Run open models with your coding agents so you can spend less while keeping your data private.",+ );expect(html.indexOf("Connect your apps")).toBeLessThan(html.indexOf("Easily switch models"),);@@ -35,6 +38,41 @@ describe("Onboarding", () => {expect(html).not.toContain("Skip");});+ it("blocks browser zoom shortcuts during onboarding", () => {+ expect(+ isOnboardingZoomShortcut({+ metaKey: true,+ ctrlKey: false,+ key: "=",+ code: "Equal",+ }),+ ).toBe(true);+ expect(+ isOnboardingZoomShortcut({+ metaKey: false,+ ctrlKey: true,+ key: "-",+ code: "Minus",+ }),+ ).toBe(true);+ expect(+ isOnboardingZoomShortcut({+ metaKey: false,+ ctrlKey: false,+ key: "+",+ code: "Equal",+ }),+ ).toBe(false);+ expect(+ isOnboardingZoomShortcut({+ metaKey: true,+ ctrlKey: false,+ key: "0",+ code: "Digit0",+ }),+ ).toBe(false);+ });+it("shows the account choice only to signed-out users", () => {expect(nextOnboardingStep("intro", "continue", false)).toBe("welcome");expect(nextOnboardingStep("intro", "continue", true)).toBe("run");diff --git a/app/ui/app/src/components/Onboarding.tsx b/app/ui/app/src/components/Onboarding.tsxindex e05682929..a451c7fdf 100644--- a/app/ui/app/src/components/Onboarding.tsx+++ b/app/ui/app/src/components/Onboarding.tsx@@ -1,6 +1,10 @@import CopyButton from "@/components/CopyButton";import Logo from "@/components/Logo";-import { nextOnboardingStep, type OnboardingStep } from "@/lib/onboarding";+import {+ isOnboardingZoomShortcut,+ nextOnboardingStep,+ type OnboardingStep,+} from "@/lib/onboarding";import {ArrowsRightLeftIcon,CommandLineIcon,@@ -28,16 +32,20 @@ interface RunOllamaScreenProps {}function TitleBar({ onSignIn }: { onSignIn?: () => void }) {+ const isMacOS =+ typeof navigator !== "undefined" &&+ navigator.platform.toLowerCase().includes("mac");+return (<header- className="relative flex h-10 shrink-0 items-center justify-center bg-white"+ className={`relative flex shrink-0 items-center justify-center bg-white ${isMacOS ? "h-[52px]" : "h-10"}`}onDoubleClick={() => window.doubleClick?.()}onMouseDown={() => window.drag?.()}>{onSignIn && (<buttontype="button"- className="absolute right-5 top-3 cursor-pointer rounded-md px-2 py-0 text-sm font-normal text-neutral-500 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"+ className="absolute inset-y-0 right-5 flex cursor-pointer items-center rounded-md px-2 text-sm font-normal leading-none text-neutral-500 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-neutral-500"onClick={onSignIn}onMouseDown={(event) => event.stopPropagation()}>@@ -106,6 +114,10 @@ export function IntroScreen({ onContinue }: { onContinue: () => void }) {Welcome to Ollama!</h1></div>+ <p className="mt-4 max-w-[380px] text-sm leading-6 text-neutral-500">+ Run open models with your coding agents so you can spend less while+ keeping your data private.+ </p><div className="mx-auto mt-8 flex w-fit max-w-full flex-col gap-6 text-left">{OLLAMA_FEATURES.map((feature) => {const Icon = feature.icon;@@ -263,6 +275,15 @@ export default function Onboarding(props: OnboardingProps) {return () => window.setOnboardingWindow?.(false);}, []);+ useEffect(() => {+ const preventZoom = (event: KeyboardEvent) => {+ if (isOnboardingZoomShortcut(event)) event.preventDefault();+ };++ window.addEventListener("keydown", preventZoom, true);+ return () => window.removeEventListener("keydown", preventZoom, true);+ }, []);+if (props.showRun || step === "run") {return (<RunOllamaScreendiff --git a/app/ui/app/src/lib/onboarding.ts b/app/ui/app/src/lib/onboarding.tsindex edfd8f032..704a5b4ee 100644--- a/app/ui/app/src/lib/onboarding.ts+++ b/app/ui/app/src/lib/onboarding.ts@@ -20,6 +20,17 @@ export function onboardingConnectUrl(export const AUTHENTICATION_TIMEOUT_MS = 5 * 60 * 1000;export type OnboardingStep = "intro" | "welcome" | "run";++export function isOnboardingZoomShortcut(+ event: Pick<KeyboardEvent, "metaKey" | "ctrlKey" | "key" | "code">,+) {+ if (!event.metaKey && !event.ctrlKey) return false;++ return (+ ["+", "-", "=", "_"].includes(event.key) ||+ ["Equal", "Minus", "NumpadAdd", "NumpadSubtract"].includes(event.code)+ );+}export type OnboardingAction = "continue" | "local";export type AuthenticationTimeoutAction = "ignore" | "defer" | "fail";