Skip to content

Commit

Permalink
Remove unused stuff, optimize others
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMicroNova committed Jan 9, 2025
1 parent 2dfde95 commit cdb10e4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 55 deletions.
2 changes: 1 addition & 1 deletion web/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ Page.propTypes = {
const App = ({ selectedPage }) => {
return (
<div className="app">
<DisconnectedIcon />
<div className="background-gradient"></div> {/* Used to make sure the background doesn't stretch or stop prematurely on scrollable pages */}
<div className="app-body">
<DisconnectedIcon />
<Page selectedPage={selectedPage} />
</div>
<MenuBar pageNumber={selectedPage} />
Expand Down
5 changes: 1 addition & 4 deletions web/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ const Card = ({
selectable,
onClick,

primary,
secondary,
}) => {
const cName = `card ${className} ${selectable && !selected ? "selectable" : ""} ${selected ? "selected" : ""} ${primary ? "primary" : ""} ${secondary ? "secondary" : ""}`
const cName = `card ${className} ${selectable && !selected ? "selectable" : ""} ${selected ? "selected" : ""} ${secondary ? "secondary" : "primary"}`
const onClickFun = onClick === null ? () => {} : onClick;
const topTransparency = selected ? 0.25 : 0.4;
const bottomTransparency = selected ? 0.25 : 0.9;
Expand Down Expand Up @@ -53,7 +52,6 @@ Card.propTypes = {
selectable: PropTypes.bool,
onClick: PropTypes.func,

primary: PropTypes.bool,
secondary: PropTypes.bool,
};

Expand All @@ -64,7 +62,6 @@ Card.defaultProps = {
selectable: false,
onClick: null,

primary: true,
secondary: false,
};

Expand Down
8 changes: 5 additions & 3 deletions web/src/components/VolumeSlider/VolumeSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const VolumeSlider = ({ vol, mute, setVol, setMute, disabled }) => {
isScrolling.current = (Math.abs(diffY) / Math.abs(diffX)) > 1.65; // Equivalent to approximately 60 deg
};

const handleVolChange = (e, val, force = false) => {
const handleVolChange = (val, force = false) => {
if (!isScrolling.current) {
setVol(val, force);
}
Expand All @@ -80,17 +80,19 @@ const VolumeSlider = ({ vol, mute, setVol, setMute, disabled }) => {
value={vol}
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
// https://github.com/mui/material-ui/issues/32737#issuecomment-2060439608
// ios does some weird emulation of mouse events from touch events, ignore those
onChange={(e, val) => {
if (isIOS() && e.type === "mousedown") {
return;
}
handleVolChange(e, val);
handleVolChange(val);
}}
onChangeCommitted={(e, val) => {
if (isIOS() && e.type === "mouseup") {
return;
}
handleVolChange(e, val, true);
handleVolChange(val, true);
}}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Home/Home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.home-outer {
padding-top: 10px;
@media (max-width: 435px) {
padding-bottom: 85px;
padding-bottom: 85px; // Used to ensure the screen is still scrollable to just above the PresetAndAdd component on mobile
}
@media (min-width: 435px) {
padding-bottom: 10px;
Expand Down
41 changes: 8 additions & 33 deletions web/src/pages/Player/Player.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,39 +67,14 @@ const Player = () => {
function DropdownArrow() {
// If on mobile, inital dropdown is at the bottom of the screen and expands upwards so the arrow should point up
// If on desktop, initial dropdown is in the middle of the screen and expands downwards so the arrow should point down
if(window.matchMedia("(max-width: 435px)").matches){
if(expanded){
return(
<KeyboardArrowDownIcon
className="player-volume-expand-button"
style={{ width: "3rem", height: "3rem" }}
/>
)
} else {
return(
<KeyboardArrowUpIcon
className="player-volume-expand-button"
style={{ width: "3rem", height: "3rem" }}
/>
)
}
} else {
if(expanded){
return(
<KeyboardArrowUpIcon
className="player-volume-expand-button"
style={{ width: "3rem", height: "3rem" }}
/>
)
} else {
return(
<KeyboardArrowDownIcon
className="player-volume-expand-button"
style={{ width: "3rem", height: "3rem" }}
/>
)
}
}
const isMobile = window.matchMedia("(max-width: 435px)").matches;
const Icon = isMobile ? (expanded ? KeyboardArrowDownIcon : KeyboardArrowUpIcon) : (expanded ? KeyboardArrowUpIcon : KeyboardArrowDownIcon);
return(
<Icon
className="player-volume-expand-button"
style={{ width: "3rem", height: "3rem" }}
/>
)
}

return (
Expand Down
13 changes: 0 additions & 13 deletions web/src/pages/Player/Player.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,3 @@
@include general.header-font;
padding: 0.5rem;
}

.control-gap {
// Dynamically size the gap so that the controls are always at the bottom of the screen when screen is scrolled to the top of the page
@media(min-height: 800px) {
height: 7.5vh
}
@media(min-height: 850px) {
height: 10vh
}
@media(min-height: 875px) {
height: 12.5vh
}
}

0 comments on commit cdb10e4

Please sign in to comment.