-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
130 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// sidebar-controller.js | ||
import { Controller } from "@hotwired/stimulus"; | ||
import { get, put } from "@rails/request.js"; | ||
|
||
export default class extends Controller { | ||
static targets = ["container"]; | ||
|
||
connect() { | ||
this.loadTracks(); | ||
} | ||
|
||
async loadTracks() { | ||
const { playlist } = window.store.getState(); | ||
|
||
const track_ids = playlist; // Assuming `store` is globally accessible | ||
if (track_ids && track_ids.length) { | ||
const response = await put('/player', { | ||
responseKind: "turbo-stream", | ||
body: { player: {ids: track_ids } } | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<li id="sidebar-track-<%= item.id %>" | ||
data-url="<%= player_path(id: item, t: true) %>" | ||
class="py-4 px-2 w-full <%= false ? "bg-gray-100 dark:bg-gray-900" : "" %>"> | ||
<div class="flex items-center space-x-4 justify-between"> | ||
<%= link_to player_path(id: item, t: true), class: "flex items-center space-x-4" do %> | ||
<div class="flex-shrink-0"> | ||
<%= image_tag item.cover_url(:small), class: "h-8 w-8 rounded-full" %> | ||
</div> | ||
<div class="flex-1 min-w-0"> | ||
<p class="w-[300px] text-sm font-medium text-gray-900 dark:text-gray-100 truncate"> | ||
<%= item.title %> | ||
</p> | ||
<p class="text-sm text-gray-500 truncate"> | ||
<%= item.user.username %> | ||
</p> | ||
</div> | ||
<% end %> | ||
|
||
<div class=""> | ||
<button | ||
data-action="click->player#removeSong" | ||
data-value="<%= item.id %>" | ||
class="inline-flex items-center shadow-sm border border-gray-300 dark:border-gray-700 rounded-full text-gray-700 bg-white hover:bg-gray-50 dark:text-gray-300 dark:bg-black dark:hover:bg-gray-900" | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
class="w-4 h-4" | ||
strokeWidth={1.5} | ||
stroke="currentColor" | ||
className="w-6 h-6" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
d="M6 18L18 6M6 6l12 12" | ||
/> | ||
</svg> | ||
</button> | ||
</div> | ||
|
||
</div> | ||
</li> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= turbo_stream.update("player-sidebar-tracks-list") do %> | ||
<%= render partial: "track", collection: @tracks, as: :item %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters