Skip to content

Commit 610978c

Browse files
shakyShaneShane Osbourne
andauthored
DuckPlayer page - mobile support (#1028)
* DuckPlayer page - mobile support * exclude screenshot tests by default (for now) * exclude preact dev tools --------- Co-authored-by: Shane Osbourne <[email protected]>
1 parent 29b9b45 commit 610978c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+719
-335
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"posttest-int": "npm run test-int --workspaces --if-present",
4040
"posttest-int-x": "npm run test-int-x --workspaces --if-present",
4141
"serve": "http-server -c-1 --port 3220 integration-test/test-pages",
42+
"serve-special-pages": "http-server -c-1 --port 3221 build/integration/pages",
4243
"playwright": "playwright test",
4344
"playwright-headed": "playwright test --headed",
4445
"preplaywright": "npm run build-windows && npm run build-apple && npm run build-android",

packages/messaging/lib/test-utils.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export function mockAndroidMessaging(params) {
196196

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

202202
if (!(msg.method in window.__playwright_01.mockResponses)) {
@@ -238,7 +238,7 @@ export function mockResponses(params) {
238238
export function waitForCallCount(params) {
239239
const outgoing = window.__playwright_01.mocks.outgoing
240240
const filtered = outgoing.filter(({ payload }) => params.method === payload.method)
241-
return filtered.length === params.count
241+
return filtered.length >= params.count
242242
}
243243

244244
/**

packages/special-pages/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const support = {
2929
'integration': ['copy', 'build-js'],
3030
'windows': ['copy', 'build-js'],
3131
'apple': ['copy', 'build-js', 'inline-html'],
32+
'android': ['copy', 'build-js']
3233
},
3334
/** @type {Partial<Record<ImportMeta['injectName'], string[]>>} */
3435
errorpage: {

packages/special-pages/messages/duckplayer/initialSetup.response.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
"enum": ["macos", "windows", "android", "ios"]
5858
}
5959
}
60+
},
61+
"localeStrings": {
62+
"type": "string",
63+
"description": "Optional locale-specific strings"
6064
}
6165
}
6266
}

packages/special-pages/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"scripts": {
99
"build": "node index.mjs",
1010
"build.dev": "node index.mjs --env development",
11-
"test": "npm run test.unit && playwright test",
11+
"test": "npm run test.unit && playwright test --grep-invert '@screenshots'",
12+
"test.screenshots": "npm run test.unit && playwright test --grep '@screenshots'",
1213
"test.windows": "npm run test -- --project windows",
1314
"test.macos": "npm run test -- --project macos",
1415
"test.ios": "npm run test -- --project ios",

packages/special-pages/pages/duckplayer/app/components/App.jsx

Lines changed: 0 additions & 199 deletions
This file was deleted.

packages/special-pages/pages/duckplayer/app/components/Button.module.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
flex-shrink: 0;
1010
box-shadow: none;
1111
background: rgba(255, 255, 255, 0.12);
12-
border-radius: 8px;
12+
border-radius: var(--inner-radius);
1313
font-weight: bold;
1414
color: rgba(255, 255, 255, 1);
1515
text-decoration: none;
@@ -24,8 +24,6 @@
2424
flex: 1;
2525
text-align: center;
2626
justify-content: center;
27-
padding-left: 4px;
28-
padding-right: 4px;
2927
text-wrap: nowrap;
3028
text-overflow: ellipsis;
3129
overflow: hidden;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { h, Fragment } from "preact";
2+
import styles from "./DesktopApp.module.css";
3+
import { Background } from "./Background.jsx";
4+
import { InfoBar, InfoBarContainer } from "./InfoBar.jsx";
5+
import { PlayerContainer } from "./PlayerContainer.jsx";
6+
import { Player, PlayerError } from "./Player.jsx";
7+
import { useSettings } from "../providers/SettingsProvider.jsx";
8+
import { createAppFeaturesFrom } from "../features/app.js";
9+
import { HideInFocusMode } from "./FocusMode.jsx";
10+
11+
12+
/**
13+
* @param {object} props
14+
* @param {import("../embed-settings.js").EmbedSettings|null} props.embed
15+
*/
16+
export function DesktopApp({ embed }) {
17+
const settings = useSettings();
18+
const features = createAppFeaturesFrom(settings)
19+
return (
20+
<>
21+
<Background />
22+
{features.focusMode()}
23+
<main class={styles.app}>
24+
<DesktopLayout embed={embed} />
25+
</main>
26+
</>
27+
)
28+
}
29+
30+
/**
31+
* @param {object} props
32+
* @param {import("../embed-settings.js").EmbedSettings|null} props.embed
33+
*/
34+
function DesktopLayout({embed}) {
35+
return (
36+
<div class={styles.desktop}>
37+
<PlayerContainer>
38+
{embed === null && <PlayerError layout={'desktop'} kind={'invalid-id'} />}
39+
{embed !== null && <Player src={embed.toEmbedUrl()} layout={'desktop'} />}
40+
<HideInFocusMode style={"slide"}>
41+
<InfoBarContainer>
42+
<InfoBar embed={embed}/>
43+
</InfoBarContainer>
44+
</HideInFocusMode>
45+
</PlayerContainer>
46+
</div>
47+
)
48+
}

packages/special-pages/pages/duckplayer/app/components/App.module.css renamed to packages/special-pages/pages/duckplayer/app/components/DesktopApp.module.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
:root {
22
/* Set video to take up 80vw width */
33
--video-width: 80vw;
4+
--outer-radius: 16px;
5+
--inner-radius: 8px;
46
}
57

68
@media screen and (max-width: 1080px) {
@@ -84,7 +86,7 @@
8486
grid-template-columns: 60% 1fr;
8587
grid-column-gap: 8px;
8688
background: rgba(0, 0, 0, 0.3);
87-
border-radius: 16px;
89+
border-radius: var(--outer-radius);
8890
padding: 8px;
8991
@media screen and (max-width: 700px) {
9092
grid-template-columns: 50% 1fr;

packages/special-pages/pages/duckplayer/app/components/FloatingBar.jsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,6 @@ import styles from "./FloatingBar.module.css"
22
import { h } from "preact";
33
import cn from "classnames";
44

5-
6-
/**
7-
* @param {object} props
8-
* @param {import("preact").ComponentChild} props.children
9-
*/
10-
export function BottomNavBar({children}) {
11-
return (
12-
<div class={styles.bottomNavBar}>
13-
{children}
14-
</div>
15-
)
16-
}
17-
185
/**
196
* @param {object} props
207
* @param {import("preact").ComponentChild} props.children

0 commit comments

Comments
 (0)