Skip to content

Commit cf7d3a9

Browse files
fixes done according to suggestions
1 parent eb57c43 commit cf7d3a9

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

frontend/css/sass/brainzplayer.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ $youtube-expanded-width: 1280px;
103103
content: "";
104104
width: 12px;
105105
height: 12px;
106-
transform: rotate(180deg);
107106
top: 4px;
108107
left: 4px;
109108
position: absolute;
@@ -123,12 +122,6 @@ $youtube-expanded-width: 1280px;
123122
}
124123
}
125124

126-
&.expanded {
127-
.react-resizable-handle {
128-
display: none;
129-
}
130-
}
131-
132125
.no-video-interaction {
133126
pointer-events: none;
134127
}

frontend/js/src/common/brainzplayer/YoutubePlayer.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from "lodash";
1212
import Draggable, { DraggableData, DraggableEvent } from "react-draggable";
1313
import { ResizableBox, ResizeCallbackData } from "react-resizable";
14-
import "react-resizable/css/styles.css";
1514
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
1615
import {
1716
faArrowsAlt,
@@ -540,27 +539,22 @@ export default class YoutubePlayer
540539
height: "100%",
541540
};
542541

543-
const maxAvailableWidth = this.getMaxAvailableWidth();
544-
const dynamicMaxWidth = Math.min(EXPANDED_WIDTH, maxAvailableWidth);
545-
const dynamicMaxHeight = Math.min(
546-
EXPANDED_HEIGHT + BUTTON_HEIGHT,
547-
window.innerHeight - (PLAYER_HEIGHT + BUTTON_HEIGHT + PADDING_TOP)
548-
);
549-
550542
const draggableBoundPadding = 10;
551543
// width of screen - padding on each side - youtube player width
552544
const leftBound =
553545
document.body.clientWidth - draggableBoundPadding * 2 - width;
554-
555546
const isCurrentDataSource =
556547
store.get(currentDataSourceNameAtom) === this.name;
557548
const isPlayerVisible = isCurrentDataSource && !hidePlayer;
549+
const maxResizableWidth = this.getMaxAvailableWidth();
550+
const maxResizableHeight =
551+
window.innerHeight - PLAYER_HEIGHT - BUTTON_HEIGHT - PADDING_TOP;
558552

559553
return (
560554
<Draggable
561555
handle=".youtube-drag-handle"
562556
position={{ x, y }}
563-
disabled={isExpanded || isInteracting}
557+
disabled={isInteracting}
564558
cancel=".react-resizable-handle"
565559
onDrag={this.onDrag}
566560
onStart={this.onInteractionStart}
@@ -572,10 +566,7 @@ export default class YoutubePlayer
572566
}}
573567
>
574568
<div
575-
className={`youtube-wrapper${!isPlayerVisible ? " hidden" : ""}${
576-
isExpanded ? " expanded" : ""
577-
}
578-
`}
569+
className={`youtube-wrapper${!isPlayerVisible ? " hidden" : ""}`}
579570
data-testid="youtube-wrapper"
580571
>
581572
<button
@@ -608,8 +599,8 @@ export default class YoutubePlayer
608599
onResizeStop={this.onInteractionStop}
609600
resizeHandles={["nw"]}
610601
minConstraints={[DEFAULT_WIDTH, DEFAULT_HEIGHT]}
611-
maxConstraints={[dynamicMaxWidth, dynamicMaxHeight]}
612-
axis={isExpanded ? "none" : "both"}
602+
maxConstraints={[maxResizableWidth, maxResizableHeight]}
603+
axis="both"
613604
className="youtube-resizable-container"
614605
>
615606
<YouTube

0 commit comments

Comments
 (0)