From 72dcadfa794a87f00544621e44de8716a371e986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=7BAI=7Df=20D=2E=20M=C3=BCller?= Date: Sun, 8 Mar 2026 13:47:10 +0100 Subject: [PATCH] feat: Embed YouTube video on mobile too in onboarding modal Remove matchMedia conditional - always render iframe embed instead of falling back to a link on mobile. Co-Authored-By: Claude Opus 4.6 --- website/src/components/onboarding-modal.js | 19 ---------- .../src/components/onboarding-modal.test.js | 35 +++---------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/website/src/components/onboarding-modal.js b/website/src/components/onboarding-modal.js index 759156f..fc66e4d 100644 --- a/website/src/components/onboarding-modal.js +++ b/website/src/components/onboarding-modal.js @@ -72,7 +72,6 @@ function escapeHtml(str) { function buildModalContent() { const lang = i18n.currentLang() const videoId = YOUTUBE_VIDEOS[lang] || YOUTUBE_VIDEOS.en - const youtubeUrl = `https://youtube.com/shorts/${videoId}` const embedUrl = `https://www.youtube.com/embed/${videoId}` const baseUrl = import.meta.env.BASE_URL @@ -111,9 +110,6 @@ function buildModalContent() {
- ${ - window.matchMedia('(min-width: 640px)').matches - ? `
- ` - : ` - - - - - ${watchVideo} - - ` - }
diff --git a/website/src/components/onboarding-modal.test.js b/website/src/components/onboarding-modal.test.js index cf56fec..577122d 100644 --- a/website/src/components/onboarding-modal.test.js +++ b/website/src/components/onboarding-modal.test.js @@ -8,32 +8,17 @@ import { } from './onboarding-modal.js' describe('onboarding-modal', () => { - let originalMatchMedia - beforeEach(() => { localStorage.clear() i18n.init() // Note: innerHTML usage here is in test code only, not production. // The test DOM is reset between tests and contains no user input. document.body.innerHTML = '' - // Mock matchMedia - default to desktop (min-width: 640px matches) - originalMatchMedia = window.matchMedia - window.matchMedia = (query) => ({ - matches: query === '(min-width: 640px)', - media: query, - onchange: null, - addListener: () => {}, - removeListener: () => {}, - addEventListener: () => {}, - removeEventListener: () => {}, - dispatchEvent: () => false, - }) }) afterEach(() => { document.body.innerHTML = '' document.body.style.overflow = '' - window.matchMedia = originalMatchMedia }) describe('shouldShowOnboarding', () => { @@ -83,7 +68,7 @@ describe('onboarding-modal', () => { expect(modal.textContent).toContain('One word, and the AI gets the rest.') }) - it('contains the YouTube embed for desktop', () => { + it('contains the YouTube embed', () => { createOnboardingModal() showOnboarding() @@ -101,25 +86,13 @@ describe('onboarding-modal', () => { expect(iframe.src).toContain('youtube.com/embed/cp-qqiHU-MA') }) - it('contains YouTube link on mobile instead of iframe', () => { - window.matchMedia = (query) => ({ - matches: false, - media: query, - onchange: null, - addListener: () => {}, - removeListener: () => {}, - addEventListener: () => {}, - removeEventListener: () => {}, - dispatchEvent: () => false, - }) + it('always embeds video iframe regardless of screen size', () => { createOnboardingModal() showOnboarding() - const link = document.querySelector('#onboarding-modal a[href*="youtube.com/shorts"]') - expect(link).toBeTruthy() - expect(link.getAttribute('target')).toBe('_blank') const iframe = document.querySelector('#onboarding-modal iframe') - expect(iframe).toBeNull() + expect(iframe).toBeTruthy() + expect(iframe.src).toContain('youtube.com/embed/') }) })