mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Refactoring Section Container
This commit is contained in:
parent
c3e253d98d
commit
12995545b9
11 changed files with 257 additions and 183 deletions
|
@ -36,7 +36,7 @@ function getShortcutOptions() {
|
|||
};
|
||||
}
|
||||
|
||||
interface ItemsContainerProps {
|
||||
export interface ItemsContainerProps {
|
||||
className?: string;
|
||||
isContextMenuEnabled?: boolean;
|
||||
isMultiSelectEnabled?: boolean;
|
||||
|
@ -136,14 +136,13 @@ const ItemsContainer: FC<PropsWithChildren<ItemsContainerProps>> = ({
|
|||
}
|
||||
|
||||
if (!itemId) throw new Error('null itemId');
|
||||
if (!newIndex) throw new Error('null newIndex');
|
||||
|
||||
try {
|
||||
loading.show();
|
||||
await playlistsMoveItemMutation({
|
||||
playlistId,
|
||||
itemId,
|
||||
newIndex
|
||||
newIndex: newIndex || 0
|
||||
});
|
||||
loading.hide();
|
||||
} catch (error) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import ScrollerFactory from 'lib/scroller';
|
|||
import ScrollButtons from '../emby-scrollbuttons/ScrollButtons';
|
||||
import './emby-scroller.scss';
|
||||
|
||||
interface ScrollerProps {
|
||||
export interface ScrollerProps {
|
||||
className?: string;
|
||||
isHorizontalEnabled?: boolean;
|
||||
isMouseWheelEnabled?: boolean;
|
||||
|
@ -23,14 +23,14 @@ interface ScrollerProps {
|
|||
|
||||
const Scroller: FC<PropsWithChildren<ScrollerProps>> = ({
|
||||
className,
|
||||
isHorizontalEnabled,
|
||||
isMouseWheelEnabled,
|
||||
isCenterFocusEnabled,
|
||||
isScrollButtonsEnabled,
|
||||
isSkipFocusWhenVisibleEnabled,
|
||||
isScrollEventEnabled,
|
||||
isHideScrollbarEnabled,
|
||||
isAllowNativeSmoothScrollEnabled,
|
||||
isHorizontalEnabled = true,
|
||||
isMouseWheelEnabled = false,
|
||||
isCenterFocusEnabled = false,
|
||||
isScrollButtonsEnabled = true,
|
||||
isSkipFocusWhenVisibleEnabled = false,
|
||||
isScrollEventEnabled = false,
|
||||
isHideScrollbarEnabled = false,
|
||||
isAllowNativeSmoothScrollEnabled = false,
|
||||
children
|
||||
}) => {
|
||||
const [scrollRef, size] = useElementSize();
|
||||
|
@ -158,27 +158,23 @@ const Scroller: FC<PropsWithChildren<ScrollerProps>> = ({
|
|||
return;
|
||||
}
|
||||
|
||||
const horizontal = isHorizontalEnabled !== false;
|
||||
const scrollbuttons = isScrollButtonsEnabled !== false;
|
||||
const mousewheel = isMouseWheelEnabled !== false;
|
||||
|
||||
const enableScrollButtons = layoutManager.desktop && horizontal && scrollbuttons;
|
||||
const enableScrollButtons = layoutManager.desktop && isHorizontalEnabled && isScrollButtonsEnabled;
|
||||
|
||||
const options = {
|
||||
horizontal: horizontal,
|
||||
horizontal: isHorizontalEnabled,
|
||||
mouseDragging: 1,
|
||||
mouseWheel: mousewheel,
|
||||
mouseWheel: isMouseWheelEnabled,
|
||||
touchDragging: 1,
|
||||
slidee: scrollRef.current?.querySelector('.scrollSlider'),
|
||||
scrollBy: 200,
|
||||
speed: horizontal ? 270 : 240,
|
||||
speed: isHorizontalEnabled ? 270 : 240,
|
||||
elasticBounds: 1,
|
||||
dragHandle: 1,
|
||||
autoImmediate: true,
|
||||
skipSlideToWhenVisible: isSkipFocusWhenVisibleEnabled === true,
|
||||
dispatchScrollEvent: enableScrollButtons || isScrollEventEnabled === true,
|
||||
hideScrollbar: enableScrollButtons || isHideScrollbarEnabled === true,
|
||||
allowNativeSmoothScroll: isAllowNativeSmoothScrollEnabled === true && !enableScrollButtons,
|
||||
skipSlideToWhenVisible: isSkipFocusWhenVisibleEnabled,
|
||||
dispatchScrollEvent: enableScrollButtons || isScrollEventEnabled,
|
||||
hideScrollbar: enableScrollButtons || isHideScrollbarEnabled,
|
||||
allowNativeSmoothScroll: isAllowNativeSmoothScrollEnabled && !enableScrollButtons,
|
||||
allowNativeScroll: !enableScrollButtons,
|
||||
forceHideScrollbars: enableScrollButtons,
|
||||
// In edge, with the native scroll, the content jumps around when hovering over the buttons
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue