Skip to content

Commit

Permalink
removed some comments, check if queue already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
D0m1nos committed Nov 2, 2024
1 parent 025a852 commit dd61358
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/router/queue-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function getIndexes(view: QueueView): SongIndex[] {
}

const songs: SongIndex[] = [];
// is there a more efficient way?
// is there a more efficient way (or is this good enough)? for every song in the playlist it iterates the entire indexes array...
for (let i = 0; i < playlist.value.count; ++i) {
const song = indexes.value.find((v) => v.id === playlist.value.songs[i].audio);
if (song !== undefined) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/router/songs-pool-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import { Storage } from "../lib/storage/Storage";

Router.respond("query::songsPool::init", (_evt, payload) => {
const indexes = Storage.getTable("system").get("indexes");
//console.log(indexes);

if (indexes.isNone) {
return none();
}

const filtered = filter(indexes.value, payload);
// console.log(filtered);

return some({
initialIndex: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const PlaylistList: Component = () => {
</label>
</div>
<div class="ml-3">
{/* // TODO: fix button misaligning when the scrollbar appears */}
<Button
onClick={() => {
setShowCreateBox(!showCreateBox());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const PlaylistSongList: Component<PlaylistSongListProps> = (props) => {

const reset = new Impulse();

onMount(() => {
onMount(async () => {
window.api.listen("playlist::resetSongList", reset.pulse.bind(reset));
setIsQueueExist(await window.api.request("queue::exists"));
});

onCleanup(() => window.api.removeListener("playlist::resetSongList", reset.pulse.bind(reset)));

const createQueue = async (songResource: ResourceID) => {
Expand All @@ -39,7 +41,6 @@ const PlaylistSongList: Component<PlaylistSongListProps> = (props) => {
tags: [],
view: { playlist: props.playlistName },
});
// todo: check if a queue already exists
setIsQueueExist(true);
};

Expand Down Expand Up @@ -95,7 +96,6 @@ const PlaylistSongList: Component<PlaylistSongListProps> = (props) => {
<Button
variant={"ghost"}
size={"icon"}
// this needs to be slightly larger for some reason (probably margin)
class="ml-3 w-10 rounded-lg"
onClick={() => deleteSong(props.playlistName, s)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Component, Match, Switch } from "solid-js";
const PlaylistView: Component = () => {
return (
<div class="h-full overflow-y-auto">
<Switch fallback={<div>idk</div>}>
<Switch>
<Match when={playlistActiveScene() == PLAYLIST_SCENE_LIST}>
<PlaylistList />
</Match>
Expand Down

0 comments on commit dd61358

Please sign in to comment.