Skip to content

Commit

Permalink
DuckPlayer page - mobile support (#1028)
Browse files Browse the repository at this point in the history
* DuckPlayer page - mobile support

* exclude screenshot tests by default (for now)

* exclude preact dev tools

---------

Co-authored-by: Shane Osbourne <sosbourne@duckduckgo.com>
  • Loading branch information
shakyShane and Shane Osbourne authored Sep 9, 2024
1 parent 29b9b45 commit 610978c
Show file tree
Hide file tree
Showing 43 changed files with 719 additions and 335 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"posttest-int": "npm run test-int --workspaces --if-present",
"posttest-int-x": "npm run test-int-x --workspaces --if-present",
"serve": "http-server -c-1 --port 3220 integration-test/test-pages",
"serve-special-pages": "http-server -c-1 --port 3221 build/integration/pages",
"playwright": "playwright test",
"playwright-headed": "playwright test --headed",
"preplaywright": "npm run build-windows && npm run build-apple && npm run build-android",
Expand Down
4 changes: 2 additions & 2 deletions packages/messaging/lib/test-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export function mockAndroidMessaging(params) {

// if it's a notification, simulate the empty response and don't check for a response
if (!('id' in msg)) {
return console.warn("no id");
return;
}

if (!(msg.method in window.__playwright_01.mockResponses)) {
Expand Down Expand Up @@ -238,7 +238,7 @@ export function mockResponses(params) {
export function waitForCallCount(params) {
const outgoing = window.__playwright_01.mocks.outgoing
const filtered = outgoing.filter(({ payload }) => params.method === payload.method)
return filtered.length === params.count
return filtered.length >= params.count
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/special-pages/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const support = {
'integration': ['copy', 'build-js'],
'windows': ['copy', 'build-js'],
'apple': ['copy', 'build-js', 'inline-html'],
'android': ['copy', 'build-js']
},
/** @type {Partial<Record<ImportMeta['injectName'], string[]>>} */
errorpage: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
"enum": ["macos", "windows", "android", "ios"]
}
}
},
"localeStrings": {
"type": "string",
"description": "Optional locale-specific strings"
}
}
}
3 changes: 2 additions & 1 deletion packages/special-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"build": "node index.mjs",
"build.dev": "node index.mjs --env development",
"test": "npm run test.unit && playwright test",
"test": "npm run test.unit && playwright test --grep-invert '@screenshots'",
"test.screenshots": "npm run test.unit && playwright test --grep '@screenshots'",
"test.windows": "npm run test -- --project windows",
"test.macos": "npm run test -- --project macos",
"test.ios": "npm run test -- --project ios",
Expand Down
199 changes: 0 additions & 199 deletions packages/special-pages/pages/duckplayer/app/components/App.jsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
flex-shrink: 0;
box-shadow: none;
background: rgba(255, 255, 255, 0.12);
border-radius: 8px;
border-radius: var(--inner-radius);
font-weight: bold;
color: rgba(255, 255, 255, 1);
text-decoration: none;
Expand All @@ -24,8 +24,6 @@
flex: 1;
text-align: center;
justify-content: center;
padding-left: 4px;
padding-right: 4px;
text-wrap: nowrap;
text-overflow: ellipsis;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { h, Fragment } from "preact";
import styles from "./DesktopApp.module.css";
import { Background } from "./Background.jsx";
import { InfoBar, InfoBarContainer } from "./InfoBar.jsx";
import { PlayerContainer } from "./PlayerContainer.jsx";
import { Player, PlayerError } from "./Player.jsx";
import { useSettings } from "../providers/SettingsProvider.jsx";
import { createAppFeaturesFrom } from "../features/app.js";
import { HideInFocusMode } from "./FocusMode.jsx";


/**
* @param {object} props
* @param {import("../embed-settings.js").EmbedSettings|null} props.embed
*/
export function DesktopApp({ embed }) {
const settings = useSettings();
const features = createAppFeaturesFrom(settings)
return (
<>
<Background />
{features.focusMode()}
<main class={styles.app}>
<DesktopLayout embed={embed} />
</main>
</>
)
}

/**
* @param {object} props
* @param {import("../embed-settings.js").EmbedSettings|null} props.embed
*/
function DesktopLayout({embed}) {
return (
<div class={styles.desktop}>
<PlayerContainer>
{embed === null && <PlayerError layout={'desktop'} kind={'invalid-id'} />}
{embed !== null && <Player src={embed.toEmbedUrl()} layout={'desktop'} />}
<HideInFocusMode style={"slide"}>
<InfoBarContainer>
<InfoBar embed={embed}/>
</InfoBarContainer>
</HideInFocusMode>
</PlayerContainer>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
:root {
/* Set video to take up 80vw width */
--video-width: 80vw;
--outer-radius: 16px;
--inner-radius: 8px;
}

@media screen and (max-width: 1080px) {
Expand Down Expand Up @@ -84,7 +86,7 @@
grid-template-columns: 60% 1fr;
grid-column-gap: 8px;
background: rgba(0, 0, 0, 0.3);
border-radius: 16px;
border-radius: var(--outer-radius);
padding: 8px;
@media screen and (max-width: 700px) {
grid-template-columns: 50% 1fr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@ import styles from "./FloatingBar.module.css"
import { h } from "preact";
import cn from "classnames";


/**
* @param {object} props
* @param {import("preact").ComponentChild} props.children
*/
export function BottomNavBar({children}) {
return (
<div class={styles.bottomNavBar}>
{children}
</div>
)
}

/**
* @param {object} props
* @param {import("preact").ComponentChild} props.children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
}

.inset {
border-radius: 8px;
border-radius: var(--outer-radius);
padding: 8px;
background: rgba(0, 0, 0, 0.3);
}

.bottomNavBar {
}


.topBar {
display: grid;
justify-content: center;
Expand Down
Loading

0 comments on commit 610978c

Please sign in to comment.