mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
Merge branch 'development' into fix/infinite-scroll-large-screens
This commit is contained in:
commit
12c079f917
39 changed files with 568 additions and 125 deletions
67
.well-known/apple-app-site-association
Normal file
67
.well-known/apple-app-site-association
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"applinks": {
|
||||
"apps": [],
|
||||
"details": [
|
||||
{
|
||||
"appID": "9EWRZ4QP3J.com.stremio.one",
|
||||
"paths": [
|
||||
"/",
|
||||
"/#/player/*",
|
||||
"/#/discover/*",
|
||||
"/#/detail/*",
|
||||
"/#/library/*",
|
||||
"/#/addons/*",
|
||||
"/#/settings",
|
||||
"/#/search/*"
|
||||
],
|
||||
"components": [
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/player/*",
|
||||
"comment": "Matches deep link for player"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/discover/*",
|
||||
"comment": "Matches deep link for discover"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/detail/*",
|
||||
"comment": "Matches deep link for detail"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/library/*",
|
||||
"comment": "Matches deep link for library"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/addons/*",
|
||||
"comment": "Matches deep link for addons"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/settings",
|
||||
"comment": "Matches deep link for settings"
|
||||
},
|
||||
{
|
||||
"/": "/",
|
||||
"#": "/search/*",
|
||||
"comment": "Matches deep link for search"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"activitycontinuation": {
|
||||
"apps": [
|
||||
"9EWRZ4QP3J.com.stremio.one"
|
||||
]
|
||||
},
|
||||
"webcredentials": {
|
||||
"apps": [
|
||||
"9EWRZ4QP3J.com.stremio.one"
|
||||
]
|
||||
}
|
||||
}
|
||||
16
package-lock.json
generated
16
package-lock.json
generated
|
|
@ -12,7 +12,7 @@
|
|||
"@babel/runtime": "7.26.0",
|
||||
"@sentry/browser": "8.42.0",
|
||||
"@stremio/stremio-colors": "5.2.0",
|
||||
"@stremio/stremio-core-web": "0.49.0",
|
||||
"@stremio/stremio-core-web": "0.49.2",
|
||||
"@stremio/stremio-icons": "5.4.1",
|
||||
"@stremio/stremio-video": "0.0.53",
|
||||
"a-color-picker": "1.2.1",
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
"react-i18next": "^15.1.3",
|
||||
"react-is": "18.3.1",
|
||||
"spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#62bcc6e8f44258203c7375af59210771efb6f634",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#a6be0425573917c2e82b66d28968c1a4d444cb96",
|
||||
"url": "0.11.4",
|
||||
"use-long-press": "^3.2.0"
|
||||
},
|
||||
|
|
@ -3371,9 +3371,9 @@
|
|||
"integrity": "sha512-dYlPgu9W/H7c9s1zmW5tiDnRenaUa4Hg1QCyOg1lhOcgSfM/bVTi5nnqX+IfvGTTUNA0zgzh8hI3o3miwnZxTg=="
|
||||
},
|
||||
"node_modules/@stremio/stremio-core-web": {
|
||||
"version": "0.49.0",
|
||||
"resolved": "https://registry.npmjs.org/@stremio/stremio-core-web/-/stremio-core-web-0.49.0.tgz",
|
||||
"integrity": "sha512-oxJRVAE6z6Eh1B0qomdz6L2CVaTkwt70kDNC1TmHyGNo+Hhp2RaMlygqBKvBLXyHUXi82R67Mc11gT/JqlmaMw==",
|
||||
"version": "0.49.2",
|
||||
"resolved": "https://registry.npmjs.org/@stremio/stremio-core-web/-/stremio-core-web-0.49.2.tgz",
|
||||
"integrity": "sha512-IYU+pdHkq4iEfqZ9G+DFZheIE53nY8XyhI1OJLvZp68/4ntRwssXwfj9InHK2Wau20fH+oV2KD1ZWb0CsTLqPA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.24.1"
|
||||
|
|
@ -13372,9 +13372,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/stremio-translations": {
|
||||
"version": "1.44.9",
|
||||
"resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#62bcc6e8f44258203c7375af59210771efb6f634",
|
||||
"integrity": "sha512-8Sc5Qvd4IiObwGXkmj1XFXFavUc15My5po6G48HHDBbp42SVc5I/t7h+1yxW1A81byyBCXbL23a9iU9v49vpQA==",
|
||||
"version": "1.44.10",
|
||||
"resolved": "git+ssh://git@github.com/Stremio/stremio-translations.git#a6be0425573917c2e82b66d28968c1a4d444cb96",
|
||||
"integrity": "sha512-77kVE/eos/SA16kzeK7TTWmqoLF0mLPCJXjITwVIVzMHr8XyBPZFOfmiVEg4M6W1W7qYqA+dHhzicyLs7hJhlw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
"@babel/runtime": "7.26.0",
|
||||
"@sentry/browser": "8.42.0",
|
||||
"@stremio/stremio-colors": "5.2.0",
|
||||
"@stremio/stremio-core-web": "0.49.0",
|
||||
"@stremio/stremio-core-web": "0.49.2",
|
||||
"@stremio/stremio-icons": "5.4.1",
|
||||
"@stremio/stremio-video": "0.0.53",
|
||||
"a-color-picker": "1.2.1",
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
"react-i18next": "^15.1.3",
|
||||
"react-is": "18.3.1",
|
||||
"spatial-navigation-polyfill": "github:Stremio/spatial-navigation#64871b1422466f5f45d24ebc8bbd315b2ebab6a6",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#62bcc6e8f44258203c7375af59210771efb6f634",
|
||||
"stremio-translations": "github:Stremio/stremio-translations#a6be0425573917c2e82b66d28968c1a4d444cb96",
|
||||
"url": "0.11.4",
|
||||
"use-long-press": "^3.2.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -100,14 +100,29 @@ const App = () => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
// Handle shell window visibility changed event
|
||||
// Handle shell events
|
||||
React.useEffect(() => {
|
||||
const onWindowVisibilityChanged = (state) => {
|
||||
setWindowHidden(state.visible === false && state.visibility === 0);
|
||||
};
|
||||
|
||||
const onOpenMedia = (data) => {
|
||||
if (data.startsWith('stremio:///')) return;
|
||||
if (data.startsWith('stremio://')) {
|
||||
const transportUrl = data.replace('stremio://', 'https://');
|
||||
if (URL.canParse(transportUrl)) {
|
||||
window.location.href = `#/addons?addon=${encodeURIComponent(transportUrl)}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
shell.on('win-visibility-changed', onWindowVisibilityChanged);
|
||||
return () => shell.off('win-visibility-changed', onWindowVisibilityChanged);
|
||||
shell.on('open-media', onOpenMedia);
|
||||
|
||||
return () => {
|
||||
shell.off('win-visibility-changed', onWindowVisibilityChanged);
|
||||
shell.off('open-media', onOpenMedia);
|
||||
};
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -14,12 +14,13 @@ const languages = require('./languages');
|
|||
const routesRegexp = require('./routesRegexp');
|
||||
const useAnimationFrame = require('./useAnimationFrame');
|
||||
const useBinaryState = require('./useBinaryState');
|
||||
const useFullscreen = require('./useFullscreen');
|
||||
const { default: useFullscreen } = require('./useFullscreen');
|
||||
const useLiveRef = require('./useLiveRef');
|
||||
const useModelState = require('./useModelState');
|
||||
const useNotifications = require('./useNotifications');
|
||||
const useOnScrollToBottom = require('./useOnScrollToBottom');
|
||||
const useProfile = require('./useProfile');
|
||||
const { default: useSettings } = require('./useSettings');
|
||||
const { default: useShell } = require('./useShell');
|
||||
const useStreamingServer = require('./useStreamingServer');
|
||||
const useTorrent = require('./useTorrent');
|
||||
|
|
@ -52,6 +53,7 @@ module.exports = {
|
|||
useNotifications,
|
||||
useOnScrollToBottom,
|
||||
useProfile,
|
||||
useSettings,
|
||||
useShell,
|
||||
useStreamingServer,
|
||||
useTorrent,
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
|
||||
const React = require('react');
|
||||
|
||||
const useFullscreen = () => {
|
||||
const [fullscreen, setFullscreen] = React.useState(document.fullscreenElement === document.documentElement);
|
||||
const requestFullscreen = React.useCallback(() => {
|
||||
document.documentElement.requestFullscreen();
|
||||
}, []);
|
||||
const exitFullscreen = React.useCallback(() => {
|
||||
document.exitFullscreen();
|
||||
}, []);
|
||||
const toggleFullscreen = React.useCallback(() => {
|
||||
if (fullscreen) {
|
||||
exitFullscreen();
|
||||
} else {
|
||||
requestFullscreen();
|
||||
}
|
||||
}, [fullscreen]);
|
||||
React.useEffect(() => {
|
||||
const onFullscreenChange = () => {
|
||||
setFullscreen(document.fullscreenElement === document.documentElement);
|
||||
};
|
||||
document.addEventListener('fullscreenchange', onFullscreenChange);
|
||||
return () => {
|
||||
document.removeEventListener('fullscreenchange', onFullscreenChange);
|
||||
};
|
||||
}, []);
|
||||
return [fullscreen, requestFullscreen, exitFullscreen, toggleFullscreen];
|
||||
};
|
||||
|
||||
module.exports = useFullscreen;
|
||||
66
src/common/useFullscreen.ts
Normal file
66
src/common/useFullscreen.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import useShell, { type WindowVisibilityState } from './useShell';
|
||||
import useSettings from './useSettings';
|
||||
|
||||
const useFullscreen = () => {
|
||||
const shell = useShell();
|
||||
const [settings] = useSettings();
|
||||
|
||||
const [fullscreen, setFullscreen] = useState(false);
|
||||
|
||||
const requestFullscreen = useCallback(() => {
|
||||
if (shell.active) {
|
||||
shell.send('win-set-visibility', { fullscreen: true });
|
||||
} else {
|
||||
document.documentElement.requestFullscreen();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const exitFullscreen = useCallback(() => {
|
||||
if (shell.active) {
|
||||
shell.send('win-set-visibility', { fullscreen: false });
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
}, []);
|
||||
|
||||
const toggleFullscreen = useCallback(() => {
|
||||
fullscreen ? exitFullscreen() : requestFullscreen();
|
||||
}, [fullscreen]);
|
||||
|
||||
useEffect(() => {
|
||||
const onWindowVisibilityChanged = (state: WindowVisibilityState) => {
|
||||
setFullscreen(state.isFullscreen === true);
|
||||
};
|
||||
|
||||
const onFullscreenChange = () => {
|
||||
setFullscreen(document.fullscreenElement === document.documentElement);
|
||||
};
|
||||
|
||||
const onKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.code === 'Escape' && settings.escExitFullscreen) {
|
||||
exitFullscreen();
|
||||
}
|
||||
|
||||
if (event.code === 'F11' && shell.active) {
|
||||
toggleFullscreen();
|
||||
}
|
||||
};
|
||||
|
||||
shell.on('win-visibility-changed', onWindowVisibilityChanged);
|
||||
document.addEventListener('keydown', onKeyDown);
|
||||
document.addEventListener('fullscreenchange', onFullscreenChange);
|
||||
|
||||
return () => {
|
||||
shell.off('win-visibility-changed', onWindowVisibilityChanged);
|
||||
document.removeEventListener('keydown', onKeyDown);
|
||||
document.removeEventListener('fullscreenchange', onFullscreenChange);
|
||||
};
|
||||
}, [settings.escExitFullscreen]);
|
||||
|
||||
return [fullscreen, requestFullscreen, exitFullscreen, toggleFullscreen];
|
||||
};
|
||||
|
||||
export default useFullscreen;
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
// Copyright (C) 2017-2023 Smart code 203358507
|
||||
// Copyright (C) 2017-2025 Smart code 203358507
|
||||
|
||||
const React = require('react');
|
||||
const { useServices } = require('stremio/services');
|
||||
const { useProfile } = require('stremio/common');
|
||||
import { useCallback } from 'react';
|
||||
import { useServices } from 'stremio/services';
|
||||
import useProfile from './useProfile';
|
||||
|
||||
const useSettings = () => {
|
||||
const useSettings = (): [Settings, (settings: Settings) => void] => {
|
||||
const { core } = useServices();
|
||||
const profile = useProfile();
|
||||
const updateSettings = React.useCallback((settings) => {
|
||||
|
||||
const updateSettings = useCallback((settings: Settings) => {
|
||||
core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
|
|
@ -19,7 +20,8 @@ const useSettings = () => {
|
|||
}
|
||||
});
|
||||
}, [profile]);
|
||||
|
||||
return [profile.settings, updateSettings];
|
||||
};
|
||||
|
||||
module.exports = useSettings;
|
||||
export default useSettings;
|
||||
|
|
@ -17,6 +17,10 @@ type ShellEvent = {
|
|||
args: string[];
|
||||
};
|
||||
|
||||
export type WindowVisibilityState = {
|
||||
isFullscreen: boolean;
|
||||
};
|
||||
|
||||
const createId = () => Math.floor(Math.random() * 9999) + 1;
|
||||
|
||||
const useShell = () => {
|
||||
|
|
@ -28,7 +32,7 @@ const useShell = () => {
|
|||
events.off(name, listener);
|
||||
};
|
||||
|
||||
const send = (method: string, ...args: (string | number)[]) => {
|
||||
const send = (method: string, ...args: (string | number | object)[]) => {
|
||||
try {
|
||||
transport?.postMessage(JSON.stringify({
|
||||
id: createId(),
|
||||
|
|
|
|||
17
src/components/ContextMenu/ContextMenu.less
Normal file
17
src/components/ContextMenu/ContextMenu.less
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
@import (reference) '~@stremio/stremio-colors/less/stremio-colors.less';
|
||||
|
||||
.context-menu-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
.context-menu {
|
||||
position: fixed;
|
||||
border-radius: var(--border-radius);
|
||||
background-color: var(--modal-background-color);
|
||||
box-shadow: 0 1.35rem 2.7rem @color-background-dark5-40,
|
||||
0 1.1rem 0.85rem @color-background-dark5-20;
|
||||
}
|
||||
}
|
||||
101
src/components/ContextMenu/ContextMenu.tsx
Normal file
101
src/components/ContextMenu/ContextMenu.tsx
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import React, { memo, RefObject, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import styles from './ContextMenu.less';
|
||||
|
||||
const PADDING = 8;
|
||||
|
||||
type Coordinates = [number, number];
|
||||
type Size = [number, number];
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode,
|
||||
on: RefObject<HTMLElement>[],
|
||||
autoClose: boolean,
|
||||
};
|
||||
|
||||
const ContextMenu = ({ children, on, autoClose }: Props) => {
|
||||
const [active, setActive] = useState(false);
|
||||
const [position, setPosition] = useState<Coordinates>([0, 0]);
|
||||
const [containerSize, setContainerSize] = useState<Size>([0, 0]);
|
||||
|
||||
const ref = useCallback((element: HTMLDivElement) => {
|
||||
element && setContainerSize([element.offsetWidth, element.offsetHeight]);
|
||||
}, []);
|
||||
|
||||
const style = useMemo(() => {
|
||||
const [viewportWidth, viewportHeight] = [window.innerWidth, window.innerHeight];
|
||||
const [containerWidth, containerHeight] = containerSize;
|
||||
const [x, y] = position;
|
||||
|
||||
const left = Math.max(
|
||||
PADDING,
|
||||
Math.min(
|
||||
x + containerWidth > viewportWidth - PADDING ? x - containerWidth : x,
|
||||
viewportWidth - containerWidth - PADDING
|
||||
)
|
||||
);
|
||||
|
||||
const top = Math.max(
|
||||
PADDING,
|
||||
Math.min(
|
||||
y + containerHeight > viewportHeight - PADDING ? y - containerHeight : y,
|
||||
viewportHeight - containerHeight - PADDING
|
||||
)
|
||||
);
|
||||
|
||||
return { top, left };
|
||||
}, [position, containerSize]);
|
||||
|
||||
const close = () => {
|
||||
setPosition([0, 0]);
|
||||
setActive(false);
|
||||
};
|
||||
|
||||
const stopPropagation = (event: React.MouseEvent | React.TouchEvent) => {
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
const onContextMenu = (event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
|
||||
setPosition([event.clientX, event.clientY]);
|
||||
setActive(true);
|
||||
};
|
||||
|
||||
const handleKeyDown = useCallback((event: KeyboardEvent) => event.key === 'Escape' && close(), []);
|
||||
|
||||
const onClick = useCallback(() => {
|
||||
autoClose && close();
|
||||
}, [autoClose]);
|
||||
|
||||
useEffect(() => {
|
||||
on.forEach((ref) => ref.current && ref.current.addEventListener('contextmenu', onContextMenu));
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
return () => {
|
||||
on.forEach((ref) => ref.current && ref.current.removeEventListener('contextmenu', onContextMenu));
|
||||
document.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, [on]);
|
||||
|
||||
return active && createPortal((
|
||||
<div
|
||||
className={styles['context-menu-container']}
|
||||
onMouseDown={close}
|
||||
onTouchStart={close}
|
||||
>
|
||||
<div
|
||||
ref={ref}
|
||||
className={styles['context-menu']}
|
||||
style={style}
|
||||
onMouseDown={stopPropagation}
|
||||
onTouchStart={stopPropagation}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
), document.body);
|
||||
};
|
||||
|
||||
export default memo(ContextMenu);
|
||||
2
src/components/ContextMenu/index.ts
Normal file
2
src/components/ContextMenu/index.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import ContextMenu from './ContextMenu';
|
||||
export default ContextMenu;
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
bottom: 0;
|
||||
left: var(--vertical-nav-bar-size);
|
||||
z-index: 0;
|
||||
overflow: scroll;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,9 @@
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-radius: 2.5rem;
|
||||
border-radius: 0.5rem;
|
||||
border: var(--focus-outline-size) solid transparent;
|
||||
padding: 0rem 0.5rem;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const PropTypes = require('prop-types');
|
|||
const classnames = require('classnames');
|
||||
const { default: Icon } = require('@stremio/stremio-icons/react');
|
||||
const { Button, Image } = require('stremio/components');
|
||||
const useFullscreen = require('stremio/common/useFullscreen');
|
||||
const { default: useFullscreen } = require('stremio/common/useFullscreen');
|
||||
const usePWA = require('stremio/common/usePWA');
|
||||
const SearchBar = require('./SearchBar');
|
||||
const NavMenu = require('./NavMenu');
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const { useTranslation } = require('react-i18next');
|
|||
const { default: Icon } = require('@stremio/stremio-icons/react');
|
||||
const { useServices } = require('stremio/services');
|
||||
const { Button } = require('stremio/components');
|
||||
const useFullscreen = require('stremio/common/useFullscreen');
|
||||
const { default: useFullscreen } = require('stremio/common/useFullscreen');
|
||||
const useProfile = require('stremio/common/useProfile');
|
||||
const usePWA = require('stremio/common/usePWA');
|
||||
const useTorrent = require('stremio/common/useTorrent');
|
||||
|
|
|
|||
|
|
@ -31,14 +31,18 @@ const Slider = ({ className, value, buffered, minimumValue, maximumValue, disabl
|
|||
const retainThumb = React.useCallback(() => {
|
||||
window.addEventListener('blur', onBlur);
|
||||
window.addEventListener('mouseup', onMouseUp);
|
||||
window.addEventListener('touchend', onTouchEnd);
|
||||
window.addEventListener('mousemove', onMouseMove);
|
||||
window.addEventListener('touchmove', onTouchMove);
|
||||
document.documentElement.className = classnames(document.documentElement.className, styles['active-slider-within']);
|
||||
}, []);
|
||||
const releaseThumb = React.useCallback(() => {
|
||||
cancelThumbAnimation();
|
||||
window.removeEventListener('blur', onBlur);
|
||||
window.removeEventListener('mouseup', onMouseUp);
|
||||
window.removeEventListener('touchend', onTouchEnd);
|
||||
window.removeEventListener('mousemove', onMouseMove);
|
||||
window.removeEventListener('touchmove', onTouchMove);
|
||||
const classList = document.documentElement.className.split(' ');
|
||||
const classIndex = classList.indexOf(styles['active-slider-within']);
|
||||
if (classIndex !== -1) {
|
||||
|
|
@ -85,6 +89,36 @@ const Slider = ({ className, value, buffered, minimumValue, maximumValue, disabl
|
|||
|
||||
retainThumb();
|
||||
}, []);
|
||||
const onTouchStart = React.useCallback((event) => {
|
||||
const touch = event.touches[0];
|
||||
const value = calculateValueForMouseX(touch.clientX);
|
||||
if (typeof onSlideRef.current === 'function') {
|
||||
onSlideRef.current(value);
|
||||
}
|
||||
|
||||
retainThumb();
|
||||
event.preventDefault();
|
||||
}, []);
|
||||
const onTouchMove = React.useCallback((event) => {
|
||||
requestThumbAnimation(() => {
|
||||
const touch = event.touches[0];
|
||||
const value = calculateValueForMouseX(touch.clientX);
|
||||
if (typeof onSlideRef.current === 'function') {
|
||||
onSlideRef.current(value);
|
||||
}
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
}, []);
|
||||
const onTouchEnd = React.useCallback((event) => {
|
||||
const touch = event.changedTouches[0];
|
||||
const value = calculateValueForMouseX(touch.clientX);
|
||||
if (typeof onCompleteRef.current === 'function') {
|
||||
onCompleteRef.current(value);
|
||||
}
|
||||
|
||||
releaseThumb();
|
||||
}, []);
|
||||
React.useLayoutEffect(() => {
|
||||
if (!routeFocused || disabled) {
|
||||
releaseThumb();
|
||||
|
|
@ -98,7 +132,7 @@ const Slider = ({ className, value, buffered, minimumValue, maximumValue, disabl
|
|||
const thumbPosition = Math.max(0, Math.min(1, (valueRef.current - minimumValueRef.current) / (maximumValueRef.current - minimumValueRef.current)));
|
||||
const bufferedPosition = Math.max(0, Math.min(1, (bufferedRef.current - minimumValueRef.current) / (maximumValueRef.current - minimumValueRef.current)));
|
||||
return (
|
||||
<div ref={sliderContainerRef} className={classnames(className, styles['slider-container'], { 'disabled': disabled })} onMouseDown={onMouseDown}>
|
||||
<div ref={sliderContainerRef} className={classnames(className, styles['slider-container'], { 'disabled': disabled })} onMouseDown={onMouseDown} onTouchStart={onTouchStart}>
|
||||
<div className={styles['layer']}>
|
||||
<div className={classnames(styles['track'], { [styles['audio-boost']]: audioBoost })} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ const { useRouteFocused } = require('stremio-router');
|
|||
const { default: Icon } = require('@stremio/stremio-icons/react');
|
||||
const { Button, Image, Popup } = require('stremio/components');
|
||||
const useBinaryState = require('stremio/common/useBinaryState');
|
||||
const useProfile = require('stremio/common/useProfile');
|
||||
const VideoPlaceholder = require('./VideoPlaceholder');
|
||||
const styles = require('./styles');
|
||||
|
||||
const Video = ({ className, id, title, thumbnail, season, episode, released, upcoming, watched, progress, scheduled, seasonWatched, deepLinks, onMarkVideoAsWatched, onMarkSeasonAsWatched, ...props }) => {
|
||||
const routeFocused = useRouteFocused();
|
||||
const profile = useProfile();
|
||||
const [menuOpen, , closeMenu, toggleMenu] = useBinaryState(false);
|
||||
const popupLabelOnMouseUp = React.useCallback((event) => {
|
||||
if (!event.nativeEvent.togglePopupPrevented) {
|
||||
|
|
@ -66,13 +68,14 @@ const Video = ({ className, id, title, thumbnail, season, episode, released, upc
|
|||
}
|
||||
}, [deepLinks]);
|
||||
const renderLabel = React.useMemo(() => function renderLabel({ className, id, title, thumbnail, episode, released, upcoming, watched, progress, scheduled, children, ...props }) {
|
||||
const blurThumbnail = profile.settings.hideSpoilers && season && episode && !watched;
|
||||
return (
|
||||
<Button {...props} className={classnames(className, styles['video-container'])} title={title}>
|
||||
{
|
||||
typeof thumbnail === 'string' && thumbnail.length > 0 ?
|
||||
<div className={styles['thumbnail-container']}>
|
||||
<Image
|
||||
className={styles['thumbnail']}
|
||||
className={classnames(styles['thumbnail'], { [styles['blurred']]: blurThumbnail })}
|
||||
src={thumbnail}
|
||||
alt={' '}
|
||||
renderFallback={() => (
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@
|
|||
object-position: center;
|
||||
opacity: 0.9;
|
||||
background-color: var(--overlay-color);
|
||||
|
||||
&.blurred {
|
||||
filter: blur(0.5rem);
|
||||
-webkit-filter: blur(0.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import Button from './Button';
|
|||
import Checkbox from './Checkbox';
|
||||
import Chips from './Chips';
|
||||
import ColorInput from './ColorInput';
|
||||
import ContextMenu from './ContextMenu';
|
||||
import ContinueWatchingItem from './ContinueWatchingItem';
|
||||
import DelayedRenderer from './DelayedRenderer';
|
||||
import EventModal from './EventModal';
|
||||
|
|
@ -35,6 +36,7 @@ export {
|
|||
Checkbox,
|
||||
Chips,
|
||||
ColorInput,
|
||||
ContextMenu,
|
||||
ContinueWatchingItem,
|
||||
DelayedRenderer,
|
||||
EventModal,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,46 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.placeholder {
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
|
||||
.text {
|
||||
width: 8rem;
|
||||
height: 1.2rem;
|
||||
background-color: var(--overlay-color);
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
|
||||
.video {
|
||||
flex: none;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
height: 3rem;
|
||||
padding: 0 1rem;
|
||||
|
||||
.name {
|
||||
flex: auto;
|
||||
width: 12rem;
|
||||
height: 1.2rem;
|
||||
background-color: var(--overlay-color);
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
|
||||
.info {
|
||||
flex: none;
|
||||
width: 4rem;
|
||||
height: 1.2rem;
|
||||
background-color: var(--overlay-color);
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.today {
|
||||
.heading {
|
||||
background-color: var(--primary-accent-color);
|
||||
|
|
|
|||
23
src/routes/Calendar/List/Item/ItemPlaceholder.tsx
Normal file
23
src/routes/Calendar/List/Item/ItemPlaceholder.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2017-2025 Smart code 203358507
|
||||
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import styles from './Item.less';
|
||||
|
||||
const ItemPlaceholder = () => {
|
||||
return (
|
||||
<div className={classNames(styles['item'], styles['placeholder'])}>
|
||||
<div className={styles['heading']}>
|
||||
<div className={styles['text']} />
|
||||
</div>
|
||||
<div className={styles['body']}>
|
||||
<div className={styles['video']}>
|
||||
<div className={styles['name']} />
|
||||
<div className={styles['info']} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ItemPlaceholder;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (C) 2017-2024 Smart code 203358507
|
||||
|
||||
import Item from './Item';
|
||||
import ItemPlaceholder from './ItemPlaceholder';
|
||||
|
||||
export default Item;
|
||||
export { Item, ItemPlaceholder };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright (C) 2017-2024 Smart code 203358507
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
import Item from './Item';
|
||||
import { Item, ItemPlaceholder } from './Item';
|
||||
import styles from './List.less';
|
||||
|
||||
type Props = {
|
||||
|
|
@ -20,16 +20,21 @@ const List = ({ items, selected, monthInfo, profile, onChange }: Props) => {
|
|||
return (
|
||||
<div className={styles['list']}>
|
||||
{
|
||||
filteredItems.map((item) => (
|
||||
<Item
|
||||
key={item.date.day}
|
||||
{...item}
|
||||
selected={selected}
|
||||
monthInfo={monthInfo}
|
||||
profile={profile}
|
||||
onClick={onChange}
|
||||
/>
|
||||
))
|
||||
items.length === 0 ?
|
||||
[1, 2, 3].map((index) => (
|
||||
<ItemPlaceholder key={index} />
|
||||
))
|
||||
:
|
||||
filteredItems.map((item) => (
|
||||
<Item
|
||||
key={item.date.day}
|
||||
{...item}
|
||||
selected={selected}
|
||||
monthInfo={monthInfo}
|
||||
profile={profile}
|
||||
onClick={onChange}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ const classnames = require('classnames');
|
|||
const { Image } = require('stremio/components');
|
||||
const styles = require('./styles');
|
||||
|
||||
const BufferingLoader = ({ className, logo }) => {
|
||||
const BufferingLoader = React.forwardRef(({ className, logo }, ref) => {
|
||||
return (
|
||||
<div className={classnames(className, styles['buffering-loader-container'])}>
|
||||
<div ref={ref} className={classnames(className, styles['buffering-loader-container'])}>
|
||||
<Image
|
||||
className={styles['buffering-loader']}
|
||||
src={logo}
|
||||
|
|
@ -17,11 +17,11 @@ const BufferingLoader = ({ className, logo }) => {
|
|||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
BufferingLoader.propTypes = {
|
||||
className: PropTypes.string,
|
||||
logo: PropTypes.string
|
||||
logo: PropTypes.string,
|
||||
};
|
||||
|
||||
module.exports = BufferingLoader;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const { useServices } = require('stremio/services');
|
|||
const SeekBar = require('./SeekBar');
|
||||
const VolumeSlider = require('./VolumeSlider');
|
||||
const styles = require('./styles');
|
||||
const { useBinaryState } = require('stremio/common');
|
||||
const { useBinaryState, usePlatform } = require('stremio/common');
|
||||
const { t } = require('i18next');
|
||||
|
||||
const ControlBar = ({
|
||||
|
|
@ -40,9 +40,11 @@ const ControlBar = ({
|
|||
onToggleSideDrawer,
|
||||
onToggleOptionsMenu,
|
||||
onToggleStatisticsMenu,
|
||||
onTouchEnd,
|
||||
...props
|
||||
}) => {
|
||||
const { chromecast } = useServices();
|
||||
const platform = usePlatform();
|
||||
const [chromecastServiceActive, setChromecastServiceActive] = React.useState(() => chromecast.active);
|
||||
const [buttonsMenuOpen, , , toggleButtonsMenu] = useBinaryState(false);
|
||||
const onSubtitlesButtonMouseDown = React.useCallback((event) => {
|
||||
|
|
@ -103,7 +105,7 @@ const ControlBar = ({
|
|||
};
|
||||
}, []);
|
||||
return (
|
||||
<div {...props} className={classnames(className, styles['control-bar-container'])}>
|
||||
<div {...props} onTouchStart={props.onMouseOver} onTouchMove={props.onMouseMove} onTouchEnd={onTouchEnd} className={classnames(className, styles['control-bar-container'])}>
|
||||
<SeekBar
|
||||
className={styles['seek-bar']}
|
||||
time={time}
|
||||
|
|
@ -129,18 +131,23 @@ const ControlBar = ({
|
|||
name={
|
||||
(typeof muted === 'boolean' && muted) ? 'volume-mute' :
|
||||
(volume === null || isNaN(volume)) ? 'volume-off' :
|
||||
volume < 30 ? 'volume-low' :
|
||||
volume < 70 ? 'volume-medium' :
|
||||
'volume-high'
|
||||
volume === 0 ? 'volume-mute' :
|
||||
volume < 30 ? 'volume-low' :
|
||||
volume < 70 ? 'volume-medium' :
|
||||
'volume-high'
|
||||
}
|
||||
/>
|
||||
</Button>
|
||||
<VolumeSlider
|
||||
className={styles['volume-slider']}
|
||||
volume={volume}
|
||||
muted={muted}
|
||||
onVolumeChangeRequested={onVolumeChangeRequested}
|
||||
/>
|
||||
{
|
||||
!platform.isMobile ?
|
||||
<VolumeSlider
|
||||
className={styles['volume-slider']}
|
||||
volume={volume}
|
||||
muted={muted}
|
||||
onVolumeChangeRequested={onVolumeChangeRequested}
|
||||
/>
|
||||
: null
|
||||
}
|
||||
<div className={styles['spacing']} />
|
||||
<Button className={styles['control-bar-buttons-menu-button']} onClick={toggleButtonsMenu}>
|
||||
<Icon className={styles['icon']} name={'more-vertical'} />
|
||||
|
|
@ -206,6 +213,9 @@ ControlBar.propTypes = {
|
|||
onToggleSideDrawer: PropTypes.func,
|
||||
onToggleOptionsMenu: PropTypes.func,
|
||||
onToggleStatisticsMenu: PropTypes.func,
|
||||
onMouseOver: PropTypes.func,
|
||||
onMouseMove: PropTypes.func,
|
||||
onTouchEnd: PropTypes.func,
|
||||
};
|
||||
|
||||
module.exports = ControlBar;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const { default: Icon } = require('@stremio/stremio-icons/react');
|
|||
const { Button } = require('stremio/components');
|
||||
const styles = require('./styles');
|
||||
|
||||
const Error = ({ className, code, message, stream }) => {
|
||||
const Error = React.forwardRef(({ className, code, message, stream }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [playlist, fileName] = React.useMemo(() => {
|
||||
|
|
@ -19,7 +19,7 @@ const Error = ({ className, code, message, stream }) => {
|
|||
}, [stream]);
|
||||
|
||||
return (
|
||||
<div className={classNames(className, styles['error'])}>
|
||||
<div ref={ref} className={classNames(className, styles['error'])}>
|
||||
<div className={styles['error-label']} title={message}>{message}</div>
|
||||
{
|
||||
code === 2 ?
|
||||
|
|
@ -44,7 +44,7 @@ const Error = ({ className, code, message, stream }) => {
|
|||
}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
Error.propTypes = {
|
||||
className: PropTypes.string,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ const React = require('react');
|
|||
const PropTypes = require('prop-types');
|
||||
const classnames = require('classnames');
|
||||
const { default: Icon } = require('@stremio/stremio-icons/react');
|
||||
const { CONSTANTS } = require('stremio/common');
|
||||
const { CONSTANTS, useProfile } = require('stremio/common');
|
||||
const { Button, Image } = require('stremio/components');
|
||||
const styles = require('./styles');
|
||||
|
||||
const NextVideoPopup = ({ className, metaItem, nextVideo, onDismiss, onNextVideoRequested }) => {
|
||||
const profile = useProfile();
|
||||
const blurPosterImage = profile.settings.hideSpoilers && metaItem.type === 'series';
|
||||
const watchNowButtonRef = React.useRef(null);
|
||||
const [animationEnded, setAnimationEnded] = React.useState(false);
|
||||
const videoName = React.useMemo(() => {
|
||||
|
|
@ -51,7 +53,7 @@ const NextVideoPopup = ({ className, metaItem, nextVideo, onDismiss, onNextVideo
|
|||
<div className={classnames(className, styles['next-video-popup-container'])} onAnimationEnd={onAnimationEnd}>
|
||||
<div className={styles['poster-container']}>
|
||||
<Image
|
||||
className={styles['poster-image']}
|
||||
className={classnames(styles['poster-image'], { [styles['blurred']]: blurPosterImage })}
|
||||
src={nextVideo?.thumbnail}
|
||||
alt={' '}
|
||||
fallbackSrc={metaItem?.poster}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@
|
|||
height: 100%;
|
||||
object-position: center;
|
||||
object-fit: cover;
|
||||
|
||||
&.blurred {
|
||||
filter: blur(0.5rem);
|
||||
-webkit-filter: blur(0.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
.placeholder-icon {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ const OptionsMenu = ({ className, stream, playbackDevices }) => {
|
|||
const onMouseDown = React.useCallback((event) => {
|
||||
event.nativeEvent.optionsMenuClosePrevented = true;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={classnames(className, styles['options-menu-container'])} onMouseDown={onMouseDown}>
|
||||
{
|
||||
|
|
@ -112,7 +113,7 @@ const OptionsMenu = ({ className, stream, playbackDevices }) => {
|
|||
OptionsMenu.propTypes = {
|
||||
className: PropTypes.string,
|
||||
stream: PropTypes.object,
|
||||
playbackDevices: PropTypes.array
|
||||
playbackDevices: PropTypes.array,
|
||||
};
|
||||
|
||||
module.exports = OptionsMenu;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ const langs = require('langs');
|
|||
const { useTranslation } = require('react-i18next');
|
||||
const { useRouteFocused } = require('stremio-router');
|
||||
const { useServices } = require('stremio/services');
|
||||
const { onFileDrop, useFullscreen, useBinaryState, useToast, useStreamingServer, withCoreSuspender, CONSTANTS } = require('stremio/common');
|
||||
const { HorizontalNavBar, Transition } = require('stremio/components');
|
||||
const { onFileDrop, useSettings, useFullscreen, useBinaryState, useToast, useStreamingServer, withCoreSuspender, CONSTANTS } = require('stremio/common');
|
||||
const { HorizontalNavBar, Transition, ContextMenu } = require('stremio/components');
|
||||
const BufferingLoader = require('./BufferingLoader');
|
||||
const VolumeChangeIndicator = require('./VolumeChangeIndicator');
|
||||
const Error = require('./Error');
|
||||
|
|
@ -23,7 +23,6 @@ const SpeedMenu = require('./SpeedMenu');
|
|||
const { default: SideDrawerButton } = require('./SideDrawerButton');
|
||||
const { default: SideDrawer } = require('./SideDrawer');
|
||||
const usePlayer = require('./usePlayer');
|
||||
const useSettings = require('./useSettings');
|
||||
const useStatistics = require('./useStatistics');
|
||||
const useVideo = require('./useVideo');
|
||||
const styles = require('./styles');
|
||||
|
|
@ -49,6 +48,10 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
const [casting, setCasting] = React.useState(() => {
|
||||
return chromecast.active && chromecast.transport.getCastState() === cast.framework.CastState.CONNECTED;
|
||||
});
|
||||
const playbackDevices = React.useMemo(() => streamingServer.playbackDevices !== null && streamingServer.playbackDevices.type === 'Ready' ? streamingServer.playbackDevices.content : [], [streamingServer]);
|
||||
|
||||
const bufferingRef = React.useRef();
|
||||
const errorRef = React.useRef();
|
||||
|
||||
const [immersed, setImmersed] = React.useState(true);
|
||||
const setImmersedDebounced = React.useCallback(debounce(setImmersed, 3000), []);
|
||||
|
|
@ -561,6 +564,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
}
|
||||
case 'Escape': {
|
||||
closeMenus();
|
||||
!settings.escExitFullscreen && window.history.back();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -591,7 +595,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
window.removeEventListener('keyup', onKeyUp);
|
||||
window.removeEventListener('wheel', onWheel);
|
||||
};
|
||||
}, [player.metaItem, player.selected, streamingServer.statistics, settings.seekTimeDuration, settings.seekShortTimeDuration, routeFocused, menusOpen, nextVideoPopupOpen, video.state.paused, video.state.time, video.state.volume, video.state.audioTracks, video.state.subtitlesTracks, video.state.extraSubtitlesTracks, video.state.playbackSpeed, toggleSubtitlesMenu, toggleStatisticsMenu, toggleSideDrawer]);
|
||||
}, [player.metaItem, player.selected, streamingServer.statistics, settings.seekTimeDuration, settings.seekShortTimeDuration, settings.escExitFullscreen, routeFocused, menusOpen, nextVideoPopupOpen, video.state.paused, video.state.time, video.state.volume, video.state.audioTracks, video.state.subtitlesTracks, video.state.extraSubtitlesTracks, video.state.playbackSpeed, toggleSubtitlesMenu, toggleStatisticsMenu, toggleSideDrawer]);
|
||||
|
||||
React.useEffect(() => {
|
||||
video.events.on('error', onError);
|
||||
|
|
@ -626,7 +630,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
onMouseOver={onContainerMouseMove}
|
||||
onMouseLeave={onContainerMouseLeave}>
|
||||
<Video
|
||||
ref={video.containerElement}
|
||||
ref={video.containerRef}
|
||||
className={styles['layer']}
|
||||
onClick={onVideoClick}
|
||||
onDoubleClick={onVideoDoubleClick}
|
||||
|
|
@ -641,13 +645,18 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
}
|
||||
{
|
||||
(video.state.buffering || !video.state.loaded) && !error ?
|
||||
<BufferingLoader className={classnames(styles['layer'], styles['buffering-layer'])} logo={player?.metaItem?.content?.logo} />
|
||||
<BufferingLoader
|
||||
ref={bufferingRef}
|
||||
className={classnames(styles['layer'], styles['buffering-layer'])}
|
||||
logo={player?.metaItem?.content?.logo}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
error !== null ?
|
||||
<Error
|
||||
ref={errorRef}
|
||||
className={classnames(styles['layer'], styles['error-layer'])}
|
||||
stream={video.state.stream}
|
||||
{...error}
|
||||
|
|
@ -670,6 +679,13 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
:
|
||||
null
|
||||
}
|
||||
<ContextMenu on={[video.containerRef, bufferingRef, errorRef]} autoClose>
|
||||
<OptionsMenu
|
||||
className={classnames(styles['layer'], styles['menu-layer'])}
|
||||
stream={player?.selected?.stream}
|
||||
playbackDevices={playbackDevices}
|
||||
/>
|
||||
</ContextMenu>
|
||||
<HorizontalNavBar
|
||||
className={classnames(styles['layer'], styles['nav-bar-layer'])}
|
||||
title={player.title !== null ? player.title : ''}
|
||||
|
|
@ -717,6 +733,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
onToggleSideDrawer={toggleSideDrawer}
|
||||
onMouseMove={onBarMouseMove}
|
||||
onMouseOver={onBarMouseMove}
|
||||
onTouchEnd={onContainerMouseLeave}
|
||||
/>
|
||||
{
|
||||
nextVideoPopupOpen ?
|
||||
|
|
@ -797,7 +814,7 @@ const Player = ({ urlParams, queryParams }) => {
|
|||
<OptionsMenu
|
||||
className={classnames(styles['layer'], styles['menu-layer'])}
|
||||
stream={player.selected.stream}
|
||||
playbackDevices={streamingServer.playbackDevices !== null && streamingServer.playbackDevices.type === 'Ready' ? streamingServer.playbackDevices.content : []}
|
||||
playbackDevices={playbackDevices}
|
||||
/>
|
||||
:
|
||||
null
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ const VolumeChangeIndicator = React.memo(({ muted, volume }) => {
|
|||
const prevVolume = React.useRef(volume);
|
||||
|
||||
const iconName = React.useMemo(() => {
|
||||
return typeof muted === 'boolean' && muted ? 'volume-mute' :
|
||||
return (typeof muted === 'boolean' && muted) ? 'volume-mute' :
|
||||
volume === null || isNaN(volume) ? 'volume-off' :
|
||||
volume < 30 ? 'volume-low' :
|
||||
volume < 70 ? 'volume-medium' :
|
||||
'volume-high';
|
||||
volume === 0 ? 'volume-mute' :
|
||||
volume < 30 ? 'volume-low' :
|
||||
volume < 70 ? 'volume-medium' :
|
||||
'volume-high';
|
||||
}, [muted, volume]);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
|
|
|||
2
src/routes/Player/useSettings.d.ts
vendored
2
src/routes/Player/useSettings.d.ts
vendored
|
|
@ -1,2 +0,0 @@
|
|||
declare const useSettings: () => [Settings, (settings: any) => void];
|
||||
export = useSettings;
|
||||
|
|
@ -8,7 +8,7 @@ const events = new EventEmitter();
|
|||
|
||||
const useVideo = () => {
|
||||
const video = React.useRef(null);
|
||||
const containerElement = React.useRef(null);
|
||||
const containerRef = React.useRef(null);
|
||||
|
||||
const [state, setState] = React.useState({
|
||||
manifest: null,
|
||||
|
|
@ -42,11 +42,11 @@ const useVideo = () => {
|
|||
});
|
||||
|
||||
const dispatch = (action, options) => {
|
||||
if (video.current && containerElement.current) {
|
||||
if (video.current && containerRef.current) {
|
||||
try {
|
||||
video.current.dispatch(action, {
|
||||
...options,
|
||||
containerElement: containerElement.current,
|
||||
containerElement: containerRef.current,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Video:', error);
|
||||
|
|
@ -157,7 +157,7 @@ const useVideo = () => {
|
|||
|
||||
return {
|
||||
events,
|
||||
containerElement,
|
||||
containerRef,
|
||||
state,
|
||||
load,
|
||||
unload,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ const Settings = () => {
|
|||
const toast = useToast();
|
||||
const {
|
||||
interfaceLanguageSelect,
|
||||
hideSpoilersToggle,
|
||||
subtitlesLanguageSelect,
|
||||
subtitlesSizeSelect,
|
||||
subtitlesTextColorInput,
|
||||
|
|
@ -181,7 +182,12 @@ const Settings = () => {
|
|||
{ t('SETTINGS_NAV_SHORTCUTS') }
|
||||
</Button>
|
||||
<div className={styles['spacing']} />
|
||||
<div className={styles['version-info-label']} title={process.env.VERSION}>App Version: {process.env.VERSION}</div>
|
||||
<div className={styles['version-info-label']} title={process.env.VERSION}>
|
||||
App Version: {process.env.VERSION}
|
||||
</div>
|
||||
<div className={styles['version-info-label']} title={process.env.COMMIT_HASH}>
|
||||
Build Version: {process.env.COMMIT_HASH}
|
||||
</div>
|
||||
{
|
||||
streamingServer.settings !== null && streamingServer.settings.type === 'Ready' ?
|
||||
<div className={styles['version-info-label']} title={streamingServer.settings.content.serverVersion}>Server Version: {streamingServer.settings.content.serverVersion}</div>
|
||||
|
|
@ -336,12 +342,34 @@ const Settings = () => {
|
|||
/>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
shell.active &&
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
<div className={styles['label']}>{ t('SETTINGS_FULLSCREEN_EXIT') }</div>
|
||||
</div>
|
||||
<Toggle
|
||||
className={classnames(styles['option-input-container'], styles['toggle-container'])}
|
||||
{...escExitFullscreenToggle}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
<div className={styles['label']}>{ t('SETTINGS_BLUR_UNWATCHED_IMAGE') }</div>
|
||||
</div>
|
||||
<Toggle
|
||||
className={classnames(styles['option-input-container'], styles['toggle-container'])}
|
||||
tabIndex={-1}
|
||||
{...hideSpoilersToggle}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div ref={playerSectionRef} className={styles['section-container']}>
|
||||
<div className={styles['section-title']}>{ t('SETTINGS_NAV_PLAYER') }</div>
|
||||
<div className={styles['section-category-container']}>
|
||||
<Icon className={styles['icon']} name={'subtitles'} />
|
||||
<div className={styles['label']}>{t('SETTINGS_CLOSE_WINDOW')}</div>
|
||||
<div className={styles['label']}>{t('SETTINGS_SECTION_SUBTITLES')}</div>
|
||||
</div>
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
|
|
@ -352,20 +380,6 @@ const Settings = () => {
|
|||
{...subtitlesLanguageSelect}
|
||||
/>
|
||||
</div>
|
||||
{
|
||||
shell.active ?
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
<div className={styles['label']}>{ t('SETTINGS_FULLSCREEN_EXIT') }</div>
|
||||
</div>
|
||||
<Toggle
|
||||
className={classnames(styles['option-input-container'], styles['toggle-container'])}
|
||||
{...escExitFullscreenToggle}
|
||||
/>
|
||||
</div>
|
||||
:
|
||||
null
|
||||
}
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
<div className={styles['label']}>{ t('SETTINGS_SUBTITLES_SIZE') }</div>
|
||||
|
|
@ -722,6 +736,18 @@ const Settings = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles['option-container']}>
|
||||
<div className={styles['option-name-container']}>
|
||||
<div className={styles['label']}>
|
||||
Build Version
|
||||
</div>
|
||||
</div>
|
||||
<div className={classnames(styles['option-input-container'], styles['info-container'])}>
|
||||
<div className={styles['label']}>
|
||||
{process.env.COMMIT_HASH}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{
|
||||
streamingServer.settings !== null && streamingServer.settings.type === 'Ready' ?
|
||||
<div className={styles['option-container']}>
|
||||
|
|
|
|||
|
|
@ -64,8 +64,11 @@
|
|||
.version-info-label {
|
||||
flex: 0 1 auto;
|
||||
margin: 0.5rem 0;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--primary-foreground-color);
|
||||
opacity: 0.3;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -242,6 +245,8 @@
|
|||
flex-shrink: 1;
|
||||
flex-basis: auto;
|
||||
line-height: 1.5rem;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--primary-foreground-color);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,22 @@ const useProfileSettingsInputs = (profile) => {
|
|||
}
|
||||
}), [profile.settings]);
|
||||
|
||||
const hideSpoilersToggle = React.useMemo(() => ({
|
||||
checked: profile.settings.hideSpoilers,
|
||||
onClick: () => {
|
||||
core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'UpdateSettings',
|
||||
args: {
|
||||
...profile.settings,
|
||||
hideSpoilers: !profile.settings.hideSpoilers
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}), [profile.settings]);
|
||||
|
||||
const quitOnCloseToggle = React.useMemo(() => ({
|
||||
checked: profile.settings.quitOnClose,
|
||||
onClick: () => {
|
||||
|
|
@ -325,6 +341,7 @@ const useProfileSettingsInputs = (profile) => {
|
|||
}), [profile.settings]);
|
||||
return {
|
||||
interfaceLanguageSelect,
|
||||
hideSpoilersToggle,
|
||||
subtitlesLanguageSelect,
|
||||
subtitlesSizeSelect,
|
||||
subtitlesTextColorInput,
|
||||
|
|
|
|||
1
src/types/models/Ctx.d.ts
vendored
1
src/types/models/Ctx.d.ts
vendored
|
|
@ -21,6 +21,7 @@ type Settings = {
|
|||
hardwareDecoding: boolean,
|
||||
escExitFullscreen: boolean,
|
||||
interfaceLanguage: string,
|
||||
hideSpoilers: boolean,
|
||||
nextVideoNotificationDuration: number,
|
||||
playInBackground: boolean,
|
||||
playerType: string | null,
|
||||
|
|
|
|||
|
|
@ -234,6 +234,7 @@ module.exports = (env, argv) => ({
|
|||
{ from: 'favicons', to: 'favicons' },
|
||||
{ from: 'images', to: 'images' },
|
||||
{ from: 'screenshots/*.webp', to: './' },
|
||||
{ from: '.well-known', to: '.well-known' },
|
||||
]
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
|
|
|
|||
Loading…
Reference in a new issue