Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 496c501076 | |||
| dedddc7cd8 | |||
| 97c82b4ba2 | |||
| de7626a6a9 | |||
| fb7d0c7e1a | |||
| c3b70dc16c | |||
| 66bb127d43 |
Generated
+1
-1
@@ -1418,7 +1418,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "furumusic"
|
||||
version = "0.2.5"
|
||||
version = "0.2.9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "furumusic"
|
||||
version = "0.2.6"
|
||||
version = "0.2.9"
|
||||
edition = "2024"
|
||||
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
||||
|
||||
|
||||
+34
-8
@@ -9,7 +9,7 @@ use cot::response::IntoResponse;
|
||||
use cot::session::Session;
|
||||
use cot::{Body, Template};
|
||||
use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::{Deserialize, Deserializer, Serialize};
|
||||
use sqlx::{PgPool, Postgres, QueryBuilder};
|
||||
|
||||
use super::BUILD_INFO;
|
||||
@@ -68,9 +68,12 @@ pub(super) struct UpdateLibraryItemRequest {
|
||||
title: String,
|
||||
hidden: bool,
|
||||
release_type: Option<String>,
|
||||
#[serde(default, deserialize_with = "deserialize_optional_stringish")]
|
||||
year: Option<String>,
|
||||
release_id: Option<i64>,
|
||||
#[serde(default, deserialize_with = "deserialize_optional_stringish")]
|
||||
track_number: Option<String>,
|
||||
#[serde(default, deserialize_with = "deserialize_optional_stringish")]
|
||||
disc_number: Option<String>,
|
||||
artist_ids: Option<Vec<i64>>,
|
||||
}
|
||||
@@ -1876,7 +1879,7 @@ async fn fetch_library_item(
|
||||
"releases" => {
|
||||
sqlx::query_as::<_, LibraryItemRow>(
|
||||
"SELECT r.id, r.title::text AS title, \
|
||||
CONCAT(r.release_type::text, COALESCE(' · ' || r.year::text, '')) AS subtitle, \
|
||||
(COALESCE(NULLIF(STRING_AGG(DISTINCT a.name::text, ', '), ''), 'Unknown artist') || COALESCE(' / ' || r.year::text, '')) AS subtitle, \
|
||||
r.is_hidden, COUNT(DISTINCT t.id)::bigint AS primary_count, \
|
||||
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
||||
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
||||
@@ -1884,6 +1887,7 @@ async fn fetch_library_item(
|
||||
FROM furumusic__release r \
|
||||
LEFT JOIN furumusic__track t ON t.release_id = r.id \
|
||||
LEFT JOIN furumusic__release_artist ra ON ra.release_id = r.id \
|
||||
LEFT JOIN furumusic__artist a ON a.id = ra.artist_id \
|
||||
LEFT JOIN furumusic__play_history ph ON ph.track_id = t.id \
|
||||
WHERE r.id = $1 \
|
||||
GROUP BY r.id",
|
||||
@@ -2055,8 +2059,11 @@ async fn load_artist_options(pool: &PgPool) -> anyhow::Result<Vec<ArtistOptionDt
|
||||
async fn load_release_options(pool: &PgPool) -> anyhow::Result<Vec<ReleaseOptionDto>> {
|
||||
let rows = sqlx::query_as::<_, (i64, String, Option<String>)>(
|
||||
"SELECT r.id, r.title::text AS title, \
|
||||
CONCAT(r.release_type::text, COALESCE(' / ' || r.year::text, '')) AS subtitle \
|
||||
(COALESCE(NULLIF(STRING_AGG(DISTINCT a.name::text, ', '), ''), 'Unknown artist') || COALESCE(' / ' || r.year::text, '')) AS subtitle \
|
||||
FROM furumusic__release r \
|
||||
LEFT JOIN furumusic__release_artist ra ON ra.release_id = r.id \
|
||||
LEFT JOIN furumusic__artist a ON a.id = ra.artist_id \
|
||||
GROUP BY r.id \
|
||||
ORDER BY r.title_sort ASC, r.year NULLS LAST, r.id ASC",
|
||||
)
|
||||
.fetch_all(pool)
|
||||
@@ -2452,7 +2459,7 @@ async fn load_release_items(
|
||||
) -> anyhow::Result<Vec<LibraryItemRow>> {
|
||||
let mut qb = QueryBuilder::<Postgres>::new(
|
||||
"SELECT r.id, r.title::text AS title, \
|
||||
CONCAT(r.release_type::text, COALESCE(' · ' || r.year::text, '')) AS subtitle, \
|
||||
(COALESCE(NULLIF(STRING_AGG(DISTINCT a.name::text, ', '), ''), 'Unknown artist') || COALESCE(' / ' || r.year::text, '')) AS subtitle, \
|
||||
r.is_hidden, COUNT(DISTINCT t.id)::bigint AS primary_count, \
|
||||
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
||||
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
||||
@@ -2657,10 +2664,12 @@ fn optional_job_time(value: &str) -> Option<String> {
|
||||
}
|
||||
|
||||
fn normalize_library_kind(kind: Option<&str>) -> String {
|
||||
match kind {
|
||||
Some("releases") => "releases",
|
||||
Some("tracks") => "tracks",
|
||||
Some("playlists") => "playlists",
|
||||
let kind = kind.unwrap_or_default().trim().to_ascii_lowercase();
|
||||
match kind.as_str() {
|
||||
"release" | "releases" => "releases",
|
||||
"track" | "tracks" => "tracks",
|
||||
"playlist" | "playlists" => "playlists",
|
||||
"artist" | "artists" => "artists",
|
||||
_ => "artists",
|
||||
}
|
||||
.to_owned()
|
||||
@@ -2696,6 +2705,23 @@ fn parse_optional_admin_i32(value: Option<&str>, min: i32, max: i32) -> Option<i
|
||||
.map(|parsed| parsed.clamp(min, max))
|
||||
}
|
||||
|
||||
fn deserialize_optional_stringish<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let Some(value) = Option::<serde_json::Value>::deserialize(deserializer)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
match value {
|
||||
serde_json::Value::Null => Ok(None),
|
||||
serde_json::Value::String(value) => Ok(Some(value)),
|
||||
serde_json::Value::Number(value) => Ok(Some(value.to_string())),
|
||||
other => Err(serde::de::Error::custom(format!(
|
||||
"expected string, number, or null, got {other}"
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
fn now_string() -> String {
|
||||
chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_string()
|
||||
}
|
||||
|
||||
@@ -370,7 +370,8 @@ pub async fn save_cover_to_storage(
|
||||
}
|
||||
|
||||
let ext = extension_for_mime(&cover.mime_type);
|
||||
let filename = format!("cover.{ext}");
|
||||
let hash_prefix: String = hash.chars().take(12).collect();
|
||||
let filename = format!("cover-{hash_prefix}.{ext}");
|
||||
|
||||
let artist_dir = sanitize_dir_name(artist_name);
|
||||
let album_dir = sanitize_dir_name(release_title);
|
||||
|
||||
@@ -183,6 +183,16 @@ pub(super) struct PlayerJamDto {
|
||||
pub(super) member_count: i64,
|
||||
pub(super) host_last_seen_ms: i64,
|
||||
pub(super) host_device_online: bool,
|
||||
pub(super) members: Vec<PlayerJamMemberDto>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, JsonSchema)]
|
||||
pub(super) struct PlayerJamMemberDto {
|
||||
pub(super) user_id: i64,
|
||||
pub(super) name: String,
|
||||
pub(super) is_joined: bool,
|
||||
pub(super) is_current_user: bool,
|
||||
pub(super) last_seen_ms: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
@@ -192,6 +202,14 @@ pub(super) struct PlayerJamCreateRequest {
|
||||
pub(super) invitee_user_ids: Vec<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
pub(super) struct PlayerJamInviteRequest {
|
||||
pub(super) jam_id: String,
|
||||
pub(super) device_id: String,
|
||||
#[serde(default)]
|
||||
pub(super) invitee_user_ids: Vec<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, JsonSchema)]
|
||||
pub(super) struct PlayerJamJoinRequest {
|
||||
pub(super) jam_id: String,
|
||||
@@ -286,6 +304,7 @@ pub(super) struct UserStats {
|
||||
|
||||
#[derive(Debug, Serialize, JsonSchema)]
|
||||
pub(super) struct UserProfile {
|
||||
pub(super) id: i64,
|
||||
pub(super) name: String,
|
||||
pub(super) role: String,
|
||||
pub(super) stats: UserStats,
|
||||
|
||||
+178
-15
@@ -81,6 +81,7 @@ enum PlayerJamMemberStatus {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct PlayerJamMember {
|
||||
name: String,
|
||||
status: PlayerJamMemberStatus,
|
||||
last_seen_ms: i64,
|
||||
}
|
||||
@@ -393,6 +394,10 @@ impl PlayerDeviceHub {
|
||||
let mut state = self.state.lock().expect("player device hub lock");
|
||||
self.prune_locked(&mut state, now);
|
||||
|
||||
if self.user_has_joined_jam_locked(&state, host_user_id) {
|
||||
return Err("leave the current jam before creating a new one");
|
||||
}
|
||||
|
||||
let devices = state
|
||||
.devices_by_user
|
||||
.get(&host_user_id)
|
||||
@@ -410,19 +415,21 @@ impl PlayerDeviceHub {
|
||||
members.insert(
|
||||
host_user_id,
|
||||
PlayerJamMember {
|
||||
name: host_name.to_string(),
|
||||
status: PlayerJamMemberStatus::Joined,
|
||||
last_seen_ms: now,
|
||||
},
|
||||
);
|
||||
seen.insert(host_user_id);
|
||||
|
||||
for (user_id, _name) in invitees.into_iter().take(PLAYER_JAM_MAX_INVITEES) {
|
||||
for (user_id, name) in invitees.into_iter().take(PLAYER_JAM_MAX_INVITEES) {
|
||||
if !seen.insert(user_id) {
|
||||
continue;
|
||||
}
|
||||
members.insert(
|
||||
user_id,
|
||||
PlayerJamMember {
|
||||
name,
|
||||
status: PlayerJamMemberStatus::Invited,
|
||||
last_seen_ms: 0,
|
||||
},
|
||||
@@ -444,6 +451,7 @@ impl PlayerDeviceHub {
|
||||
fn join_jam(
|
||||
&self,
|
||||
user_id: i64,
|
||||
user_name: &str,
|
||||
device_id: &str,
|
||||
jam_id: &str,
|
||||
) -> Result<PlayerDevicesResponse, &'static str> {
|
||||
@@ -457,6 +465,7 @@ impl PlayerDeviceHub {
|
||||
let Some(member) = jam.members.get_mut(&user_id) else {
|
||||
return Err("jam is not available");
|
||||
};
|
||||
member.name = user_name.to_string();
|
||||
member.status = PlayerJamMemberStatus::Joined;
|
||||
member.last_seen_ms = now;
|
||||
if user_id == jam.host_user_id {
|
||||
@@ -466,6 +475,51 @@ impl PlayerDeviceHub {
|
||||
Ok(self.snapshot_locked(&state, user_id, device_id, Some(jam_id), now))
|
||||
}
|
||||
|
||||
fn invite_to_jam(
|
||||
&self,
|
||||
inviter_user_id: i64,
|
||||
device_id: &str,
|
||||
jam_id: &str,
|
||||
invitees: Vec<(i64, String)>,
|
||||
) -> Result<PlayerDevicesResponse, &'static str> {
|
||||
let now = current_millis();
|
||||
let mut state = self.state.lock().expect("player device hub lock");
|
||||
self.prune_locked(&mut state, now);
|
||||
|
||||
let Some(jam) = state.jams_by_id.get_mut(jam_id) else {
|
||||
return Err("jam is not available");
|
||||
};
|
||||
let Some(inviter) = jam.members.get(&inviter_user_id) else {
|
||||
return Err("jam is not available");
|
||||
};
|
||||
if inviter.status != PlayerJamMemberStatus::Joined {
|
||||
return Err("join the jam first");
|
||||
}
|
||||
if let Some(inviter) = jam.members.get_mut(&inviter_user_id) {
|
||||
inviter.last_seen_ms = now;
|
||||
}
|
||||
if inviter_user_id == jam.host_user_id {
|
||||
jam.host_last_seen_ms = now;
|
||||
}
|
||||
|
||||
let available_slots = PLAYER_JAM_MAX_INVITEES.saturating_sub(jam.members.len());
|
||||
for (user_id, name) in invitees.into_iter().take(available_slots) {
|
||||
if user_id == inviter_user_id || jam.members.contains_key(&user_id) {
|
||||
continue;
|
||||
}
|
||||
jam.members.insert(
|
||||
user_id,
|
||||
PlayerJamMember {
|
||||
name,
|
||||
status: PlayerJamMemberStatus::Invited,
|
||||
last_seen_ms: 0,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Ok(self.snapshot_locked(&state, inviter_user_id, device_id, Some(jam_id), now))
|
||||
}
|
||||
|
||||
fn leave_jam(
|
||||
&self,
|
||||
user_id: i64,
|
||||
@@ -561,6 +615,14 @@ impl PlayerDeviceHub {
|
||||
!require_joined || member.status == PlayerJamMemberStatus::Joined
|
||||
}
|
||||
|
||||
fn user_has_joined_jam_locked(&self, state: &PlayerDeviceHubState, user_id: i64) -> bool {
|
||||
state.jams_by_id.values().any(|jam| {
|
||||
jam.members
|
||||
.get(&user_id)
|
||||
.is_some_and(|member| member.status == PlayerJamMemberStatus::Joined)
|
||||
})
|
||||
}
|
||||
|
||||
fn jam_target_device_id_locked(
|
||||
&self,
|
||||
state: &PlayerDeviceHubState,
|
||||
@@ -612,6 +674,23 @@ impl PlayerDeviceHub {
|
||||
.values()
|
||||
.filter(|member| member.status == PlayerJamMemberStatus::Joined)
|
||||
.count() as i64;
|
||||
let mut members = jam
|
||||
.members
|
||||
.iter()
|
||||
.map(|(member_user_id, member)| PlayerJamMemberDto {
|
||||
user_id: *member_user_id,
|
||||
name: member.name.clone(),
|
||||
is_joined: member.status == PlayerJamMemberStatus::Joined,
|
||||
is_current_user: *member_user_id == user_id,
|
||||
last_seen_ms: now.saturating_sub(member.last_seen_ms),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
members.sort_by(|a, b| {
|
||||
b.is_joined
|
||||
.cmp(&a.is_joined)
|
||||
.then_with(|| b.is_current_user.cmp(&a.is_current_user))
|
||||
.then_with(|| a.name.cmp(&b.name))
|
||||
});
|
||||
let host_device_online = self.jam_target_device_id_locked(state, jam).is_some();
|
||||
Some(PlayerJamDto {
|
||||
id: jam.id.clone(),
|
||||
@@ -625,6 +704,7 @@ impl PlayerDeviceHub {
|
||||
member_count,
|
||||
host_last_seen_ms: now.saturating_sub(jam.host_last_seen_ms),
|
||||
host_device_online,
|
||||
members,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -849,6 +929,7 @@ async fn me_handler(
|
||||
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||
|
||||
Json(UserProfile {
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
role: user.role.code().to_string(),
|
||||
stats: UserStats {
|
||||
@@ -3899,18 +3980,42 @@ async fn devices_command_handler(
|
||||
None => None,
|
||||
};
|
||||
|
||||
let mut payload = dto.payload;
|
||||
if jam_id.is_some() && matches!(command, "queue_add_end" | "queue_add_next") {
|
||||
stamp_jam_queue_tracks(&mut payload, user.id, &user.name);
|
||||
}
|
||||
|
||||
match hub.enqueue_command(
|
||||
user.id,
|
||||
target_device_id.as_deref(),
|
||||
jam_id.as_deref(),
|
||||
command,
|
||||
dto.payload,
|
||||
payload,
|
||||
) {
|
||||
Ok(()) => Json(serde_json::json!({"ok": true})).into_response(),
|
||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||
}
|
||||
}
|
||||
|
||||
fn stamp_jam_queue_tracks(payload: &mut serde_json::Value, user_id: i64, user_name: &str) {
|
||||
let Some(tracks) = payload.get_mut("tracks").and_then(serde_json::Value::as_array_mut) else {
|
||||
return;
|
||||
};
|
||||
for track in tracks {
|
||||
let Some(track_object) = track.as_object_mut() else {
|
||||
continue;
|
||||
};
|
||||
track_object.insert(
|
||||
"added_by_user_id".to_string(),
|
||||
serde_json::Value::Number(user_id.into()),
|
||||
);
|
||||
track_object.insert(
|
||||
"added_by_user_name".to_string(),
|
||||
serde_json::Value::String(user_name.to_string()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async fn jam_users_search_handler(
|
||||
session: Session,
|
||||
db: Database,
|
||||
@@ -3984,19 +4089,31 @@ async fn jam_create_handler(
|
||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
||||
};
|
||||
|
||||
let mut invitee_ids = dto
|
||||
.invitee_user_ids
|
||||
let invitees = load_jam_invitees(pool, user.id, dto.invitee_user_ids).await?;
|
||||
|
||||
match hub.create_jam(user.id, &user.name, &device_id, invitees) {
|
||||
Ok(response) => Json(response).into_response(),
|
||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn load_jam_invitees(
|
||||
pool: &sqlx::PgPool,
|
||||
current_user_id: i64,
|
||||
invitee_user_ids: Vec<i64>,
|
||||
) -> cot::Result<Vec<(i64, String)>> {
|
||||
let mut invitee_ids = invitee_user_ids
|
||||
.into_iter()
|
||||
.filter(|id| *id > 0 && *id != user.id)
|
||||
.filter(|id| *id > 0 && *id != current_user_id)
|
||||
.collect::<Vec<_>>();
|
||||
invitee_ids.sort_unstable();
|
||||
invitee_ids.dedup();
|
||||
invitee_ids.truncate(PLAYER_JAM_MAX_INVITEES);
|
||||
|
||||
let invitees = if invitee_ids.is_empty() {
|
||||
Vec::new()
|
||||
if invitee_ids.is_empty() {
|
||||
Ok(Vec::new())
|
||||
} else {
|
||||
sqlx::query_as::<_, PlayerJamUserRow>(
|
||||
let invitees = sqlx::query_as::<_, PlayerJamUserRow>(
|
||||
r#"SELECT id, username::text AS username, display_name, email
|
||||
FROM furumusic__user
|
||||
WHERE is_active = true AND id = ANY($1)"#,
|
||||
@@ -4015,12 +4132,8 @@ async fn jam_create_handler(
|
||||
.to_string();
|
||||
(row.id, name)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
};
|
||||
|
||||
match hub.create_jam(user.id, &user.name, &device_id, invitees) {
|
||||
Ok(response) => Json(response).into_response(),
|
||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||
.collect::<Vec<_>>();
|
||||
Ok(invitees)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4040,7 +4153,31 @@ async fn jam_join_handler(
|
||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
||||
};
|
||||
|
||||
match hub.join_jam(user.id, &device_id, &jam_id) {
|
||||
match hub.join_jam(user.id, &user.name, &device_id, &jam_id) {
|
||||
Ok(response) => Json(response).into_response(),
|
||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||
}
|
||||
}
|
||||
|
||||
async fn jam_invite_handler(
|
||||
session: Session,
|
||||
db: Database,
|
||||
pool: &sqlx::PgPool,
|
||||
hub: Arc<PlayerDeviceHub>,
|
||||
Json(dto): Json<PlayerJamInviteRequest>,
|
||||
) -> cot::Result<cot::response::Response> {
|
||||
let Some(user) = auth::get_session_user(&session, &db).await else {
|
||||
return Ok(json_error(StatusCode::UNAUTHORIZED, "not authenticated"));
|
||||
};
|
||||
let Some(jam_id) = normalize_device_id(&dto.jam_id) else {
|
||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid jam id"));
|
||||
};
|
||||
let Some(device_id) = normalize_device_id(&dto.device_id) else {
|
||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
||||
};
|
||||
|
||||
let invitees = load_jam_invitees(pool, user.id, dto.invitee_user_ids).await?;
|
||||
match hub.invite_to_jam(user.id, &device_id, &jam_id, invitees) {
|
||||
Ok(response) => Json(response).into_response(),
|
||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||
}
|
||||
@@ -6571,6 +6708,32 @@ impl App for PlayerApp {
|
||||
}),
|
||||
"player_jams_join",
|
||||
),
|
||||
Route::with_handler_and_name(
|
||||
"/jams/invite",
|
||||
post({
|
||||
let pool = Arc::clone(&pool);
|
||||
let pool_config = Arc::clone(&pool_config);
|
||||
let device_hub = Arc::clone(&device_hub);
|
||||
move |session: Session, db: Database, json: Json<PlayerJamInviteRequest>| {
|
||||
let pool = Arc::clone(&pool);
|
||||
let pool_config = Arc::clone(&pool_config);
|
||||
let device_hub = Arc::clone(&device_hub);
|
||||
async move {
|
||||
let pg_pool = pool
|
||||
.get_or_init(|| async {
|
||||
sqlx::postgres::PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(&pool_config.database_url)
|
||||
.await
|
||||
.expect("player pool")
|
||||
})
|
||||
.await;
|
||||
jam_invite_handler(session, db, pg_pool, device_hub, json).await
|
||||
}
|
||||
}
|
||||
}),
|
||||
"player_jams_invite",
|
||||
),
|
||||
Route::with_handler_and_name(
|
||||
"/jams/leave",
|
||||
post({
|
||||
|
||||
+10
-2
@@ -1934,7 +1934,7 @@ tbody tr:hover {
|
||||
<div class="empty" x-show="editorLoading">Loading editor...</div>
|
||||
<div x-show="!editorLoading">
|
||||
<div class="field">
|
||||
<label x-text="isArtistEditor() ? 'Artist name' : 'Title'"></label>
|
||||
<label x-text="isArtistEditor() ? 'Artist name' : (isReleaseEditor() ? 'Release title' : (isTrackEditor() ? 'Track title' : 'Title'))"></label>
|
||||
<input x-model="editorDraft.title" />
|
||||
</div>
|
||||
|
||||
@@ -2829,8 +2829,10 @@ function adminV2() {
|
||||
selectEditorRelease(release = null) {
|
||||
const candidates = this.filteredEditorReleases();
|
||||
release = release || candidates[0];
|
||||
if (release) this.editorDraft.release_id = Number(release.id);
|
||||
if (!release) return false;
|
||||
this.editorDraft.release_id = Number(release.id);
|
||||
this.editorReleaseToAdd = '';
|
||||
return true;
|
||||
},
|
||||
|
||||
setEditorImageFile(event) {
|
||||
@@ -2948,6 +2950,12 @@ function adminV2() {
|
||||
},
|
||||
|
||||
async saveLibraryItem() {
|
||||
if (this.isTrackEditor() && String(this.editorReleaseToAdd || '').trim()) {
|
||||
if (!this.selectEditorRelease()) {
|
||||
this.showToast('Choose a release from search results');
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.editorCanSave()) return;
|
||||
this.editorSaving = true;
|
||||
try {
|
||||
|
||||
@@ -422,13 +422,13 @@
|
||||
<button class="torrent-tree-check" :class="{ checked: $store.torrents.selectedUploadTracks.has(item.track.id) }" @click="$store.torrents.toggleUploadTrackSelection(item.track.id)">
|
||||
<template x-if="$store.torrents.selectedUploadTracks.has(item.track.id)"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><polyline points="20 6 9 17 4 12"/></svg></template>
|
||||
</button>
|
||||
<button class="track-action-btn play-btn" @click="$store.player.play(item.track)" title="{{ t.player_play }}"><svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></button>
|
||||
<div class="upload-track-main">
|
||||
<div class="upload-track-title"><span x-text="item.track.track_number ? item.track.track_number + '. ' + item.track.title : item.track.title"></span><span class="upload-hidden-pill" x-show="item.is_hidden">hidden</span></div>
|
||||
<div class="upload-track-meta"><span x-text="$store.torrents.uploadArtistsText(item)"></span><span x-show="$store.torrents.uploadFeaturedArtistsText(item)">feat.</span><span x-show="$store.torrents.uploadFeaturedArtistsText(item)" x-text="$store.torrents.uploadFeaturedArtistsText(item)"></span></div>
|
||||
</div>
|
||||
<div class="upload-track-actions">
|
||||
<button class="track-action-btn" @click="$store.queue.addNextInQueue([item.track])" title="{{ t.player_play_next }}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg></button>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click="$store.queue.addNextInQueue([item.track])" title="{{ t.player_play_next }}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg></button>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click="$store.queue.addToEnd([item.track])" title="{{ t.player_add_to_queue }}"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg></button>
|
||||
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.editUpload(item)">Edit</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -516,11 +516,6 @@
|
||||
<div class="upload-track-card" :class="{ hidden: item.is_hidden }">
|
||||
<template x-if="$store.torrents.uploadEditId !== item.track.id">
|
||||
<div class="upload-track-display">
|
||||
<button class="track-action-btn play-btn"
|
||||
@click="$store.player.play(item.track)"
|
||||
title="{{ t.player_play }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
<div class="upload-track-main">
|
||||
<div class="upload-track-title">
|
||||
<span x-text="item.track.title"></span>
|
||||
@@ -535,8 +530,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-track-actions">
|
||||
<button class="track-action-btn" @click="$store.queue.addNextInQueue([item.track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click="$store.queue.addNextInQueue([item.track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click="$store.queue.addToEnd([item.track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.editUpload(item)">Edit</button>
|
||||
</div>
|
||||
|
||||
@@ -165,6 +165,19 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
Alpine.store('mobile', {
|
||||
libraryOpen: false,
|
||||
playerExpanded: false,
|
||||
playerDragging: false,
|
||||
playerDragOffset: 0,
|
||||
playerCloseOffset: 0,
|
||||
_playerDragStartY: 0,
|
||||
_playerDragStartX: 0,
|
||||
_playerDragTracking: false,
|
||||
_playerDragMode: null,
|
||||
_playerDragPointerId: null,
|
||||
_playerDragElement: null,
|
||||
_playerDragMove: null,
|
||||
_playerDragEnd: null,
|
||||
_playerSuppressClickUntil: 0,
|
||||
toggleLibrary() {
|
||||
this.libraryOpen = !this.libraryOpen;
|
||||
if (this.libraryOpen) Alpine.store('user').menuOpen = false;
|
||||
@@ -172,6 +185,121 @@ document.addEventListener('alpine:init', () => {
|
||||
closeLibrary() {
|
||||
this.libraryOpen = false;
|
||||
},
|
||||
isMobilePlayer() {
|
||||
return window.matchMedia && window.matchMedia('(max-width: 720px)').matches;
|
||||
},
|
||||
openPlayerFullscreen() {
|
||||
if (!this.isMobilePlayer() || !Alpine.store('player').currentTrack) return;
|
||||
this.playerExpanded = true;
|
||||
this.playerDragging = false;
|
||||
this.playerDragOffset = 0;
|
||||
this.playerCloseOffset = 0;
|
||||
Alpine.store('queue').visible = false;
|
||||
Alpine.store('devices').open = false;
|
||||
},
|
||||
closePlayerFullscreen() {
|
||||
this.playerExpanded = false;
|
||||
this.playerDragging = false;
|
||||
this.playerDragOffset = 0;
|
||||
this.playerCloseOffset = 0;
|
||||
},
|
||||
playerDragStyle() {
|
||||
return `--mobile-player-drag:${this.playerDragOffset}px; --mobile-player-close-drag:${this.playerCloseOffset}px;`;
|
||||
},
|
||||
handlePlayerClick(event) {
|
||||
if (Date.now() <= this._playerSuppressClickUntil) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this._playerSuppressClickUntil = 0;
|
||||
}
|
||||
},
|
||||
startPlayerDrag(event, force = false) {
|
||||
if (!this.isMobilePlayer() || !Alpine.store('player').currentTrack) return;
|
||||
if (event.button && event.button !== 0) return;
|
||||
const target = event.target;
|
||||
const isDragBlocked = target.closest('input, select, textarea, .volume-slider, .device-popover, .mobile-expanded-queue');
|
||||
if (!force) {
|
||||
if (this.playerExpanded) {
|
||||
const isCloseHandle = target.closest('.player-now-playing');
|
||||
const scroller = event.currentTarget?.classList?.contains('player-bar') ? event.currentTarget : null;
|
||||
if (!isCloseHandle || isDragBlocked || (scroller && scroller.scrollTop > 4)) return;
|
||||
} else if (isDragBlocked) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this._playerDragTracking) this.endPlayerDrag({ type: 'pointercancel' });
|
||||
this.playerDragging = false;
|
||||
this._playerDragTracking = true;
|
||||
this._playerDragMode = this.playerExpanded ? 'close' : 'open';
|
||||
this._playerDragStartY = event.clientY;
|
||||
this._playerDragStartX = event.clientX;
|
||||
this._playerDragPointerId = event.pointerId;
|
||||
this._playerDragElement = event.currentTarget;
|
||||
this.playerDragOffset = 0;
|
||||
this.playerCloseOffset = 0;
|
||||
this._playerDragMove = e => this.movePlayerDrag(e);
|
||||
this._playerDragEnd = e => this.endPlayerDrag(e);
|
||||
window.addEventListener('pointermove', this._playerDragMove, { passive: false });
|
||||
window.addEventListener('pointerup', this._playerDragEnd, { passive: false });
|
||||
window.addEventListener('pointercancel', this._playerDragEnd, { passive: false });
|
||||
},
|
||||
movePlayerDrag(event) {
|
||||
if (!this._playerDragTracking) return;
|
||||
const delta = this._playerDragStartY - event.clientY;
|
||||
const absDelta = Math.abs(delta);
|
||||
if (!this.playerDragging) {
|
||||
const horizontalDelta = Math.abs(event.clientX - this._playerDragStartX);
|
||||
const wantsOpen = this._playerDragMode === 'open' && delta > 0;
|
||||
const wantsClose = this._playerDragMode === 'close' && delta < 0;
|
||||
if (absDelta < 8 || absDelta < horizontalDelta * 1.15 || (!wantsOpen && !wantsClose)) return;
|
||||
this.playerDragging = true;
|
||||
try {
|
||||
this._playerDragElement?.setPointerCapture?.(this._playerDragPointerId);
|
||||
} catch (_) {}
|
||||
}
|
||||
event.preventDefault();
|
||||
if (this._playerDragMode === 'close') {
|
||||
this.playerCloseOffset = Math.max(0, Math.min(window.innerHeight, -delta));
|
||||
} else {
|
||||
const max = Math.max(0, window.innerHeight - 132);
|
||||
this.playerDragOffset = Math.max(0, Math.min(max, delta));
|
||||
}
|
||||
},
|
||||
endPlayerDrag(event) {
|
||||
const openThreshold = Math.min(180, Math.max(90, window.innerHeight * 0.18));
|
||||
const closeThreshold = Math.min(110, Math.max(64, window.innerHeight * 0.1));
|
||||
const wasCancelled = event?.type === 'pointercancel';
|
||||
const wasDragging = this.playerDragging;
|
||||
if (wasDragging) this._playerSuppressClickUntil = Date.now() + 450;
|
||||
if (this._playerDragMode === 'close') {
|
||||
if (!wasCancelled && this.playerCloseOffset > closeThreshold) this.closePlayerFullscreen();
|
||||
else {
|
||||
this.playerCloseOffset = 0;
|
||||
this.playerDragging = false;
|
||||
}
|
||||
} else if (this._playerDragMode === 'open' && !wasCancelled && this.playerDragOffset > openThreshold) {
|
||||
this.openPlayerFullscreen();
|
||||
} else {
|
||||
this.playerDragOffset = 0;
|
||||
this.playerDragging = false;
|
||||
}
|
||||
try {
|
||||
if (this._playerDragPointerId !== null && this._playerDragElement?.hasPointerCapture?.(this._playerDragPointerId)) {
|
||||
this._playerDragElement.releasePointerCapture(this._playerDragPointerId);
|
||||
}
|
||||
} catch (_) {}
|
||||
if (this._playerDragMove) window.removeEventListener('pointermove', this._playerDragMove);
|
||||
if (this._playerDragEnd) {
|
||||
window.removeEventListener('pointerup', this._playerDragEnd);
|
||||
window.removeEventListener('pointercancel', this._playerDragEnd);
|
||||
}
|
||||
this._playerDragTracking = false;
|
||||
this._playerDragMode = null;
|
||||
this._playerDragPointerId = null;
|
||||
this._playerDragElement = null;
|
||||
this._playerDragMove = null;
|
||||
this._playerDragEnd = null;
|
||||
},
|
||||
});
|
||||
|
||||
Alpine.store('info', {
|
||||
@@ -752,7 +880,7 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
_remotePlaybackPayload(track, overrides = {}) {
|
||||
const queue = Alpine.store('queue');
|
||||
const tracks = queue?.tracks?.length ? queue.tracks : (track ? [track] : []);
|
||||
const tracks = queue?.tracks?.length ? queue._tracksWithJamDefaults(queue.tracks) : (track ? queue?._tracksWithJamDefaults([track]) || [track] : []);
|
||||
let index = Number.isInteger(overrides.index) ? overrides.index : (queue?.currentIndex ?? 0);
|
||||
if (track && tracks[index]?.id !== track.id) {
|
||||
const foundIndex = tracks.findIndex(item => item.id === track.id);
|
||||
@@ -799,7 +927,7 @@ document.addEventListener('alpine:init', () => {
|
||||
const queue = Alpine.store('queue');
|
||||
const tracks = Array.isArray(state.tracks) ? state.tracks.filter(Boolean) : [];
|
||||
if (queue && tracks.length > 0) {
|
||||
queue.tracks = tracks;
|
||||
queue.tracks = queue._tracksWithJamDefaults(tracks);
|
||||
queue.currentIndex = Math.max(0, Math.min(Number(state.index || 0), tracks.length - 1));
|
||||
}
|
||||
const track = state.track || queue?.tracks?.[queue.currentIndex] || null;
|
||||
@@ -842,7 +970,7 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
if (command.command === 'play_track' || command.command === 'play_from_index' || command.command === 'transfer_state') {
|
||||
if (Array.isArray(payload.tracks) && payload.tracks.length > 0) {
|
||||
queue.tracks = payload.tracks;
|
||||
queue.tracks = queue._tracksWithJamDefaults(payload.tracks);
|
||||
queue.currentIndex = Math.max(0, Math.min(Number(payload.index || 0), queue.tracks.length - 1));
|
||||
}
|
||||
const track = payload.track || queue.tracks[queue.currentIndex];
|
||||
@@ -1082,6 +1210,8 @@ document.addEventListener('alpine:init', () => {
|
||||
currentJamId: null,
|
||||
open: false,
|
||||
jamPanelOpen: false,
|
||||
jamPanelMode: 'create',
|
||||
jamPanelJamId: null,
|
||||
jamQuery: '',
|
||||
jamUsers: [],
|
||||
jamSelectedUsers: [],
|
||||
@@ -1181,6 +1311,47 @@ document.addEventListener('alpine:init', () => {
|
||||
return this.currentJamId ? this.jams.find(jam => jam.id === this.currentJamId) : null;
|
||||
},
|
||||
|
||||
currentJamUser(jam = this.selectedJam()) {
|
||||
const profile = Alpine.store('user')?.profile;
|
||||
if (profile?.id) {
|
||||
return { id: profile.id, name: profile.name || 'User' };
|
||||
}
|
||||
const current = (jam?.members || []).find(member => member.is_current_user);
|
||||
if (current?.user_id) {
|
||||
return { id: current.user_id, name: current.name || 'User' };
|
||||
}
|
||||
if (jam?.is_owner && jam.host_user_id) {
|
||||
return { id: jam.host_user_id, name: jam.host_name || 'User' };
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
hasJoinedJam() {
|
||||
return this.jams.some(jam => jam.is_member);
|
||||
},
|
||||
|
||||
activeJamMembers() {
|
||||
const jam = this.selectedJam();
|
||||
return (jam?.members || []).filter(member => member.is_joined && Number(member.last_seen_ms || 0) <= 45000);
|
||||
},
|
||||
|
||||
jamMemberIds(jamId = this.jamPanelJamId || this.currentJamId) {
|
||||
const jam = this.jams.find(item => item.id === jamId);
|
||||
return new Set((jam?.members || []).map(member => Number(member.user_id)));
|
||||
},
|
||||
|
||||
userColorStyle(userId, name = '') {
|
||||
const palette = ['#4cc9f0', '#f72585', '#f9c74f', '#90be6d', '#f8961e', '#b5179e', '#43aa8b', '#577590'];
|
||||
const raw = String(userId || name || '');
|
||||
let hash = 0;
|
||||
for (let i = 0; i < raw.length; i++) hash = ((hash * 31) + raw.charCodeAt(i)) >>> 0;
|
||||
const hex = palette[hash % palette.length];
|
||||
const r = parseInt(hex.slice(1, 3), 16);
|
||||
const g = parseInt(hex.slice(3, 5), 16);
|
||||
const b = parseInt(hex.slice(5, 7), 16);
|
||||
return `--jam-contributor-color:${hex};--jam-contributor-bg:rgba(${r},${g},${b},0.13);--jam-contributor-bg-active:rgba(${r},${g},${b},0.2)`;
|
||||
},
|
||||
|
||||
isControllingRemoteJam() {
|
||||
const jam = this.selectedJam();
|
||||
return !!jam && !jam.is_owner;
|
||||
@@ -1255,10 +1426,39 @@ document.addEventListener('alpine:init', () => {
|
||||
},
|
||||
|
||||
openJamPanel() {
|
||||
if (this.hasJoinedJam()) return;
|
||||
this.jamPanelMode = 'create';
|
||||
this.jamPanelJamId = null;
|
||||
this.jamSelectedUsers = [];
|
||||
this.jamUsers = [];
|
||||
this.jamQuery = '';
|
||||
this.jamPanelOpen = !this.jamPanelOpen;
|
||||
if (this.jamPanelOpen && this.jamQuery.trim()) this.searchJamUsers();
|
||||
},
|
||||
|
||||
openJamManagePanel(jam) {
|
||||
if (!jam?.is_member) return;
|
||||
if (this.jamPanelOpen && this.jamPanelMode === 'manage' && this.jamPanelJamId === jam.id) {
|
||||
this.jamPanelOpen = false;
|
||||
return;
|
||||
}
|
||||
this.jamPanelMode = 'manage';
|
||||
this.jamPanelJamId = jam.id;
|
||||
this.jamSelectedUsers = [];
|
||||
this.jamUsers = [];
|
||||
this.jamQuery = '';
|
||||
this.jamPanelOpen = true;
|
||||
},
|
||||
|
||||
handleJamRowClick(jam) {
|
||||
if (!jam) return;
|
||||
if (jam.is_active && jam.is_member) {
|
||||
this.openJamManagePanel(jam);
|
||||
return;
|
||||
}
|
||||
this.selectJam(jam);
|
||||
},
|
||||
|
||||
queueJamSearch() {
|
||||
clearTimeout(this._jamSearchTimer);
|
||||
this._jamSearchTimer = setTimeout(() => this.searchJamUsers(), 180);
|
||||
@@ -1275,7 +1475,8 @@ document.addEventListener('alpine:init', () => {
|
||||
const res = await fetch('/api/player/jams/users?q=' + encodeURIComponent(query));
|
||||
if (!res.ok) return;
|
||||
const selected = new Set(this.jamSelectedUsers.map(user => user.id));
|
||||
this.jamUsers = (await res.json()).filter(user => !selected.has(user.id));
|
||||
const existing = this.jamMemberIds();
|
||||
this.jamUsers = (await res.json()).filter(user => !selected.has(user.id) && !existing.has(Number(user.id)));
|
||||
} catch {
|
||||
} finally {
|
||||
this.jamSearching = false;
|
||||
@@ -1293,7 +1494,13 @@ document.addEventListener('alpine:init', () => {
|
||||
this.jamSelectedUsers = this.jamSelectedUsers.filter(user => user.id !== userId);
|
||||
},
|
||||
|
||||
submitJamPanel() {
|
||||
if (this.jamPanelMode === 'manage') this.inviteToJam();
|
||||
else this.createJam();
|
||||
},
|
||||
|
||||
async createJam() {
|
||||
if (this.hasJoinedJam()) return;
|
||||
try {
|
||||
const res = await fetch('/api/player/jams', {
|
||||
method: 'POST',
|
||||
@@ -1306,6 +1513,7 @@ document.addEventListener('alpine:init', () => {
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
this._apply(data);
|
||||
Alpine.store('queue')?._ensureCurrentJamAttribution();
|
||||
this.jamPanelOpen = false;
|
||||
this.jamQuery = '';
|
||||
this.jamUsers = [];
|
||||
@@ -1314,6 +1522,26 @@ document.addEventListener('alpine:init', () => {
|
||||
} catch {}
|
||||
},
|
||||
|
||||
async inviteToJam() {
|
||||
if (!this.jamPanelJamId || this.jamSelectedUsers.length === 0) return;
|
||||
try {
|
||||
const res = await fetch('/api/player/jams/invite', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
jam_id: this.jamPanelJamId,
|
||||
device_id: this.id,
|
||||
invitee_user_ids: this.jamSelectedUsers.map(user => user.id),
|
||||
}),
|
||||
});
|
||||
if (!res.ok) return;
|
||||
this._apply(await res.json());
|
||||
this.jamQuery = '';
|
||||
this.jamUsers = [];
|
||||
this.jamSelectedUsers = [];
|
||||
} catch {}
|
||||
},
|
||||
|
||||
async selectJam(jam) {
|
||||
if (!jam) return;
|
||||
try {
|
||||
@@ -1334,6 +1562,7 @@ document.addEventListener('alpine:init', () => {
|
||||
this.currentJamId = jam.id;
|
||||
sessionStorage.setItem('furu_player_jam_id', jam.id);
|
||||
this._apply(data);
|
||||
Alpine.store('queue')?._ensureCurrentJamAttribution();
|
||||
this.open = false;
|
||||
const player = Alpine.store('player');
|
||||
if (player && this.isControllingRemoteJam() && data.playback_state) {
|
||||
@@ -1363,6 +1592,8 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
clearJamSelection() {
|
||||
this.currentJamId = null;
|
||||
this.jamPanelOpen = false;
|
||||
this.jamPanelJamId = null;
|
||||
sessionStorage.removeItem('furu_player_jam_id');
|
||||
},
|
||||
});
|
||||
@@ -1375,13 +1606,21 @@ document.addEventListener('alpine:init', () => {
|
||||
currentIndex: 0,
|
||||
visible: false,
|
||||
_dragIdx: null,
|
||||
_dragOverIdx: null,
|
||||
_pointerDragMove: null,
|
||||
_pointerDragEnd: null,
|
||||
|
||||
add(track) {
|
||||
this.addToEnd([track]);
|
||||
},
|
||||
|
||||
upcoming(limit = 12) {
|
||||
const start = Math.max(0, this.currentIndex + 1);
|
||||
return this.tracks.slice(start, start + limit);
|
||||
},
|
||||
|
||||
addToEnd(tracks) {
|
||||
const items = this._trackList(tracks);
|
||||
const items = this._tracksForQueueAdd(tracks);
|
||||
if (!items.length) return;
|
||||
if (this._sendRemoteQueueCommand('queue_add_end', { tracks: items })) {
|
||||
this._addToEndLocal(items);
|
||||
@@ -1391,7 +1630,7 @@ document.addEventListener('alpine:init', () => {
|
||||
},
|
||||
|
||||
addNextInQueue(tracks) {
|
||||
const items = this._trackList(tracks);
|
||||
const items = this._tracksForQueueAdd(tracks);
|
||||
if (!items.length) return;
|
||||
if (this._sendRemoteQueueCommand('queue_add_next', { tracks: items })) {
|
||||
this._addNextLocal(items);
|
||||
@@ -1401,7 +1640,7 @@ document.addEventListener('alpine:init', () => {
|
||||
},
|
||||
|
||||
playRelease(tracks, startIndex) {
|
||||
this.tracks = [...tracks];
|
||||
this.tracks = this._tracksForQueueAdd(tracks);
|
||||
this.playFromIndex(startIndex || 0);
|
||||
},
|
||||
|
||||
@@ -1426,6 +1665,74 @@ document.addEventListener('alpine:init', () => {
|
||||
this._moveTrackLocal(fromIdx, toIdx);
|
||||
},
|
||||
|
||||
startPointerReorder(event, idx) {
|
||||
if (event.pointerType === 'mouse') return;
|
||||
if (event.button && event.button !== 0) return;
|
||||
if (idx < 0 || idx >= this.tracks.length) return;
|
||||
event.preventDefault();
|
||||
this._endPointerReorder(false);
|
||||
this._dragIdx = idx;
|
||||
this._dragOverIdx = idx;
|
||||
const handle = event.currentTarget;
|
||||
try {
|
||||
handle?.setPointerCapture?.(event.pointerId);
|
||||
} catch (_) {}
|
||||
|
||||
this._pointerDragMove = (moveEvent) => {
|
||||
moveEvent.preventDefault();
|
||||
this._autoScrollDuringReorder(moveEvent.clientY);
|
||||
const target = document
|
||||
.elementFromPoint(moveEvent.clientX, moveEvent.clientY)
|
||||
?.closest?.('.queue-track[data-queue-index]');
|
||||
const targetIdx = Number(target?.dataset?.queueIndex);
|
||||
if (!Number.isInteger(targetIdx) || targetIdx < 0 || targetIdx >= this.tracks.length) return;
|
||||
this._dragOverIdx = targetIdx;
|
||||
document.querySelectorAll('.queue-track.drag-over').forEach(el => el.classList.remove('drag-over'));
|
||||
if (targetIdx !== this._dragIdx) target.classList.add('drag-over');
|
||||
};
|
||||
|
||||
this._pointerDragEnd = (endEvent) => {
|
||||
try {
|
||||
if (handle?.hasPointerCapture?.(endEvent.pointerId)) handle.releasePointerCapture(endEvent.pointerId);
|
||||
} catch (_) {}
|
||||
this._endPointerReorder(true);
|
||||
};
|
||||
|
||||
window.addEventListener('pointermove', this._pointerDragMove, { passive: false });
|
||||
window.addEventListener('pointerup', this._pointerDragEnd, { passive: false });
|
||||
window.addEventListener('pointercancel', this._pointerDragEnd, { passive: false });
|
||||
},
|
||||
|
||||
_autoScrollDuringReorder(clientY) {
|
||||
const scroller = document.querySelector('.queue-tracks');
|
||||
if (!scroller) return;
|
||||
const rect = scroller.getBoundingClientRect();
|
||||
const edge = 52;
|
||||
if (clientY < rect.top + edge) {
|
||||
scroller.scrollTop -= Math.ceil((rect.top + edge - clientY) / 4);
|
||||
} else if (clientY > rect.bottom - edge) {
|
||||
scroller.scrollTop += Math.ceil((clientY - (rect.bottom - edge)) / 4);
|
||||
}
|
||||
},
|
||||
|
||||
_endPointerReorder(commit) {
|
||||
if (this._pointerDragMove) window.removeEventListener('pointermove', this._pointerDragMove);
|
||||
if (this._pointerDragEnd) {
|
||||
window.removeEventListener('pointerup', this._pointerDragEnd);
|
||||
window.removeEventListener('pointercancel', this._pointerDragEnd);
|
||||
}
|
||||
document.querySelectorAll('.queue-track.drag-over').forEach(el => el.classList.remove('drag-over'));
|
||||
const fromIdx = this._dragIdx;
|
||||
const toIdx = this._dragOverIdx;
|
||||
this._pointerDragMove = null;
|
||||
this._pointerDragEnd = null;
|
||||
this._dragIdx = null;
|
||||
this._dragOverIdx = null;
|
||||
if (commit && Number.isInteger(fromIdx) && Number.isInteger(toIdx) && fromIdx !== toIdx) {
|
||||
this.moveTrack(fromIdx, toIdx);
|
||||
}
|
||||
},
|
||||
|
||||
clear() {
|
||||
if (this._sendRemoteQueueCommand('queue_clear')) {
|
||||
this._clearLocal();
|
||||
@@ -1438,6 +1745,53 @@ document.addEventListener('alpine:init', () => {
|
||||
return (Array.isArray(tracks) ? tracks : [tracks]).filter(Boolean);
|
||||
},
|
||||
|
||||
_tracksForQueueAdd(tracks) {
|
||||
const items = this._trackList(tracks).map(track => ({ ...track }));
|
||||
const devices = Alpine.store('devices');
|
||||
const jam = devices?.selectedJam?.();
|
||||
const user = devices?.currentJamUser?.(jam);
|
||||
if (!jam || !jam.is_member || !user?.id) return items;
|
||||
return items.map(track => ({
|
||||
...track,
|
||||
added_by_user_id: user.id,
|
||||
added_by_user_name: user.name || 'User',
|
||||
}));
|
||||
},
|
||||
|
||||
_tracksWithJamDefaults(tracks) {
|
||||
const items = this._trackList(tracks);
|
||||
const jam = Alpine.store('devices')?.selectedJam?.();
|
||||
if (!jam?.is_member || !jam.host_user_id) return items;
|
||||
return items.map(track => {
|
||||
if (track?.added_by_user_id) return track;
|
||||
return {
|
||||
...track,
|
||||
added_by_user_id: jam.host_user_id,
|
||||
added_by_user_name: jam.host_name || 'Host',
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
_ensureCurrentJamAttribution() {
|
||||
this.tracks = this._tracksWithJamDefaults(this.tracks);
|
||||
},
|
||||
|
||||
isForeignJamTrack(track) {
|
||||
const devices = Alpine.store('devices');
|
||||
const jam = devices?.selectedJam?.();
|
||||
const userId = Alpine.store('user')?.profile?.id;
|
||||
if (!jam || !jam.is_member || !track?.added_by_user_id || !userId) return false;
|
||||
return String(track.added_by_user_id) !== String(userId);
|
||||
},
|
||||
|
||||
contributorTitle(track) {
|
||||
return track?.added_by_user_name ? `Added by ${track.added_by_user_name}` : 'Added by another listener';
|
||||
},
|
||||
|
||||
contributorStyle(track) {
|
||||
return Alpine.store('devices')?.userColorStyle(track?.added_by_user_id, track?.added_by_user_name) || '';
|
||||
},
|
||||
|
||||
_sendRemoteQueueCommand(command, payload = {}) {
|
||||
const player = Alpine.store('player');
|
||||
if (!player?._shouldSendRemote()) return false;
|
||||
@@ -1446,13 +1800,13 @@ document.addEventListener('alpine:init', () => {
|
||||
},
|
||||
|
||||
_addToEndLocal(tracks) {
|
||||
const items = this._trackList(tracks);
|
||||
const items = this._tracksWithJamDefaults(tracks);
|
||||
if (!items.length) return;
|
||||
this.tracks = [...this.tracks, ...items];
|
||||
},
|
||||
|
||||
_addNextLocal(tracks) {
|
||||
const items = this._trackList(tracks);
|
||||
const items = this._tracksWithJamDefaults(tracks);
|
||||
if (!items.length) return;
|
||||
const insertAt = Math.min(this.currentIndex + 1, this.tracks.length);
|
||||
this.tracks.splice(insertAt, 0, ...items);
|
||||
|
||||
+97
-39
@@ -483,19 +483,16 @@
|
||||
<span x-show="$store.library.hasPopularity(track)" x-text="$store.library.popularityLabel(track)"></span>
|
||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||
</button>
|
||||
<button class="track-action-btn play-btn" @click.stop="$store.library.playSearchTrack(idx)" title="{{ t.player_play }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
<button class="like-btn" :class="{ liked: $store.likes.has(track.id) }" @click.stop="$store.likes.toggle(track.id)" title="{{ t.player_like }}">
|
||||
<svg viewBox="0 0 24 24" :fill="$store.likes.has(track.id) ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78z"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<button class="track-action-btn playlist-add-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -663,19 +660,16 @@
|
||||
<span x-show="$store.library.hasPopularity(track)" x-text="$store.library.popularityLabel(track)"></span>
|
||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||
</button>
|
||||
<button class="track-action-btn play-btn" @click.stop="$store.queue.playRelease($store.library.currentArtist.featured_tracks, idx)" title="{{ t.player_play }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
<button class="like-btn" :class="{ liked: $store.likes.has(track.id) }" @click.stop="$store.likes.toggle(track.id)" title="{{ t.player_like }}">
|
||||
<svg viewBox="0 0 24 24" :fill="$store.likes.has(track.id) ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78z"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<button class="track-action-btn playlist-add-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -786,19 +780,16 @@
|
||||
<span x-show="$store.library.hasPopularity(track)" x-text="$store.library.popularityLabel(track)"></span>
|
||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||
</button>
|
||||
<button class="track-action-btn play-btn" @click.stop="$store.queue.playRelease([track], 0)" title="{{ t.player_play }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
<button class="like-btn" :class="{ liked: $store.likes.has(track.id) }" @click.stop="$store.likes.toggle(track.id)" title="{{ t.player_like }}">
|
||||
<svg viewBox="0 0 24 24" :fill="$store.likes.has(track.id) ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78z"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<button class="track-action-btn playlist-add-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -862,19 +853,16 @@
|
||||
<span x-show="$store.library.hasPopularity(track)" x-text="$store.library.popularityLabel(track)"></span>
|
||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||
</button>
|
||||
<button class="track-action-btn play-btn" @click.stop="$store.queue.playRelease($store.library.currentPlaylist.tracks, idx)" title="{{ t.player_play }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
<button class="like-btn" :class="{ liked: $store.likes.has(track.id) }" @click.stop="$store.likes.toggle(track.id)" title="{{ t.player_like }}">
|
||||
<svg viewBox="0 0 24 24" :fill="$store.likes.has(track.id) ? 'currentColor' : 'none'" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78z"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-next-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h10M5 12h7M5 18h10"/><path d="M17 9l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
||||
<button class="track-action-btn queue-insert-btn queue-end-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M5 6h14M5 12h14M5 18h7"/><path d="M17 15l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
||||
</button>
|
||||
<button class="track-action-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<button class="track-action-btn playlist-add-btn" @click.stop="$store.playlists.showPicker([track.id])" title="{{ t.player_add_to_playlist }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -904,7 +892,9 @@
|
||||
</template>
|
||||
<template x-for="(track, idx) in $store.queue.tracks" :key="idx + '-' + track.id">
|
||||
<div class="queue-track"
|
||||
:class="{ active: idx === $store.queue.currentIndex, dragging: $store.queue._dragIdx === idx }"
|
||||
:data-queue-index="idx"
|
||||
:class="{ active: idx === $store.queue.currentIndex, dragging: $store.queue._dragIdx === idx, 'foreign-jam-track': $store.queue.isForeignJamTrack(track) }"
|
||||
:style="$store.queue.isForeignJamTrack(track) ? $store.queue.contributorStyle(track) : ''"
|
||||
@click="$store.queue.playFromIndex(idx)"
|
||||
draggable="true"
|
||||
@dragstart="$store.queue._dragIdx = idx; $event.dataTransfer.effectAllowed = 'move'"
|
||||
@@ -912,7 +902,10 @@
|
||||
@dragover.prevent="$event.dataTransfer.dropEffect = 'move'; $event.currentTarget.classList.add('drag-over')"
|
||||
@dragleave="$event.currentTarget.classList.remove('drag-over')"
|
||||
@drop.prevent="$event.currentTarget.classList.remove('drag-over'); if ($store.queue._dragIdx !== null) { $store.queue.moveTrack($store.queue._dragIdx, idx); $store.queue._dragIdx = null; }">
|
||||
<div class="queue-drag-handle" @mousedown.stop>
|
||||
<div class="queue-drag-handle"
|
||||
@mousedown.stop
|
||||
@click.stop
|
||||
@pointerdown.stop="$store.queue.startPointerReorder($event, idx)">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
|
||||
</div>
|
||||
<div class="queue-track-cover">
|
||||
@@ -955,11 +948,21 @@
|
||||
</div>
|
||||
|
||||
<!-- Player Bar -->
|
||||
<div class="player-bar">
|
||||
<div class="player-bar"
|
||||
:class="{ 'mobile-expanded': $store.mobile.playerExpanded, 'mobile-dragging': $store.mobile.playerDragging }"
|
||||
:style="$store.mobile.playerDragStyle()"
|
||||
@click.capture="$store.mobile.handlePlayerClick($event)"
|
||||
@pointerdown="$store.mobile.startPlayerDrag($event)">
|
||||
<button class="mobile-player-collapse-btn" type="button" @click.stop="$store.mobile.closePlayerFullscreen()" title="{{ t.player_close }}" aria-label="{{ t.player_close }}">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4">
|
||||
<path d="M6 9l6 6 6-6"/>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="player-now-playing">
|
||||
<template x-if="$store.player.currentTrack">
|
||||
<div style="display:flex;align-items:center;gap:12px;overflow:hidden">
|
||||
<div class="player-cover">
|
||||
<div class="player-cover"
|
||||
@click.stop="$store.mobile.openPlayerFullscreen()">
|
||||
<template x-if="$store.player.currentTrack.cover_url">
|
||||
<img :src="$store.player.currentTrack.cover_url" :alt="$store.player.currentTrack.title">
|
||||
</template>
|
||||
@@ -989,6 +992,9 @@
|
||||
<span class="player-release-year" x-text="' · ' + $store.player.currentTrack.release_year"></span>
|
||||
</template>
|
||||
</div>
|
||||
<div class="player-track-release" x-show="$store.player.currentTrack.release_title">
|
||||
<a class="artist-link" @click.stop="$store.player.currentTrack.release_id && $store.library.openRelease($store.player.currentTrack.release_id)" x-text="$store.player.currentTrack.release_title"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1029,6 +1035,8 @@
|
||||
<div class="progress-bar-thumb"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="player-progress-strip-times"
|
||||
x-text="'-' + formatTime(Math.max(0, $store.player.duration - $store.player.currentTime)) + ' / ' + formatTime($store.player.duration)"></div>
|
||||
<span class="player-time" x-text="formatTime($store.player.duration)"></span>
|
||||
</div>
|
||||
<div class="player-version-chip">v{{ t.app_version() }}</div>
|
||||
@@ -1069,6 +1077,13 @@
|
||||
<path d="M8 20h8"/>
|
||||
<path d="M12 16v4"/>
|
||||
</svg>
|
||||
<span class="jam-member-squares"
|
||||
x-show="$store.devices.activeJamMembers().length > 0"
|
||||
x-cloak>
|
||||
<template x-for="member in $store.devices.activeJamMembers().slice(0, 8)" :key="'device-jam-member-' + member.user_id">
|
||||
<span class="jam-member-square" :style="$store.devices.userColorStyle(member.user_id, member.name)"></span>
|
||||
</template>
|
||||
</span>
|
||||
</button>
|
||||
<div class="device-popover" x-show="$store.devices.open" x-transition x-cloak>
|
||||
<template x-for="device in $store.devices.devices" :key="device.id">
|
||||
@@ -1107,7 +1122,7 @@
|
||||
<template x-for="jam in $store.devices.jams" :key="jam.id">
|
||||
<button class="device-row jam-row"
|
||||
:class="{ active: jam.is_active, pending: jam.is_pending }"
|
||||
@click="$store.devices.selectJam(jam)">
|
||||
@click="$store.devices.handleJamRowClick(jam)">
|
||||
<span class="device-row-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="8" cy="8" r="3"/>
|
||||
@@ -1128,7 +1143,7 @@
|
||||
</span>
|
||||
</button>
|
||||
</template>
|
||||
<button class="device-row start-jam-row" @click="$store.devices.openJamPanel()">
|
||||
<button class="device-row start-jam-row" x-show="!$store.devices.hasJoinedJam()" @click="$store.devices.openJamPanel()">
|
||||
<span class="device-row-icon">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 5v14"/>
|
||||
@@ -1141,6 +1156,7 @@
|
||||
</span>
|
||||
</button>
|
||||
<div class="jam-create-panel" x-show="$store.devices.jamPanelOpen" x-transition x-cloak>
|
||||
<div class="jam-panel-title" x-text="$store.devices.jamPanelMode === 'manage' ? 'Invite listeners' : 'Start Jam'"></div>
|
||||
<div class="jam-selected-users" x-show="$store.devices.jamSelectedUsers.length > 0">
|
||||
<template x-for="user in $store.devices.jamSelectedUsers" :key="user.id">
|
||||
<button class="jam-user-chip" @click="$store.devices.removeJamInvitee(user.id)">
|
||||
@@ -1162,9 +1178,51 @@
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<button class="jam-create-btn" @click="$store.devices.createJam()">Create Jam</button>
|
||||
<div class="jam-panel-actions">
|
||||
<button class="jam-create-btn"
|
||||
:disabled="$store.devices.jamSelectedUsers.length === 0 && $store.devices.jamPanelMode === 'manage'"
|
||||
@click="$store.devices.submitJamPanel()"
|
||||
x-text="$store.devices.jamPanelMode === 'manage' ? 'Invite' : 'Create Jam'"></button>
|
||||
<button class="jam-leave-btn"
|
||||
x-show="$store.devices.jamPanelMode === 'manage'"
|
||||
@click="$store.devices.leaveJam($store.devices.jamPanelJamId)">Leave</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mobile-expanded-queue">
|
||||
<div class="mobile-expanded-queue-title">{{ t.player_queue }}</div>
|
||||
<template x-if="$store.queue.upcoming().length === 0">
|
||||
<div class="mobile-expanded-queue-empty">{{ t.player_queue_empty }}</div>
|
||||
</template>
|
||||
<template x-for="(track, idx) in $store.queue.upcoming()" :key="'mobile-expanded-queue-' + track.id + '-' + idx">
|
||||
<button class="mobile-expanded-queue-row"
|
||||
:class="{ 'foreign-jam-track': $store.queue.isForeignJamTrack(track) }"
|
||||
:style="$store.queue.isForeignJamTrack(track) ? $store.queue.contributorStyle(track) : ''"
|
||||
type="button"
|
||||
@click="$store.queue.playFromIndex($store.queue.currentIndex + idx + 1)">
|
||||
<div class="mobile-expanded-queue-cover">
|
||||
<template x-if="track.cover_url">
|
||||
<img :src="track.cover_url" :alt="track.title" loading="lazy">
|
||||
</template>
|
||||
<template x-if="!track.cover_url">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg>
|
||||
</template>
|
||||
</div>
|
||||
<div class="mobile-expanded-queue-info">
|
||||
<div class="mobile-expanded-queue-name" x-text="track.title"></div>
|
||||
<div class="mobile-expanded-queue-artist">
|
||||
<template x-for="(artist, artistIdx) in $store.library.trackArtistLinks(track)" :key="artist.label + '-' + artist.id + '-' + artistIdx">
|
||||
<span>
|
||||
<template x-if="artistIdx > 0"><span>, </span></template>
|
||||
<span x-text="artist.label"></span>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<span class="mobile-expanded-queue-time" x-text="formatTime(track.duration_seconds)"></span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+703
-44
@@ -687,7 +687,7 @@ button.user-stat:hover {
|
||||
|
||||
.track-list-header {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 1fr 120px 60px;
|
||||
grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 154px 60px;
|
||||
padding: 8px 16px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
color: var(--text-subdued);
|
||||
@@ -699,7 +699,7 @@ button.user-stat:hover {
|
||||
|
||||
.track-row {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 1fr 1fr 120px 60px;
|
||||
grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr) 154px 60px;
|
||||
padding: 8px 16px;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
@@ -736,14 +736,18 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.track-album { font-size: 13px; color: var(--text-subdued); }
|
||||
.track-duration { font-size: 13px; color: var(--text-subdued); text-align: right; }
|
||||
.track-duration { font-size: 13px; color: var(--text-subdued); text-align: right; pointer-events: none; }
|
||||
|
||||
/* Track action buttons */
|
||||
.track-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 2px;
|
||||
opacity: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.track-action-btn {
|
||||
@@ -759,9 +763,22 @@ button.user-stat:hover {
|
||||
transition: color 0.15s, background 0.15s;
|
||||
}
|
||||
|
||||
.track-actions .track-action-btn,
|
||||
.track-actions .like-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
flex: 0 0 28px;
|
||||
}
|
||||
|
||||
.track-actions .popularity-info-btn {
|
||||
width: auto;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.track-action-btn:hover { color: var(--text-primary); background: var(--bg-active); }
|
||||
.track-action-btn.play-btn:hover { color: var(--accent); }
|
||||
.track-action-btn svg { width: 16px; height: 16px; }
|
||||
.track-action-btn.queue-insert-btn svg { width: 17px; height: 17px; }
|
||||
|
||||
.info-btn {
|
||||
color: var(--text-subdued);
|
||||
@@ -1003,6 +1020,15 @@ button.user-stat:hover {
|
||||
|
||||
.queue-track:hover { background: var(--bg-hover); }
|
||||
.queue-track.active { background: var(--bg-active); }
|
||||
.queue-track.foreign-jam-track {
|
||||
background: linear-gradient(90deg, var(--jam-contributor-bg, rgba(82,145,255,0.12)), transparent 78%);
|
||||
}
|
||||
.queue-track.foreign-jam-track:hover {
|
||||
background: linear-gradient(90deg, var(--jam-contributor-bg-active, rgba(82,145,255,0.18)), rgba(255,255,255,0.02) 78%);
|
||||
}
|
||||
.queue-track.foreign-jam-track.active {
|
||||
background: linear-gradient(90deg, var(--jam-contributor-bg-active, rgba(82,145,255,0.2)), var(--bg-active) 82%);
|
||||
}
|
||||
|
||||
.queue-track-cover {
|
||||
width: 40px;
|
||||
@@ -1084,6 +1110,8 @@ button.user-stat:hover {
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
opacity: 1;
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.queue-drag-handle:active { cursor: grabbing; }
|
||||
@@ -1167,6 +1195,27 @@ button.user-stat:hover {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.player-track-release {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
color: var(--text-subdued);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.player-track-release .artist-link {
|
||||
color: var(--text-subdued);
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: inherit;
|
||||
}
|
||||
|
||||
.player-track-release .artist-link:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.player-controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -1223,6 +1272,10 @@ button.user-stat:hover {
|
||||
|
||||
.player-time { font-size: 11px; color: var(--text-subdued); min-width: 40px; text-align: center; }
|
||||
|
||||
.player-progress-strip-times {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
flex: 1;
|
||||
height: 4px;
|
||||
@@ -1336,6 +1389,28 @@ button.user-stat:hover {
|
||||
.queue-toggle-btn.active { color: var(--accent); }
|
||||
.queue-toggle-btn svg { width: 18px; height: 18px; }
|
||||
|
||||
.device-toggle-btn {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.jam-member-squares {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 2px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 4px);
|
||||
gap: 1px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.jam-member-square {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border-radius: 1px;
|
||||
background: var(--jam-contributor-color, var(--accent));
|
||||
box-shadow: 0 0 0 1px rgba(0,0,0,0.32);
|
||||
}
|
||||
|
||||
.device-picker {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -1484,6 +1559,13 @@ button.user-stat:hover {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.jam-panel-title {
|
||||
margin-bottom: 7px;
|
||||
color: #c9dcff;
|
||||
font-size: 12px;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.jam-selected-users {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -1547,9 +1629,8 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.jam-create-btn {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
height: 30px;
|
||||
margin-top: 8px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: rgba(82,145,255,0.14);
|
||||
@@ -1559,6 +1640,33 @@ button.user-stat:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jam-create-btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.jam-panel-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.jam-leave-btn {
|
||||
height: 30px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: rgba(255,96,96,0.1);
|
||||
color: #ffb2b2;
|
||||
padding: 0 9px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jam-leave-btn:hover {
|
||||
background: rgba(255,96,96,0.18);
|
||||
}
|
||||
|
||||
/* Loading */
|
||||
.loading-spinner {
|
||||
display: flex;
|
||||
@@ -3052,7 +3160,7 @@ button.user-stat:hover {
|
||||
|
||||
.upload-tree-track {
|
||||
display: grid;
|
||||
grid-template-columns: 24px 30px minmax(0, 1fr) auto;
|
||||
grid-template-columns: 24px minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
@@ -3151,7 +3259,7 @@ button.user-stat:hover {
|
||||
|
||||
.upload-track-display {
|
||||
display: grid;
|
||||
grid-template-columns: 34px minmax(0, 1fr) auto;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
@@ -3409,6 +3517,11 @@ button.user-stat:hover {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.mobile-player-collapse-btn,
|
||||
.mobile-expanded-queue {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.playlist-action-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
@@ -3463,7 +3576,7 @@ button.user-stat:hover {
|
||||
|
||||
@media (max-width: 900px) {
|
||||
:root {
|
||||
--player-height: 118px;
|
||||
--player-height: 168px;
|
||||
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
||||
}
|
||||
|
||||
@@ -3597,54 +3710,175 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.player-bar {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
grid-template-rows: auto auto;
|
||||
gap: 8px 12px;
|
||||
position: relative;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
grid-template-rows: 62px 58px;
|
||||
grid-template-areas:
|
||||
"now now"
|
||||
"buttons actions";
|
||||
gap: 4px 10px;
|
||||
align-items: center;
|
||||
padding: 10px 12px calc(10px + var(--safe-bottom));
|
||||
padding: 34px 12px calc(9px + var(--safe-bottom));
|
||||
touch-action: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.player-now-playing {
|
||||
grid-column: 1;
|
||||
grid-row: 1;
|
||||
grid-area: now;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.player-now-playing > div {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
gap: 10px !important;
|
||||
width: 100%;
|
||||
max-width: 620px;
|
||||
margin: 0 auto;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
.player-cover {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.player-track-info {
|
||||
width: min(58vw, 360px);
|
||||
max-width: 360px;
|
||||
}
|
||||
|
||||
.player-track-title-row {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.player-current-like {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.player-track-title,
|
||||
.player-track-artist,
|
||||
.player-track-release {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.player-track-release {
|
||||
display: block;
|
||||
color: var(--text-subdued);
|
||||
font-size: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.player-controls {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.player-buttons {
|
||||
gap: 18px;
|
||||
grid-area: buttons;
|
||||
justify-self: start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .player-buttons .player-btn:first-child,
|
||||
.player-bar:not(.mobile-expanded) .player-buttons .player-btn:last-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.player-btn {
|
||||
min-width: 32px;
|
||||
min-height: 32px;
|
||||
min-width: 42px;
|
||||
min-height: 42px;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.player-btn svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.player-btn-play {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.player-btn-play svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.player-timeline {
|
||||
max-width: none;
|
||||
gap: 6px;
|
||||
gap: 5px;
|
||||
align-self: center;
|
||||
padding-right: 58px;
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .player-timeline {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 21px;
|
||||
gap: 0;
|
||||
padding-right: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .player-time {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .progress-bar,
|
||||
.player-bar:not(.mobile-expanded) .progress-bar:hover {
|
||||
width: 100%;
|
||||
height: 21px;
|
||||
border-radius: 0;
|
||||
background: rgba(29, 185, 84, 0.18);
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .progress-bar-fill {
|
||||
border-radius: 0;
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .progress-bar-thumb {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.player-bar:not(.mobile-expanded) .player-progress-strip-times {
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
right: 10px;
|
||||
height: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
color: var(--text-subdued);
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
pointer-events: none;
|
||||
text-shadow: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.player-version-chip {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: calc(12px + var(--safe-bottom));
|
||||
width: auto;
|
||||
max-width: none;
|
||||
margin-top: 0;
|
||||
padding-left: 0;
|
||||
opacity: 0.62;
|
||||
font-size: 9px;
|
||||
font-size: 8px;
|
||||
line-height: 1;
|
||||
opacity: 0.58;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.player-time {
|
||||
@@ -3653,17 +3887,35 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.player-right {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
grid-area: actions;
|
||||
justify-self: end;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(132px, 1fr) 40px 40px;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: 30px minmax(112px, 1fr);
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.volume-btn {
|
||||
min-width: 30px;
|
||||
min-height: 36px;
|
||||
justify-content: center;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.volume-slider {
|
||||
width: 88px;
|
||||
height: 6px;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 9px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
@@ -3672,18 +3924,373 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.volume-slider-thumb {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
right: -8.5px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 6px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.progress-bar-fill {
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.progress-bar-thumb {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.queue-toggle-btn {
|
||||
min-width: 36px;
|
||||
min-height: 36px;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.queue-toggle-btn svg,
|
||||
.volume-btn svg {
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-dragging:not(.mobile-expanded) {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: calc(var(--player-bar-space) + var(--mobile-player-drag, 0px));
|
||||
z-index: 70;
|
||||
border-radius: 18px 18px 0 0;
|
||||
box-shadow: 0 -18px 54px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
padding: calc(18px + env(safe-area-inset-top)) 18px calc(16px + var(--safe-bottom));
|
||||
border-top: 0;
|
||||
border-radius: 0;
|
||||
background: var(--bg-primary);
|
||||
box-shadow: none;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
z-index: 80;
|
||||
transform: translateY(var(--mobile-player-close-drag, 0px));
|
||||
transition: transform 0.18s ease, height 0.18s ease;
|
||||
touch-action: pan-y;
|
||||
user-select: auto;
|
||||
}
|
||||
|
||||
.player-bar.mobile-dragging {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .mobile-player-collapse-btn {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
top: calc(12px + env(safe-area-inset-top));
|
||||
right: 12px;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: var(--text-primary);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.mobile-player-collapse-btn svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-now-playing {
|
||||
justify-content: center;
|
||||
align-self: stretch;
|
||||
width: 100%;
|
||||
min-height: max(300px, calc(100dvh - 248px));
|
||||
flex: 0 0 auto;
|
||||
overflow: visible;
|
||||
padding-top: 38px;
|
||||
touch-action: none;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-now-playing > div {
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 18px !important;
|
||||
overflow: visible !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded.mobile-dragging .player-now-playing {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-cover {
|
||||
width: min(76vw, 38dvh, 360px);
|
||||
height: auto;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 22px 62px rgba(0,0,0,0.48);
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-cover svg {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-track-info {
|
||||
width: min(100%, 520px);
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-track-title-row {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-track-title {
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-track-artist {
|
||||
margin-top: 5px;
|
||||
font-size: 14px;
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-current-like {
|
||||
display: flex;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-track-release {
|
||||
margin-top: 4px;
|
||||
font-size: 13px;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-controls {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex: 0 0 auto;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-version-chip {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-buttons {
|
||||
justify-self: center;
|
||||
gap: 18px;
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-btn {
|
||||
min-width: 56px;
|
||||
min-height: 56px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-btn svg {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-btn-play {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-timeline {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
justify-self: center;
|
||||
align-self: center;
|
||||
padding-right: 0;
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .progress-bar {
|
||||
height: 7px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .progress-bar-thumb {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-right {
|
||||
position: static;
|
||||
grid-area: actions;
|
||||
justify-self: center;
|
||||
width: min(100%, 560px);
|
||||
flex: 0 0 auto;
|
||||
grid-template-columns: minmax(0, 1fr) 48px 48px;
|
||||
gap: 8px;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .volume-control {
|
||||
grid-template-columns: 44px minmax(0, 1fr);
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .volume-btn,
|
||||
.player-bar.mobile-expanded .queue-toggle-btn {
|
||||
min-width: 48px;
|
||||
min-height: 48px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .volume-btn {
|
||||
min-width: 44px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .volume-slider {
|
||||
display: block;
|
||||
height: 7px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .device-popover {
|
||||
position: fixed;
|
||||
top: auto;
|
||||
bottom: calc(90px + var(--safe-bottom));
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
width: auto;
|
||||
max-width: none;
|
||||
max-height: 42dvh;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .mobile-expanded-queue {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: none;
|
||||
min-height: 0;
|
||||
overflow: visible;
|
||||
flex: 0 0 auto;
|
||||
margin-top: 8px;
|
||||
padding-top: 14px;
|
||||
padding-bottom: 24px;
|
||||
border-top: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-title {
|
||||
margin: 0 0 8px;
|
||||
color: var(--text-subdued);
|
||||
font-size: 11px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-empty {
|
||||
padding: 18px 0;
|
||||
color: var(--text-subdued);
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-row {
|
||||
width: 100%;
|
||||
min-height: 54px;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 6px 4px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-row:active {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-row.foreign-jam-track {
|
||||
background: linear-gradient(90deg, var(--jam-contributor-bg, rgba(82,145,255,0.12)), transparent 82%);
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-row.foreign-jam-track:active {
|
||||
background: linear-gradient(90deg, var(--jam-contributor-bg-active, rgba(82,145,255,0.18)), rgba(255,255,255,0.02) 82%);
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-cover {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
background: var(--bg-elevated);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-cover svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
color: var(--text-subdued);
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-info {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-name,
|
||||
.mobile-expanded-queue-artist {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-name {
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mobile-expanded-queue-artist,
|
||||
.mobile-expanded-queue-time {
|
||||
color: var(--text-subdued);
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
:root {
|
||||
--player-height: 132px;
|
||||
--player-height: 170px;
|
||||
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
||||
}
|
||||
|
||||
@@ -3960,7 +4567,7 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.upload-tree-track {
|
||||
grid-template-columns: 24px 30px minmax(0, 1fr);
|
||||
grid-template-columns: 24px minmax(0, 1fr);
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
@@ -3976,7 +4583,7 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.upload-track-display {
|
||||
grid-template-columns: 32px minmax(0, 1fr);
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.upload-track-actions {
|
||||
@@ -4121,11 +4728,24 @@ button.user-stat:hover {
|
||||
gap: 8px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
grid-template-rows: 60px 58px;
|
||||
}
|
||||
|
||||
.player-track-title { font-size: 12px; }
|
||||
.player-track-artist { font-size: 10px; }
|
||||
.player-buttons { gap: 10px; }
|
||||
.player-track-release { font-size: 9px; }
|
||||
.player-buttons { gap: 2px; }
|
||||
|
||||
.player-right {
|
||||
grid-template-columns: minmax(68px, 1fr) 34px 34px;
|
||||
width: 100%;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
grid-template-columns: 22px minmax(44px, 1fr);
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.player-version-chip {
|
||||
padding-left: 0;
|
||||
@@ -4138,26 +4758,65 @@ button.user-stat:hover {
|
||||
}
|
||||
|
||||
.volume-btn {
|
||||
min-width: 24px;
|
||||
min-height: 34px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.queue-toggle-btn {
|
||||
min-width: 34px;
|
||||
min-height: 34px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.volume-slider {
|
||||
width: 72px;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.player-btn {
|
||||
min-width: 30px;
|
||||
min-height: 30px;
|
||||
min-width: 42px;
|
||||
min-height: 42px;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
.player-btn svg {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.player-btn-play {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.player-btn-play svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded {
|
||||
gap: 14px;
|
||||
padding-left: 14px;
|
||||
padding-right: 14px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-cover {
|
||||
width: min(82vw, 36dvh, 340px);
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-buttons {
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-btn {
|
||||
min-width: 52px;
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
.player-bar.mobile-expanded .player-btn-play {
|
||||
width: 68px;
|
||||
height: 68px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user