Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bringing changes downstream #45

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 155 additions & 1 deletion muzik-offline/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions muzik-offline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"tauri": "tauri"
},
"dependencies": {
"@hello-pangea/dnd": "^16.5.0",
"@tauri-apps/api": "^1.5.1",
"dexie": "^3.2.4",
"dexie-react-hooks": "^1.1.7",
Expand All @@ -24,6 +25,7 @@
"devDependencies": {
"@tauri-apps/cli": "^1.5.6",
"@types/react": "^18.2.15",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.2.7",
"@types/react-virtualized": "^9.21.29",
"@vitejs/plugin-react": "^4.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SongCardResizable: FunctionComponent<SongCardResizableProps> = (props: Son

return (
<div className="SongCardResizable">
<motion.div className="song_cover" whileHover={{scale: 1.02}} whileTap={{scale: 0.98}} onClick={() => props.navigateTo(props.keyV, "song")}>
<motion.div className="song_cover" whileHover={{scale: 1.02}} whileTap={{scale: 0.98}}>
{
!props.cover ? (getRandomCover(props.keyV))()
:
Expand All @@ -34,10 +34,8 @@ const SongCardResizable: FunctionComponent<SongCardResizableProps> = (props: Son
<motion.div className="PlayIcon" whileTap={{scale: 0.95}} onMouseUp={() => props.playThisSong(props.keyV)}>
<Play />
</motion.div>
<motion.div whileTap={{scale: 0.95}} onMouseUp={(e) => {
e.preventDefault();
props.setMenuOpenData(props.keyV, {xPos: e.pageX - 200, yPos: e.pageY});
}}>
<motion.div whileTap={{scale: 0.95}} className="DotHorizontalIcon"
onMouseUp={(e) => {props.setMenuOpenData(props.keyV, {xPos: e.pageX - 200, yPos: e.pageY});}}>
<DotHorizontal />
</motion.div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion muzik-offline/src/interface/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import LoaderAnimated from './loader/LoaderAnimated';
import AirplayCastModal from './modals/AirplayCastModal';
import AddSongsToPlaylistModal from './modals/AddSongsToPlaylistModal';
import MusicPopOver from "./popover/MusicPopOver";
import SongCardResizableDraggable from './lists/SongCardResizableDraggable';
import RectangleSongBoxDraggable from './lists/RectangleSongBoxDraggable';
import DeletePlaylistModal from './modals/DeletePlaylistModal';
import DeleteSongFromPlaylistModal from './modals/DeleteSongFromPlaylistModal';

Expand All @@ -45,6 +47,7 @@ export {
ShowAlbumButton, SearchNavigator, DirectoriesModal, ShowInfoButton,
NotifyBottomRight, PropertiesModal, LargeResizableCover,
CreatePlaylistModal, EditPlaylistModal, AddSongToPlaylistModal, LoaderAnimated,
AirplayCastModal, AddSongsToPlaylistModal, MusicPopOver, DeletePlaylistModal,
AirplayCastModal, AddSongsToPlaylistModal, MusicPopOver, SongCardResizableDraggable,
RectangleSongBoxDraggable, DeletePlaylistModal,
DeleteButton, DeleteSongFromPlaylistModal
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import {RectangleSongBox} from "@components/index";
import { DragDropContext, Droppable, Draggable, DropResult } from '@hello-pangea/dnd';
import { Song } from "@muziktypes/index";
import { ViewportList } from "react-viewport-list";

type RectangleSongBoxDraggableProps = {
selected: number;
listRef: React.MutableRefObject<any>;
itemsHeightRef: React.MutableRefObject<HTMLDivElement | null>;
SongList: Song[];
onDragEnd: (result: DropResult) => void;
selectThisSong: (index: number) => void;
setMenuOpenData: (key: number, co_ords: {xPos: number;yPos: number;}) => void;
navigateTo: (key: number, type: "artist" | "song") => void;
playThisSong: (key: number) => void;
}

const RectangleSongBoxDraggable = (props: RectangleSongBoxDraggableProps) => {
return (
<DragDropContext onDragEnd={(result) => props.onDragEnd(result)} >
<Droppable droppableId="droppable">
{(provided) => (
<div ref={provided.innerRef} {...provided.droppableProps}>
<ViewportList viewportRef={props.itemsHeightRef} items={props.SongList} ref={props.listRef}>
{
(song, index) => (
<Draggable key={song.id.toString()} draggableId={song.id.toString()} index={index}>
{(provided) => (
<div ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps}>
<RectangleSongBox
key={song.id}
keyV={song.id}
index={index + 1}
cover={song.cover}
songName={song.name}
artist={song.artist}
length={song.duration}
year={song.year}
selected={props.selected === index + 1 ? true : false}
selectThisSong={props.selectThisSong}
setMenuOpenData={props.setMenuOpenData}
navigateTo={props.navigateTo}
playThisSong={props.playThisSong}/>
</div>
)}
</Draggable>
)
}
</ViewportList>
{provided.placeholder}
</div>
)
}
</Droppable>
</DragDropContext>
)
}

export default RectangleSongBoxDraggable
Loading