Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 496c501076 | |||
| dedddc7cd8 | |||
| 97c82b4ba2 | |||
| de7626a6a9 | |||
| fb7d0c7e1a | |||
| c3b70dc16c | |||
| 66bb127d43 | |||
| 1bb5a2f973 | |||
| 8073ac9a97 | |||
| ec7c5c9049 |
Generated
+1
-1
@@ -1418,7 +1418,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "furumusic"
|
name = "furumusic"
|
||||||
version = "0.2.3"
|
version = "0.2.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "furumusic"
|
name = "furumusic"
|
||||||
version = "0.2.4"
|
version = "0.2.9"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
||||||
|
|
||||||
|
|||||||
+307
-22
@@ -9,7 +9,7 @@ use cot::response::IntoResponse;
|
|||||||
use cot::session::Session;
|
use cot::session::Session;
|
||||||
use cot::{Body, Template};
|
use cot::{Body, Template};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Deserializer, Serialize};
|
||||||
use sqlx::{PgPool, Postgres, QueryBuilder};
|
use sqlx::{PgPool, Postgres, QueryBuilder};
|
||||||
|
|
||||||
use super::BUILD_INFO;
|
use super::BUILD_INFO;
|
||||||
@@ -68,7 +68,13 @@ pub(super) struct UpdateLibraryItemRequest {
|
|||||||
title: String,
|
title: String,
|
||||||
hidden: bool,
|
hidden: bool,
|
||||||
release_type: Option<String>,
|
release_type: Option<String>,
|
||||||
|
#[serde(default, deserialize_with = "deserialize_optional_stringish")]
|
||||||
year: Option<String>,
|
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>>,
|
artist_ids: Option<Vec<i64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,9 +391,13 @@ struct LibraryItemDetailDto {
|
|||||||
hidden: bool,
|
hidden: bool,
|
||||||
release_type: Option<String>,
|
release_type: Option<String>,
|
||||||
year: Option<i32>,
|
year: Option<i32>,
|
||||||
|
release_id: Option<i64>,
|
||||||
|
track_number: Option<i32>,
|
||||||
|
disc_number: Option<i32>,
|
||||||
current_image_url: Option<String>,
|
current_image_url: Option<String>,
|
||||||
selected_artist_ids: Vec<i64>,
|
selected_artist_ids: Vec<i64>,
|
||||||
artists: Vec<ArtistOptionDto>,
|
artists: Vec<ArtistOptionDto>,
|
||||||
|
releases: Vec<ReleaseOptionDto>,
|
||||||
available_covers: Vec<AvailableCoverDto>,
|
available_covers: Vec<AvailableCoverDto>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,6 +407,13 @@ struct ArtistOptionDto {
|
|||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, JsonSchema)]
|
||||||
|
struct ReleaseOptionDto {
|
||||||
|
id: i64,
|
||||||
|
title: String,
|
||||||
|
subtitle: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, JsonSchema)]
|
#[derive(Debug, Serialize, JsonSchema)]
|
||||||
struct AvailableCoverDto {
|
struct AvailableCoverDto {
|
||||||
media_file_id: i64,
|
media_file_id: i64,
|
||||||
@@ -1050,6 +1067,40 @@ pub async fn update_library_item(
|
|||||||
.execute(pool)
|
.execute(pool)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
"tracks" => {
|
||||||
|
let release_id = body.release_id.unwrap_or(0);
|
||||||
|
if release_id <= 0 {
|
||||||
|
return Ok(json_error(StatusCode::BAD_REQUEST, "release is required"));
|
||||||
|
}
|
||||||
|
let release_exists: Option<i64> =
|
||||||
|
sqlx::query_scalar("SELECT id FROM furumusic__release WHERE id = $1")
|
||||||
|
.bind(release_id)
|
||||||
|
.fetch_optional(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
if release_exists.is_none() {
|
||||||
|
return Ok(json_error(StatusCode::NOT_FOUND, "release not found"));
|
||||||
|
}
|
||||||
|
let year = parse_optional_admin_i32(body.year.as_deref(), 0, 3000);
|
||||||
|
let track_number = parse_optional_admin_i32(body.track_number.as_deref(), 1, 9999);
|
||||||
|
let disc_number = parse_optional_admin_i32(body.disc_number.as_deref(), 1, 999);
|
||||||
|
sqlx::query(
|
||||||
|
"UPDATE furumusic__track \
|
||||||
|
SET title = $1, title_sort = $2, release_id = $3, track_number = $4, disc_number = $5, year = $6, is_hidden = $7, updated_at = $8 \
|
||||||
|
WHERE id = $9",
|
||||||
|
)
|
||||||
|
.bind(title)
|
||||||
|
.bind(normalize_name(title))
|
||||||
|
.bind(release_id)
|
||||||
|
.bind(track_number)
|
||||||
|
.bind(disc_number)
|
||||||
|
.bind(year)
|
||||||
|
.bind(body.hidden)
|
||||||
|
.bind(&now)
|
||||||
|
.bind(body.id)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
}
|
||||||
"playlists" => {
|
"playlists" => {
|
||||||
sqlx::query(
|
sqlx::query(
|
||||||
"UPDATE furumusic__playlist \
|
"UPDATE furumusic__playlist \
|
||||||
@@ -1071,25 +1122,44 @@ pub async fn update_library_item(
|
|||||||
if affected == 0 {
|
if affected == 0 {
|
||||||
return Ok(json_error(StatusCode::NOT_FOUND, "library item not found"));
|
return Ok(json_error(StatusCode::NOT_FOUND, "library item not found"));
|
||||||
}
|
}
|
||||||
if kind == "releases" {
|
if kind == "releases" || kind == "tracks" {
|
||||||
if let Some(mut artist_ids) = body.artist_ids {
|
if let Some(mut artist_ids) = body.artist_ids {
|
||||||
let mut seen_artist_ids = HashSet::new();
|
let mut seen_artist_ids = HashSet::new();
|
||||||
artist_ids.retain(|id| *id > 0 && seen_artist_ids.insert(*id));
|
artist_ids.retain(|id| *id > 0 && seen_artist_ids.insert(*id));
|
||||||
sqlx::query("DELETE FROM furumusic__release_artist WHERE release_id = $1")
|
if kind == "releases" {
|
||||||
.bind(body.id)
|
sqlx::query("DELETE FROM furumusic__release_artist WHERE release_id = $1")
|
||||||
.execute(pool)
|
.bind(body.id)
|
||||||
.await
|
.execute(pool)
|
||||||
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
.await
|
||||||
for (position, artist_id) in artist_ids.iter().enumerate() {
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
sqlx::query(
|
for (position, artist_id) in artist_ids.iter().enumerate() {
|
||||||
"INSERT INTO furumusic__release_artist (release_id, artist_id, position) VALUES ($1, $2, $3)",
|
sqlx::query(
|
||||||
)
|
"INSERT INTO furumusic__release_artist (release_id, artist_id, position) VALUES ($1, $2, $3)",
|
||||||
.bind(body.id)
|
)
|
||||||
.bind(*artist_id)
|
.bind(body.id)
|
||||||
.bind(position as i32)
|
.bind(*artist_id)
|
||||||
.execute(pool)
|
.bind(position as i32)
|
||||||
.await
|
.execute(pool)
|
||||||
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sqlx::query("DELETE FROM furumusic__track_artist WHERE track_id = $1 AND role = 'main'")
|
||||||
|
.bind(body.id)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
for (position, artist_id) in artist_ids.iter().enumerate() {
|
||||||
|
sqlx::query(
|
||||||
|
"INSERT INTO furumusic__track_artist (track_id, artist_id, role, position) VALUES ($1, $2, 'main', $3)",
|
||||||
|
)
|
||||||
|
.bind(body.id)
|
||||||
|
.bind(*artist_id)
|
||||||
|
.bind(position as i32)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1781,6 +1851,7 @@ async fn load_library_page(pool: &PgPool, query: LibraryQuery) -> anyhow::Result
|
|||||||
let total = count_library(pool, &kind, search_pattern.clone()).await?;
|
let total = count_library(pool, &kind, search_pattern.clone()).await?;
|
||||||
let rows = match kind.as_str() {
|
let rows = match kind.as_str() {
|
||||||
"releases" => load_release_items(pool, search_pattern.clone(), limit, offset).await?,
|
"releases" => load_release_items(pool, search_pattern.clone(), limit, offset).await?,
|
||||||
|
"tracks" => load_track_items(pool, search_pattern.clone(), limit, offset).await?,
|
||||||
"playlists" => load_playlist_items(pool, search_pattern.clone(), limit, offset).await?,
|
"playlists" => load_playlist_items(pool, search_pattern.clone(), limit, offset).await?,
|
||||||
_ => load_artist_items(pool, search_pattern.clone(), limit, offset).await?,
|
_ => load_artist_items(pool, search_pattern.clone(), limit, offset).await?,
|
||||||
};
|
};
|
||||||
@@ -1808,7 +1879,7 @@ async fn fetch_library_item(
|
|||||||
"releases" => {
|
"releases" => {
|
||||||
sqlx::query_as::<_, LibraryItemRow>(
|
sqlx::query_as::<_, LibraryItemRow>(
|
||||||
"SELECT r.id, r.title::text AS title, \
|
"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, \
|
r.is_hidden, COUNT(DISTINCT t.id)::bigint AS primary_count, \
|
||||||
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
||||||
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
||||||
@@ -1816,6 +1887,7 @@ async fn fetch_library_item(
|
|||||||
FROM furumusic__release r \
|
FROM furumusic__release r \
|
||||||
LEFT JOIN furumusic__track t ON t.release_id = r.id \
|
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__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 \
|
LEFT JOIN furumusic__play_history ph ON ph.track_id = t.id \
|
||||||
WHERE r.id = $1 \
|
WHERE r.id = $1 \
|
||||||
GROUP BY r.id",
|
GROUP BY r.id",
|
||||||
@@ -1841,6 +1913,26 @@ async fn fetch_library_item(
|
|||||||
.fetch_optional(pool)
|
.fetch_optional(pool)
|
||||||
.await?
|
.await?
|
||||||
}
|
}
|
||||||
|
"tracks" => {
|
||||||
|
sqlx::query_as::<_, LibraryItemRow>(
|
||||||
|
"SELECT t.id, t.title::text AS title, \
|
||||||
|
CONCAT(r.title::text, COALESCE(' / #' || t.track_number::text, '')) AS subtitle, \
|
||||||
|
t.is_hidden, COUNT(DISTINCT ta.artist_id)::bigint AS primary_count, \
|
||||||
|
COUNT(DISTINCT ph.id)::bigint AS secondary_count, \
|
||||||
|
COUNT(DISTINCT pt.playlist_id)::bigint AS tertiary_count, \
|
||||||
|
t.updated_at::text AS updated_at \
|
||||||
|
FROM furumusic__track t \
|
||||||
|
JOIN furumusic__release r ON r.id = t.release_id \
|
||||||
|
LEFT JOIN furumusic__track_artist ta ON ta.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__play_history ph ON ph.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__playlist_track pt ON pt.track_id = t.id \
|
||||||
|
WHERE t.id = $1 \
|
||||||
|
GROUP BY t.id, r.title",
|
||||||
|
)
|
||||||
|
.bind(id)
|
||||||
|
.fetch_optional(pool)
|
||||||
|
.await?
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
sqlx::query_as::<_, LibraryItemRow>(
|
sqlx::query_as::<_, LibraryItemRow>(
|
||||||
"SELECT a.id, a.name::text AS title, NULL::text AS subtitle, a.is_hidden, \
|
"SELECT a.id, a.name::text AS title, NULL::text AS subtitle, a.is_hidden, \
|
||||||
@@ -1874,9 +1966,13 @@ async fn load_library_item_detail(
|
|||||||
hidden: item.is_hidden.unwrap_or(false),
|
hidden: item.is_hidden.unwrap_or(false),
|
||||||
release_type: None,
|
release_type: None,
|
||||||
year: None,
|
year: None,
|
||||||
|
release_id: None,
|
||||||
|
track_number: None,
|
||||||
|
disc_number: None,
|
||||||
current_image_url: None,
|
current_image_url: None,
|
||||||
selected_artist_ids: Vec::new(),
|
selected_artist_ids: Vec::new(),
|
||||||
artists: Vec::new(),
|
artists: Vec::new(),
|
||||||
|
releases: Vec::new(),
|
||||||
available_covers: Vec::new(),
|
available_covers: Vec::new(),
|
||||||
item,
|
item,
|
||||||
};
|
};
|
||||||
@@ -1917,6 +2013,31 @@ async fn load_library_item_detail(
|
|||||||
.collect();
|
.collect();
|
||||||
detail.artists = load_artist_options(pool).await?;
|
detail.artists = load_artist_options(pool).await?;
|
||||||
}
|
}
|
||||||
|
"tracks" => {
|
||||||
|
let row: Option<(i64, Option<i32>, Option<i32>, Option<i32>)> = sqlx::query_as(
|
||||||
|
"SELECT release_id, track_number, disc_number, year FROM furumusic__track WHERE id = $1",
|
||||||
|
)
|
||||||
|
.bind(detail.item.id)
|
||||||
|
.fetch_optional(pool)
|
||||||
|
.await?;
|
||||||
|
if let Some((release_id, track_number, disc_number, year)) = row {
|
||||||
|
detail.release_id = Some(release_id);
|
||||||
|
detail.track_number = track_number;
|
||||||
|
detail.disc_number = disc_number;
|
||||||
|
detail.year = year;
|
||||||
|
}
|
||||||
|
detail.selected_artist_ids = sqlx::query_as::<_, IdRow>(
|
||||||
|
"SELECT artist_id AS id FROM furumusic__track_artist WHERE track_id = $1 AND role = 'main' ORDER BY position, artist_id",
|
||||||
|
)
|
||||||
|
.bind(detail.item.id)
|
||||||
|
.fetch_all(pool)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.map(|row| row.id)
|
||||||
|
.collect();
|
||||||
|
detail.artists = load_artist_options(pool).await?;
|
||||||
|
detail.releases = load_release_options(pool).await?;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1935,6 +2056,28 @@ async fn load_artist_options(pool: &PgPool) -> anyhow::Result<Vec<ArtistOptionDt
|
|||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, \
|
||||||
|
(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)
|
||||||
|
.await?;
|
||||||
|
Ok(rows
|
||||||
|
.into_iter()
|
||||||
|
.map(|(id, title, subtitle)| ReleaseOptionDto {
|
||||||
|
id,
|
||||||
|
title,
|
||||||
|
subtitle: subtitle.unwrap_or_default(),
|
||||||
|
})
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
async fn artist_available_covers(
|
async fn artist_available_covers(
|
||||||
pool: &PgPool,
|
pool: &PgPool,
|
||||||
artist_id: i64,
|
artist_id: i64,
|
||||||
@@ -1974,6 +2117,13 @@ async fn library_ids_by_filter(
|
|||||||
LEFT JOIN furumusic__release_artist ra ON ra.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 WHERE 1=1",
|
LEFT JOIN furumusic__artist a ON a.id = ra.artist_id WHERE 1=1",
|
||||||
),
|
),
|
||||||
|
"tracks" => QueryBuilder::<Postgres>::new(
|
||||||
|
"SELECT DISTINCT t.id \
|
||||||
|
FROM furumusic__track t \
|
||||||
|
JOIN furumusic__release r ON r.id = t.release_id \
|
||||||
|
LEFT JOIN furumusic__track_artist ta ON ta.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__artist a ON a.id = ta.artist_id WHERE 1=1",
|
||||||
|
),
|
||||||
"playlists" => QueryBuilder::<Postgres>::new(
|
"playlists" => QueryBuilder::<Postgres>::new(
|
||||||
"SELECT DISTINCT p.id \
|
"SELECT DISTINCT p.id \
|
||||||
FROM furumusic__playlist p \
|
FROM furumusic__playlist p \
|
||||||
@@ -2030,6 +2180,14 @@ async fn set_library_visibility(
|
|||||||
.bind(ids)
|
.bind(ids)
|
||||||
.execute(pool)
|
.execute(pool)
|
||||||
.await,
|
.await,
|
||||||
|
"tracks" => sqlx::query(
|
||||||
|
"UPDATE furumusic__track SET is_hidden = $1, updated_at = $2 WHERE id = ANY($3)",
|
||||||
|
)
|
||||||
|
.bind(hidden)
|
||||||
|
.bind(&now)
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await,
|
||||||
_ => sqlx::query(
|
_ => sqlx::query(
|
||||||
"UPDATE furumusic__artist SET is_hidden = $1, updated_at = $2 WHERE id = ANY($3)",
|
"UPDATE furumusic__artist SET is_hidden = $1, updated_at = $2 WHERE id = ANY($3)",
|
||||||
)
|
)
|
||||||
@@ -2046,6 +2204,7 @@ async fn set_library_visibility(
|
|||||||
async fn delete_library_items(pool: &PgPool, kind: &str, ids: &[i64]) -> cot::Result<u64> {
|
async fn delete_library_items(pool: &PgPool, kind: &str, ids: &[i64]) -> cot::Result<u64> {
|
||||||
match kind {
|
match kind {
|
||||||
"releases" => delete_releases(pool, ids).await,
|
"releases" => delete_releases(pool, ids).await,
|
||||||
|
"tracks" => delete_tracks(pool, ids).await,
|
||||||
"playlists" => delete_playlists(pool, ids).await,
|
"playlists" => delete_playlists(pool, ids).await,
|
||||||
_ => delete_artists(pool, ids).await,
|
_ => delete_artists(pool, ids).await,
|
||||||
}
|
}
|
||||||
@@ -2132,6 +2291,40 @@ async fn delete_releases(pool: &PgPool, ids: &[i64]) -> cot::Result<u64> {
|
|||||||
Ok(result.rows_affected())
|
Ok(result.rows_affected())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn delete_tracks(pool: &PgPool, ids: &[i64]) -> cot::Result<u64> {
|
||||||
|
sqlx::query("DELETE FROM furumusic__playlist_track WHERE track_id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
sqlx::query("DELETE FROM furumusic__user_liked_track WHERE track_id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
sqlx::query("DELETE FROM furumusic__play_history WHERE track_id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
sqlx::query("DELETE FROM furumusic__track_genre WHERE track_id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
sqlx::query("DELETE FROM furumusic__track_artist WHERE track_id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
let result = sqlx::query("DELETE FROM furumusic__track WHERE id = ANY($1)")
|
||||||
|
.bind(ids)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
Ok(result.rows_affected())
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete_playlists(pool: &PgPool, ids: &[i64]) -> cot::Result<u64> {
|
async fn delete_playlists(pool: &PgPool, ids: &[i64]) -> cot::Result<u64> {
|
||||||
sqlx::query("DELETE FROM furumusic__playlist_track WHERE playlist_id = ANY($1)")
|
sqlx::query("DELETE FROM furumusic__playlist_track WHERE playlist_id = ANY($1)")
|
||||||
.bind(ids)
|
.bind(ids)
|
||||||
@@ -2163,6 +2356,13 @@ async fn count_library(
|
|||||||
LEFT JOIN furumusic__release_artist ra ON ra.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 WHERE 1=1",
|
LEFT JOIN furumusic__artist a ON a.id = ra.artist_id WHERE 1=1",
|
||||||
),
|
),
|
||||||
|
"tracks" => QueryBuilder::<Postgres>::new(
|
||||||
|
"SELECT COUNT(DISTINCT t.id) AS count \
|
||||||
|
FROM furumusic__track t \
|
||||||
|
JOIN furumusic__release r ON r.id = t.release_id \
|
||||||
|
LEFT JOIN furumusic__track_artist ta ON ta.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__artist a ON a.id = ta.artist_id WHERE 1=1",
|
||||||
|
),
|
||||||
"playlists" => QueryBuilder::<Postgres>::new(
|
"playlists" => QueryBuilder::<Postgres>::new(
|
||||||
"SELECT COUNT(DISTINCT p.id) AS count \
|
"SELECT COUNT(DISTINCT p.id) AS count \
|
||||||
FROM furumusic__playlist p \
|
FROM furumusic__playlist p \
|
||||||
@@ -2203,6 +2403,15 @@ fn push_library_search_filter(
|
|||||||
qb.push_bind(pattern);
|
qb.push_bind(pattern);
|
||||||
qb.push(")");
|
qb.push(")");
|
||||||
}
|
}
|
||||||
|
"tracks" => {
|
||||||
|
qb.push(" AND (t.title ILIKE ");
|
||||||
|
qb.push_bind(pattern.clone());
|
||||||
|
qb.push(" OR r.title ILIKE ");
|
||||||
|
qb.push_bind(pattern.clone());
|
||||||
|
qb.push(" OR a.name ILIKE ");
|
||||||
|
qb.push_bind(pattern);
|
||||||
|
qb.push(")");
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
qb.push(" AND a.name ILIKE ");
|
qb.push(" AND a.name ILIKE ");
|
||||||
qb.push_bind(pattern);
|
qb.push_bind(pattern);
|
||||||
@@ -2250,7 +2459,7 @@ async fn load_release_items(
|
|||||||
) -> anyhow::Result<Vec<LibraryItemRow>> {
|
) -> anyhow::Result<Vec<LibraryItemRow>> {
|
||||||
let mut qb = QueryBuilder::<Postgres>::new(
|
let mut qb = QueryBuilder::<Postgres>::new(
|
||||||
"SELECT r.id, r.title::text AS title, \
|
"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, \
|
r.is_hidden, COUNT(DISTINCT t.id)::bigint AS primary_count, \
|
||||||
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
COUNT(DISTINCT ra.artist_id)::bigint AS secondary_count, \
|
||||||
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
COUNT(DISTINCT ph.id)::bigint AS tertiary_count, \
|
||||||
@@ -2279,6 +2488,46 @@ async fn load_release_items(
|
|||||||
.await?)
|
.await?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn load_track_items(
|
||||||
|
pool: &PgPool,
|
||||||
|
search_pattern: Option<String>,
|
||||||
|
limit: i64,
|
||||||
|
offset: i64,
|
||||||
|
) -> anyhow::Result<Vec<LibraryItemRow>> {
|
||||||
|
let mut qb = QueryBuilder::<Postgres>::new(
|
||||||
|
"SELECT t.id, t.title::text AS title, \
|
||||||
|
CONCAT(r.title::text, COALESCE(' / #' || t.track_number::text, '')) AS subtitle, \
|
||||||
|
t.is_hidden, COUNT(DISTINCT ta.artist_id)::bigint AS primary_count, \
|
||||||
|
COUNT(DISTINCT ph.id)::bigint AS secondary_count, \
|
||||||
|
COUNT(DISTINCT pt.playlist_id)::bigint AS tertiary_count, \
|
||||||
|
t.updated_at::text AS updated_at \
|
||||||
|
FROM furumusic__track t \
|
||||||
|
JOIN furumusic__release r ON r.id = t.release_id \
|
||||||
|
LEFT JOIN furumusic__track_artist ta ON ta.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__artist a ON a.id = ta.artist_id \
|
||||||
|
LEFT JOIN furumusic__play_history ph ON ph.track_id = t.id \
|
||||||
|
LEFT JOIN furumusic__playlist_track pt ON pt.track_id = t.id \
|
||||||
|
WHERE 1=1",
|
||||||
|
);
|
||||||
|
if let Some(pattern) = search_pattern {
|
||||||
|
qb.push(" AND (t.title ILIKE ");
|
||||||
|
qb.push_bind(pattern.clone());
|
||||||
|
qb.push(" OR r.title ILIKE ");
|
||||||
|
qb.push_bind(pattern.clone());
|
||||||
|
qb.push(" OR a.name ILIKE ");
|
||||||
|
qb.push_bind(pattern);
|
||||||
|
qb.push(")");
|
||||||
|
}
|
||||||
|
qb.push(" GROUP BY t.id, r.title ORDER BY r.title ASC, t.disc_number NULLS FIRST, t.track_number NULLS FIRST, t.title ASC LIMIT ");
|
||||||
|
qb.push_bind(limit);
|
||||||
|
qb.push(" OFFSET ");
|
||||||
|
qb.push_bind(offset);
|
||||||
|
Ok(qb
|
||||||
|
.build_query_as::<LibraryItemRow>()
|
||||||
|
.fetch_all(pool)
|
||||||
|
.await?)
|
||||||
|
}
|
||||||
|
|
||||||
async fn load_playlist_items(
|
async fn load_playlist_items(
|
||||||
pool: &PgPool,
|
pool: &PgPool,
|
||||||
search_pattern: Option<String>,
|
search_pattern: Option<String>,
|
||||||
@@ -2324,6 +2573,11 @@ fn library_item_dto(kind: &str, row: LibraryItemRow) -> LibraryItemDto {
|
|||||||
tag(format!("{} artists", row.secondary_count), "relation"),
|
tag(format!("{} artists", row.secondary_count), "relation"),
|
||||||
tag(format!("{} plays", row.tertiary_count), "plays"),
|
tag(format!("{} plays", row.tertiary_count), "plays"),
|
||||||
],
|
],
|
||||||
|
"tracks" => vec![
|
||||||
|
tag(format!("{} artists", row.primary_count), "relation"),
|
||||||
|
tag(format!("{} plays", row.secondary_count), "plays"),
|
||||||
|
tag(format!("{} playlists", row.tertiary_count), "count"),
|
||||||
|
],
|
||||||
"playlists" => vec![
|
"playlists" => vec![
|
||||||
tag(format!("{} tracks", row.primary_count), "count"),
|
tag(format!("{} tracks", row.primary_count), "count"),
|
||||||
tag(
|
tag(
|
||||||
@@ -2410,9 +2664,12 @@ fn optional_job_time(value: &str) -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn normalize_library_kind(kind: Option<&str>) -> String {
|
fn normalize_library_kind(kind: Option<&str>) -> String {
|
||||||
match kind {
|
let kind = kind.unwrap_or_default().trim().to_ascii_lowercase();
|
||||||
Some("releases") => "releases",
|
match kind.as_str() {
|
||||||
Some("playlists") => "playlists",
|
"release" | "releases" => "releases",
|
||||||
|
"track" | "tracks" => "tracks",
|
||||||
|
"playlist" | "playlists" => "playlists",
|
||||||
|
"artist" | "artists" => "artists",
|
||||||
_ => "artists",
|
_ => "artists",
|
||||||
}
|
}
|
||||||
.to_owned()
|
.to_owned()
|
||||||
@@ -2437,6 +2694,34 @@ fn normalize_name(value: &str) -> String {
|
|||||||
value.trim().to_lowercase()
|
value.trim().to_lowercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_optional_admin_i32(value: Option<&str>, min: i32, max: i32) -> Option<i32> {
|
||||||
|
let value = value?.trim();
|
||||||
|
if value.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
value
|
||||||
|
.parse::<i32>()
|
||||||
|
.ok()
|
||||||
|
.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 {
|
fn now_string() -> String {
|
||||||
chrono::Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_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 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 artist_dir = sanitize_dir_name(artist_name);
|
||||||
let album_dir = sanitize_dir_name(release_title);
|
let album_dir = sanitize_dir_name(release_title);
|
||||||
|
|||||||
@@ -183,6 +183,16 @@ pub(super) struct PlayerJamDto {
|
|||||||
pub(super) member_count: i64,
|
pub(super) member_count: i64,
|
||||||
pub(super) host_last_seen_ms: i64,
|
pub(super) host_last_seen_ms: i64,
|
||||||
pub(super) host_device_online: bool,
|
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)]
|
#[derive(Debug, Deserialize, JsonSchema)]
|
||||||
@@ -192,6 +202,14 @@ pub(super) struct PlayerJamCreateRequest {
|
|||||||
pub(super) invitee_user_ids: Vec<i64>,
|
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)]
|
#[derive(Debug, Deserialize, JsonSchema)]
|
||||||
pub(super) struct PlayerJamJoinRequest {
|
pub(super) struct PlayerJamJoinRequest {
|
||||||
pub(super) jam_id: String,
|
pub(super) jam_id: String,
|
||||||
@@ -286,6 +304,7 @@ pub(super) struct UserStats {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, JsonSchema)]
|
#[derive(Debug, Serialize, JsonSchema)]
|
||||||
pub(super) struct UserProfile {
|
pub(super) struct UserProfile {
|
||||||
|
pub(super) id: i64,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) role: String,
|
pub(super) role: String,
|
||||||
pub(super) stats: UserStats,
|
pub(super) stats: UserStats,
|
||||||
|
|||||||
+233
-16
@@ -9,7 +9,7 @@ use cot::http::header::{
|
|||||||
use cot::json::Json;
|
use cot::json::Json;
|
||||||
use cot::request::extractors::{Path, UrlQuery};
|
use cot::request::extractors::{Path, UrlQuery};
|
||||||
use cot::response::IntoResponse;
|
use cot::response::IntoResponse;
|
||||||
use cot::router::method::{get, post};
|
use cot::router::method::{delete, get, post};
|
||||||
use cot::router::{Route, Router};
|
use cot::router::{Route, Router};
|
||||||
use cot::session::Session;
|
use cot::session::Session;
|
||||||
use cot::{App, Body, Template};
|
use cot::{App, Body, Template};
|
||||||
@@ -81,6 +81,7 @@ enum PlayerJamMemberStatus {
|
|||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
struct PlayerJamMember {
|
struct PlayerJamMember {
|
||||||
|
name: String,
|
||||||
status: PlayerJamMemberStatus,
|
status: PlayerJamMemberStatus,
|
||||||
last_seen_ms: i64,
|
last_seen_ms: i64,
|
||||||
}
|
}
|
||||||
@@ -393,6 +394,10 @@ impl PlayerDeviceHub {
|
|||||||
let mut state = self.state.lock().expect("player device hub lock");
|
let mut state = self.state.lock().expect("player device hub lock");
|
||||||
self.prune_locked(&mut state, now);
|
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
|
let devices = state
|
||||||
.devices_by_user
|
.devices_by_user
|
||||||
.get(&host_user_id)
|
.get(&host_user_id)
|
||||||
@@ -410,19 +415,21 @@ impl PlayerDeviceHub {
|
|||||||
members.insert(
|
members.insert(
|
||||||
host_user_id,
|
host_user_id,
|
||||||
PlayerJamMember {
|
PlayerJamMember {
|
||||||
|
name: host_name.to_string(),
|
||||||
status: PlayerJamMemberStatus::Joined,
|
status: PlayerJamMemberStatus::Joined,
|
||||||
last_seen_ms: now,
|
last_seen_ms: now,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
seen.insert(host_user_id);
|
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) {
|
if !seen.insert(user_id) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
members.insert(
|
members.insert(
|
||||||
user_id,
|
user_id,
|
||||||
PlayerJamMember {
|
PlayerJamMember {
|
||||||
|
name,
|
||||||
status: PlayerJamMemberStatus::Invited,
|
status: PlayerJamMemberStatus::Invited,
|
||||||
last_seen_ms: 0,
|
last_seen_ms: 0,
|
||||||
},
|
},
|
||||||
@@ -444,6 +451,7 @@ impl PlayerDeviceHub {
|
|||||||
fn join_jam(
|
fn join_jam(
|
||||||
&self,
|
&self,
|
||||||
user_id: i64,
|
user_id: i64,
|
||||||
|
user_name: &str,
|
||||||
device_id: &str,
|
device_id: &str,
|
||||||
jam_id: &str,
|
jam_id: &str,
|
||||||
) -> Result<PlayerDevicesResponse, &'static str> {
|
) -> Result<PlayerDevicesResponse, &'static str> {
|
||||||
@@ -457,6 +465,7 @@ impl PlayerDeviceHub {
|
|||||||
let Some(member) = jam.members.get_mut(&user_id) else {
|
let Some(member) = jam.members.get_mut(&user_id) else {
|
||||||
return Err("jam is not available");
|
return Err("jam is not available");
|
||||||
};
|
};
|
||||||
|
member.name = user_name.to_string();
|
||||||
member.status = PlayerJamMemberStatus::Joined;
|
member.status = PlayerJamMemberStatus::Joined;
|
||||||
member.last_seen_ms = now;
|
member.last_seen_ms = now;
|
||||||
if user_id == jam.host_user_id {
|
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))
|
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(
|
fn leave_jam(
|
||||||
&self,
|
&self,
|
||||||
user_id: i64,
|
user_id: i64,
|
||||||
@@ -561,6 +615,14 @@ impl PlayerDeviceHub {
|
|||||||
!require_joined || member.status == PlayerJamMemberStatus::Joined
|
!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(
|
fn jam_target_device_id_locked(
|
||||||
&self,
|
&self,
|
||||||
state: &PlayerDeviceHubState,
|
state: &PlayerDeviceHubState,
|
||||||
@@ -612,6 +674,23 @@ impl PlayerDeviceHub {
|
|||||||
.values()
|
.values()
|
||||||
.filter(|member| member.status == PlayerJamMemberStatus::Joined)
|
.filter(|member| member.status == PlayerJamMemberStatus::Joined)
|
||||||
.count() as i64;
|
.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();
|
let host_device_online = self.jam_target_device_id_locked(state, jam).is_some();
|
||||||
Some(PlayerJamDto {
|
Some(PlayerJamDto {
|
||||||
id: jam.id.clone(),
|
id: jam.id.clone(),
|
||||||
@@ -625,6 +704,7 @@ impl PlayerDeviceHub {
|
|||||||
member_count,
|
member_count,
|
||||||
host_last_seen_ms: now.saturating_sub(jam.host_last_seen_ms),
|
host_last_seen_ms: now.saturating_sub(jam.host_last_seen_ms),
|
||||||
host_device_online,
|
host_device_online,
|
||||||
|
members,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@@ -849,6 +929,7 @@ async fn me_handler(
|
|||||||
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
|
||||||
Json(UserProfile {
|
Json(UserProfile {
|
||||||
|
id: user.id,
|
||||||
name: user.name,
|
name: user.name,
|
||||||
role: user.role.code().to_string(),
|
role: user.role.code().to_string(),
|
||||||
stats: UserStats {
|
stats: UserStats {
|
||||||
@@ -1877,6 +1958,36 @@ async fn user_upload_review_save_handler(
|
|||||||
Json(review).into_response()
|
Json(review).into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn user_upload_review_delete_handler(
|
||||||
|
session: Session,
|
||||||
|
db: Database,
|
||||||
|
pool: &sqlx::PgPool,
|
||||||
|
path: Path<PathId>,
|
||||||
|
) -> 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 review_id = path.0.id;
|
||||||
|
let uploaded_by_pattern = format!(r#""uploaded_by_user_id"\s*:\s*{}([^0-9]|$)"#, user.id);
|
||||||
|
let result = sqlx::query(
|
||||||
|
r#"DELETE FROM furumusic__pending_review
|
||||||
|
WHERE id = $1
|
||||||
|
AND context_json IS NOT NULL
|
||||||
|
AND context_json ~ $2
|
||||||
|
AND status IN ('pending', 'failed')"#,
|
||||||
|
)
|
||||||
|
.bind(review_id)
|
||||||
|
.bind(uploaded_by_pattern)
|
||||||
|
.execute(pool)
|
||||||
|
.await
|
||||||
|
.map_err(|e| cot::Error::internal(e.to_string()))?;
|
||||||
|
if result.rows_affected() == 0 {
|
||||||
|
return Ok(json_error(StatusCode::NOT_FOUND, "upload review not found"));
|
||||||
|
}
|
||||||
|
let page = load_user_uploads_page(pool, user.id, 500).await?;
|
||||||
|
Json(page).into_response()
|
||||||
|
}
|
||||||
|
|
||||||
async fn user_upload_review_approve_handler(
|
async fn user_upload_review_approve_handler(
|
||||||
session: Session,
|
session: Session,
|
||||||
db: Database,
|
db: Database,
|
||||||
@@ -3869,18 +3980,42 @@ async fn devices_command_handler(
|
|||||||
None => None,
|
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(
|
match hub.enqueue_command(
|
||||||
user.id,
|
user.id,
|
||||||
target_device_id.as_deref(),
|
target_device_id.as_deref(),
|
||||||
jam_id.as_deref(),
|
jam_id.as_deref(),
|
||||||
command,
|
command,
|
||||||
dto.payload,
|
payload,
|
||||||
) {
|
) {
|
||||||
Ok(()) => Json(serde_json::json!({"ok": true})).into_response(),
|
Ok(()) => Json(serde_json::json!({"ok": true})).into_response(),
|
||||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
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(
|
async fn jam_users_search_handler(
|
||||||
session: Session,
|
session: Session,
|
||||||
db: Database,
|
db: Database,
|
||||||
@@ -3954,19 +4089,31 @@ async fn jam_create_handler(
|
|||||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut invitee_ids = dto
|
let invitees = load_jam_invitees(pool, user.id, dto.invitee_user_ids).await?;
|
||||||
.invitee_user_ids
|
|
||||||
|
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()
|
.into_iter()
|
||||||
.filter(|id| *id > 0 && *id != user.id)
|
.filter(|id| *id > 0 && *id != current_user_id)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
invitee_ids.sort_unstable();
|
invitee_ids.sort_unstable();
|
||||||
invitee_ids.dedup();
|
invitee_ids.dedup();
|
||||||
invitee_ids.truncate(PLAYER_JAM_MAX_INVITEES);
|
invitee_ids.truncate(PLAYER_JAM_MAX_INVITEES);
|
||||||
|
|
||||||
let invitees = if invitee_ids.is_empty() {
|
if invitee_ids.is_empty() {
|
||||||
Vec::new()
|
Ok(Vec::new())
|
||||||
} else {
|
} else {
|
||||||
sqlx::query_as::<_, PlayerJamUserRow>(
|
let invitees = sqlx::query_as::<_, PlayerJamUserRow>(
|
||||||
r#"SELECT id, username::text AS username, display_name, email
|
r#"SELECT id, username::text AS username, display_name, email
|
||||||
FROM furumusic__user
|
FROM furumusic__user
|
||||||
WHERE is_active = true AND id = ANY($1)"#,
|
WHERE is_active = true AND id = ANY($1)"#,
|
||||||
@@ -3985,12 +4132,8 @@ async fn jam_create_handler(
|
|||||||
.to_string();
|
.to_string();
|
||||||
(row.id, name)
|
(row.id, name)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>();
|
||||||
};
|
Ok(invitees)
|
||||||
|
|
||||||
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)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4010,7 +4153,31 @@ async fn jam_join_handler(
|
|||||||
return Ok(json_error(StatusCode::BAD_REQUEST, "invalid device id"));
|
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(),
|
Ok(response) => Json(response).into_response(),
|
||||||
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
Err(message) => Ok(json_error(StatusCode::BAD_REQUEST, message)),
|
||||||
}
|
}
|
||||||
@@ -5778,6 +5945,30 @@ impl App for PlayerApp {
|
|||||||
}),
|
}),
|
||||||
"player_upload_review_save",
|
"player_upload_review_save",
|
||||||
),
|
),
|
||||||
|
Route::with_handler_and_name(
|
||||||
|
"/uploads/reviews/{id}",
|
||||||
|
delete({
|
||||||
|
let pool = Arc::clone(&pool);
|
||||||
|
let pool_config = Arc::clone(&pool_config);
|
||||||
|
move |session: Session, db: Database, path: Path<PathId>| {
|
||||||
|
let pool = Arc::clone(&pool);
|
||||||
|
let pool_config = Arc::clone(&pool_config);
|
||||||
|
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;
|
||||||
|
user_upload_review_delete_handler(session, db, pg_pool, path).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
"player_upload_review_delete",
|
||||||
|
),
|
||||||
Route::with_handler_and_name(
|
Route::with_handler_and_name(
|
||||||
"/uploads/reviews/{id}/approve",
|
"/uploads/reviews/{id}/approve",
|
||||||
post({
|
post({
|
||||||
@@ -6517,6 +6708,32 @@ impl App for PlayerApp {
|
|||||||
}),
|
}),
|
||||||
"player_jams_join",
|
"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(
|
Route::with_handler_and_name(
|
||||||
"/jams/leave",
|
"/jams/leave",
|
||||||
post({
|
post({
|
||||||
|
|||||||
+124
-9
@@ -975,6 +975,16 @@ tbody tr:hover {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.artist-result small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 2px;
|
||||||
|
color: var(--text-subdued);
|
||||||
|
font-size: 11px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.artist-result:hover,
|
.artist-result:hover,
|
||||||
.artist-result:focus {
|
.artist-result:focus {
|
||||||
background: var(--bg-hover);
|
background: var(--bg-hover);
|
||||||
@@ -1452,6 +1462,7 @@ tbody tr:hover {
|
|||||||
<div class="segmented">
|
<div class="segmented">
|
||||||
<button class="seg-btn" :class="{active: libraryKind === 'artists'}" @click="openLibrary('artists')">Artists</button>
|
<button class="seg-btn" :class="{active: libraryKind === 'artists'}" @click="openLibrary('artists')">Artists</button>
|
||||||
<button class="seg-btn" :class="{active: libraryKind === 'releases'}" @click="openLibrary('releases')">Releases</button>
|
<button class="seg-btn" :class="{active: libraryKind === 'releases'}" @click="openLibrary('releases')">Releases</button>
|
||||||
|
<button class="seg-btn" :class="{active: libraryKind === 'tracks'}" @click="openLibrary('tracks')">Tracks</button>
|
||||||
<button class="seg-btn" :class="{active: libraryKind === 'playlists'}" @click="openLibrary('playlists')">Playlists</button>
|
<button class="seg-btn" :class="{active: libraryKind === 'playlists'}" @click="openLibrary('playlists')">Playlists</button>
|
||||||
</div>
|
</div>
|
||||||
<input class="search" placeholder="Search library" x-model="librarySearch" @input.debounce.350ms="loadLibrary()" />
|
<input class="search" placeholder="Search library" x-model="librarySearch" @input.debounce.350ms="loadLibrary()" />
|
||||||
@@ -1923,7 +1934,7 @@ tbody tr:hover {
|
|||||||
<div class="empty" x-show="editorLoading">Loading editor...</div>
|
<div class="empty" x-show="editorLoading">Loading editor...</div>
|
||||||
<div x-show="!editorLoading">
|
<div x-show="!editorLoading">
|
||||||
<div class="field">
|
<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" />
|
<input x-model="editorDraft.title" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1947,8 +1958,43 @@ tbody tr:hover {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field" x-show="isReleaseEditor()">
|
<div class="editor-grid" x-show="isTrackEditor()">
|
||||||
<label>Release artists</label>
|
<div class="field">
|
||||||
|
<label>Track #</label>
|
||||||
|
<input type="number" min="1" max="9999" x-model="editorDraft.track_number" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label>Disc #</label>
|
||||||
|
<input type="number" min="1" max="999" x-model="editorDraft.disc_number" />
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label>Year</label>
|
||||||
|
<input type="number" min="0" max="3000" x-model="editorDraft.year" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field" x-show="isTrackEditor()">
|
||||||
|
<label>Release</label>
|
||||||
|
<div class="artist-tags">
|
||||||
|
<span class="tag relation" x-show="selectedEditorRelease()" x-text="selectedEditorReleaseLabel()"></span>
|
||||||
|
<span class="muted" x-show="!selectedEditorRelease()">No release selected</span>
|
||||||
|
</div>
|
||||||
|
<div class="artist-picker">
|
||||||
|
<input class="search" placeholder="Search release to move track" x-model="editorReleaseToAdd" @keydown.enter.prevent="selectEditorRelease()" @keydown.escape="editorReleaseToAdd = ''" />
|
||||||
|
<div class="artist-results" x-show="editorReleaseSearchOpen()" x-transition>
|
||||||
|
<template x-for="release in filteredEditorReleases()" :key="release.id">
|
||||||
|
<button class="artist-result" type="button" @click="selectEditorRelease(release)">
|
||||||
|
<span x-text="release.title"></span>
|
||||||
|
<small x-text="release.subtitle"></small>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<div class="artist-result muted" x-show="filteredEditorReleases().length === 0">No matching releases</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field" x-show="isReleaseEditor() || isTrackEditor()">
|
||||||
|
<label x-text="isTrackEditor() ? 'Track artists' : 'Release artists'"></label>
|
||||||
<div class="artist-tags">
|
<div class="artist-tags">
|
||||||
<template x-for="artist in selectedEditorArtists()" :key="artist.id">
|
<template x-for="artist in selectedEditorArtists()" :key="artist.id">
|
||||||
<span class="tag relation">
|
<span class="tag relation">
|
||||||
@@ -2099,8 +2145,9 @@ function adminV2() {
|
|||||||
editorImageUploading: false,
|
editorImageUploading: false,
|
||||||
editorImageFile: null,
|
editorImageFile: null,
|
||||||
editorArtistToAdd: '',
|
editorArtistToAdd: '',
|
||||||
|
editorReleaseToAdd: '',
|
||||||
editorDetail: null,
|
editorDetail: null,
|
||||||
editorDraft: { title: '', hidden: 'false', release_type: 'album', year: '', artist_ids: [] },
|
editorDraft: { title: '', hidden: 'false', release_type: 'album', year: '', release_id: null, track_number: '', disc_number: '', artist_ids: [] },
|
||||||
settings: { values: {}, sources: {}, lastfm_api_key_configured: false, lastfm_shared_secret_configured: false, lastfm_scrobbling_configured: false },
|
settings: { values: {}, sources: {}, lastfm_api_key_configured: false, lastfm_shared_secret_configured: false, lastfm_scrobbling_configured: false },
|
||||||
settingsDraft: {
|
settingsDraft: {
|
||||||
auth_password_enabled: false,
|
auth_password_enabled: false,
|
||||||
@@ -2196,7 +2243,7 @@ function adminV2() {
|
|||||||
this.activeView = 'jobs';
|
this.activeView = 'jobs';
|
||||||
if (parts[1]) this.activeJobName = decodeURIComponent(parts[1]);
|
if (parts[1]) this.activeJobName = decodeURIComponent(parts[1]);
|
||||||
} else if (view === 'library') {
|
} else if (view === 'library') {
|
||||||
const nextKind = ['artists', 'releases', 'playlists'].includes(parts[1]) ? parts[1] : 'artists';
|
const nextKind = ['artists', 'releases', 'tracks', 'playlists'].includes(parts[1]) ? parts[1] : 'artists';
|
||||||
if (this.libraryKind !== nextKind) this.clearLibrarySelection();
|
if (this.libraryKind !== nextKind) this.clearLibrarySelection();
|
||||||
this.activeView = 'library';
|
this.activeView = 'library';
|
||||||
this.libraryKind = nextKind;
|
this.libraryKind = nextKind;
|
||||||
@@ -2256,7 +2303,7 @@ function adminV2() {
|
|||||||
|
|
||||||
openLibrary(kind = this.libraryKind) {
|
openLibrary(kind = this.libraryKind) {
|
||||||
this.activeView = 'library';
|
this.activeView = 'library';
|
||||||
const nextKind = ['artists', 'releases', 'playlists'].includes(kind) ? kind : 'artists';
|
const nextKind = ['artists', 'releases', 'tracks', 'playlists'].includes(kind) ? kind : 'artists';
|
||||||
if (this.libraryKind !== nextKind) this.clearLibrarySelection();
|
if (this.libraryKind !== nextKind) this.clearLibrarySelection();
|
||||||
this.libraryKind = nextKind;
|
this.libraryKind = nextKind;
|
||||||
this.setRoute(`#library/${this.libraryKind}`);
|
this.setRoute(`#library/${this.libraryKind}`);
|
||||||
@@ -2618,11 +2665,15 @@ function adminV2() {
|
|||||||
hidden: item.is_hidden ? 'true' : 'false',
|
hidden: item.is_hidden ? 'true' : 'false',
|
||||||
release_type: 'album',
|
release_type: 'album',
|
||||||
year: '',
|
year: '',
|
||||||
|
release_id: null,
|
||||||
|
track_number: '',
|
||||||
|
disc_number: '',
|
||||||
artist_ids: []
|
artist_ids: []
|
||||||
};
|
};
|
||||||
this.editorDetail = null;
|
this.editorDetail = null;
|
||||||
this.editorImageFile = null;
|
this.editorImageFile = null;
|
||||||
this.editorArtistToAdd = '';
|
this.editorArtistToAdd = '';
|
||||||
|
this.editorReleaseToAdd = '';
|
||||||
this.editorOpen = true;
|
this.editorOpen = true;
|
||||||
this.loadEditorDetail(item);
|
this.loadEditorDetail(item);
|
||||||
},
|
},
|
||||||
@@ -2640,10 +2691,14 @@ function adminV2() {
|
|||||||
hidden: detail.hidden ? 'true' : 'false',
|
hidden: detail.hidden ? 'true' : 'false',
|
||||||
release_type: detail.release_type || 'album',
|
release_type: detail.release_type || 'album',
|
||||||
year: detail.year || '',
|
year: detail.year || '',
|
||||||
|
release_id: detail.release_id || null,
|
||||||
|
track_number: detail.track_number || '',
|
||||||
|
disc_number: detail.disc_number || '',
|
||||||
artist_ids: Array.isArray(detail.selected_artist_ids) ? detail.selected_artist_ids.slice() : []
|
artist_ids: Array.isArray(detail.selected_artist_ids) ? detail.selected_artist_ids.slice() : []
|
||||||
};
|
};
|
||||||
this.editorImageFile = null;
|
this.editorImageFile = null;
|
||||||
this.editorArtistToAdd = '';
|
this.editorArtistToAdd = '';
|
||||||
|
this.editorReleaseToAdd = '';
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.showToast(error.message);
|
this.showToast(error.message);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -2662,12 +2717,18 @@ function adminV2() {
|
|||||||
return this.activeLibraryItem && this.activeLibraryItem.kind === 'releases';
|
return this.activeLibraryItem && this.activeLibraryItem.kind === 'releases';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isTrackEditor() {
|
||||||
|
return this.activeLibraryItem && this.activeLibraryItem.kind === 'tracks';
|
||||||
|
},
|
||||||
|
|
||||||
canEditLibraryImage() {
|
canEditLibraryImage() {
|
||||||
return this.isArtistEditor() || this.isReleaseEditor();
|
return this.isArtistEditor() || this.isReleaseEditor();
|
||||||
},
|
},
|
||||||
|
|
||||||
editorCanSave() {
|
editorCanSave() {
|
||||||
return Boolean(this.activeLibraryItem && this.editorDetail && !this.editorLoading && !this.editorSaving);
|
if (!this.activeLibraryItem || !this.editorDetail || this.editorLoading || this.editorSaving) return false;
|
||||||
|
if (this.isTrackEditor() && !this.editorDraft.release_id) return false;
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectedEditorArtists() {
|
selectedEditorArtists() {
|
||||||
@@ -2710,7 +2771,7 @@ function adminV2() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
editorArtistSearchOpen() {
|
editorArtistSearchOpen() {
|
||||||
return this.isReleaseEditor() && String(this.editorArtistToAdd || '').trim().length > 0;
|
return (this.isReleaseEditor() || this.isTrackEditor()) && String(this.editorArtistToAdd || '').trim().length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
addEditorArtist(artist = null) {
|
addEditorArtist(artist = null) {
|
||||||
@@ -2729,6 +2790,51 @@ function adminV2() {
|
|||||||
this.editorDraft.artist_ids = (this.editorDraft.artist_ids || []).filter(value => Number(value) !== Number(id));
|
this.editorDraft.artist_ids = (this.editorDraft.artist_ids || []).filter(value => Number(value) !== Number(id));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
selectedEditorRelease() {
|
||||||
|
const releases = (this.editorDetail && this.editorDetail.releases) || [];
|
||||||
|
return releases.find(row => Number(row.id) === Number(this.editorDraft.release_id));
|
||||||
|
},
|
||||||
|
|
||||||
|
selectedEditorReleaseLabel() {
|
||||||
|
const release = this.selectedEditorRelease();
|
||||||
|
if (!release) return '';
|
||||||
|
return release.subtitle ? `${release.title} / ${release.subtitle}` : release.title;
|
||||||
|
},
|
||||||
|
|
||||||
|
filteredEditorReleases() {
|
||||||
|
const releases = (this.editorDetail && this.editorDetail.releases) || [];
|
||||||
|
const query = String(this.editorReleaseToAdd || '').trim().toLowerCase();
|
||||||
|
const currentId = Number(this.editorDraft.release_id || 0);
|
||||||
|
const candidates = releases.filter(release => Number(release.id) !== currentId);
|
||||||
|
if (!query) return candidates.slice(0, 12);
|
||||||
|
return candidates
|
||||||
|
.map(release => {
|
||||||
|
const haystack = `${release.title || ''} ${release.subtitle || ''}`.toLowerCase();
|
||||||
|
let score = 3;
|
||||||
|
if (String(release.title || '').toLowerCase() === query) score = 0;
|
||||||
|
else if (String(release.title || '').toLowerCase().startsWith(query)) score = 1;
|
||||||
|
else if (haystack.includes(query)) score = 2;
|
||||||
|
return { release, score };
|
||||||
|
})
|
||||||
|
.filter(row => row.score < 3)
|
||||||
|
.sort((a, b) => a.score - b.score || a.release.title.localeCompare(b.release.title))
|
||||||
|
.slice(0, 12)
|
||||||
|
.map(row => row.release);
|
||||||
|
},
|
||||||
|
|
||||||
|
editorReleaseSearchOpen() {
|
||||||
|
return this.isTrackEditor() && String(this.editorReleaseToAdd || '').trim().length > 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
selectEditorRelease(release = null) {
|
||||||
|
const candidates = this.filteredEditorReleases();
|
||||||
|
release = release || candidates[0];
|
||||||
|
if (!release) return false;
|
||||||
|
this.editorDraft.release_id = Number(release.id);
|
||||||
|
this.editorReleaseToAdd = '';
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
setEditorImageFile(event) {
|
setEditorImageFile(event) {
|
||||||
this.editorImageFile = event.target.files && event.target.files.length ? event.target.files[0] : null;
|
this.editorImageFile = event.target.files && event.target.files.length ? event.target.files[0] : null;
|
||||||
},
|
},
|
||||||
@@ -2844,6 +2950,12 @@ function adminV2() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async saveLibraryItem() {
|
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;
|
if (!this.editorCanSave()) return;
|
||||||
this.editorSaving = true;
|
this.editorSaving = true;
|
||||||
try {
|
try {
|
||||||
@@ -2856,6 +2968,9 @@ function adminV2() {
|
|||||||
hidden: this.editorDraft.hidden === 'true',
|
hidden: this.editorDraft.hidden === 'true',
|
||||||
release_type: this.editorDraft.release_type || null,
|
release_type: this.editorDraft.release_type || null,
|
||||||
year: this.editorDraft.year || '',
|
year: this.editorDraft.year || '',
|
||||||
|
release_id: this.editorDraft.release_id ? Number(this.editorDraft.release_id) : null,
|
||||||
|
track_number: this.editorDraft.track_number || '',
|
||||||
|
disc_number: this.editorDraft.disc_number || '',
|
||||||
artist_ids: this.editorDraft.artist_ids || []
|
artist_ids: this.editorDraft.artist_ids || []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -2931,7 +3046,7 @@ function adminV2() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
pageSubtitle() {
|
pageSubtitle() {
|
||||||
if (this.activeView === 'library') return 'Fast entity control surface for artists, releases, and playlists';
|
if (this.activeView === 'library') return 'Fast entity control surface for artists, releases, tracks, and playlists';
|
||||||
if (this.activeView === 'jobs') return 'Scheduler state, recent runs, and manual controls in one place';
|
if (this.activeView === 'jobs') return 'Scheduler state, recent runs, and manual controls in one place';
|
||||||
if (this.activeView === 'tools') return 'Reserved space for merge, split, enrichment, and destructive workflows';
|
if (this.activeView === 'tools') return 'Reserved space for merge, split, enrichment, and destructive workflows';
|
||||||
if (this.activeView === 'settings') return 'Application configuration and external API credentials';
|
if (this.activeView === 'settings') return 'Application configuration and external API credentials';
|
||||||
|
|||||||
@@ -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)">
|
<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>
|
<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>
|
||||||
<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-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-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 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>
|
||||||
<div class="upload-track-actions">
|
<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>
|
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.editUpload(item)">Edit</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -472,7 +472,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="upload-field upload-field-wide"><span>Notes</span><textarea rows="4" x-model="$store.torrents.uploadReviewDraft.notes"></textarea></label>
|
<label class="upload-field upload-field-wide"><span>Notes</span><textarea rows="4" x-model="$store.torrents.uploadReviewDraft.notes"></textarea></label>
|
||||||
<div class="upload-editor-actions">
|
<div class="upload-editor-actions">
|
||||||
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.saveUploadReview()" :disabled="$store.torrents.uploadReviewSavingId === $store.torrents.uploadReviewEditId">Save draft</button>
|
<button class="modal-btn modal-btn-danger" @click="$store.torrents.deleteUploadReview()" :disabled="$store.torrents.uploadReviewSavingId === $store.torrents.uploadReviewEditId">Delete review</button>
|
||||||
<button class="modal-btn modal-btn-primary" @click="$store.torrents.approveUploadReview()" :disabled="$store.torrents.uploadReviewSavingId === $store.torrents.uploadReviewEditId">Approve</button>
|
<button class="modal-btn modal-btn-primary" @click="$store.torrents.approveUploadReview()" :disabled="$store.torrents.uploadReviewSavingId === $store.torrents.uploadReviewEditId">Approve</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -516,11 +516,6 @@
|
|||||||
<div class="upload-track-card" :class="{ hidden: item.is_hidden }">
|
<div class="upload-track-card" :class="{ hidden: item.is_hidden }">
|
||||||
<template x-if="$store.torrents.uploadEditId !== item.track.id">
|
<template x-if="$store.torrents.uploadEditId !== item.track.id">
|
||||||
<div class="upload-track-display">
|
<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-main">
|
||||||
<div class="upload-track-title">
|
<div class="upload-track-title">
|
||||||
<span x-text="item.track.title"></span>
|
<span x-text="item.track.title"></span>
|
||||||
@@ -535,8 +530,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="upload-track-actions">
|
<div class="upload-track-actions">
|
||||||
<button class="track-action-btn" @click="$store.queue.addNextInQueue([item.track])" title="{{ t.player_play_next }}">
|
<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 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
<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>
|
||||||
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.editUpload(item)">Edit</button>
|
<button class="modal-btn modal-btn-ghost" @click="$store.torrents.editUpload(item)">Edit</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+383
-18
@@ -165,6 +165,19 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
Alpine.store('mobile', {
|
Alpine.store('mobile', {
|
||||||
libraryOpen: false,
|
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() {
|
toggleLibrary() {
|
||||||
this.libraryOpen = !this.libraryOpen;
|
this.libraryOpen = !this.libraryOpen;
|
||||||
if (this.libraryOpen) Alpine.store('user').menuOpen = false;
|
if (this.libraryOpen) Alpine.store('user').menuOpen = false;
|
||||||
@@ -172,6 +185,121 @@ document.addEventListener('alpine:init', () => {
|
|||||||
closeLibrary() {
|
closeLibrary() {
|
||||||
this.libraryOpen = false;
|
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', {
|
Alpine.store('info', {
|
||||||
@@ -411,6 +539,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
volume: 0.7,
|
volume: 0.7,
|
||||||
_prevVolume: 0.7,
|
_prevVolume: 0.7,
|
||||||
|
_volumeCurve: 2.4,
|
||||||
shuffle: false,
|
shuffle: false,
|
||||||
repeatMode: 'off', // off, all, one
|
repeatMode: 'off', // off, all, one
|
||||||
progress: 0,
|
progress: 0,
|
||||||
@@ -662,10 +791,21 @@ document.addEventListener('alpine:init', () => {
|
|||||||
audio.volume = this.volume;
|
audio.volume = this.volume;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
volumeSliderPercent() {
|
||||||
|
if (this.volume <= 0) return 0;
|
||||||
|
return Math.pow(this.volume, 1 / this._volumeCurve) * 100;
|
||||||
|
},
|
||||||
|
|
||||||
|
_volumeFromSliderPosition(position) {
|
||||||
|
const pct = Math.max(0, Math.min(1, Number(position || 0)));
|
||||||
|
if (pct <= 0.002) return 0;
|
||||||
|
return Math.pow(pct, this._volumeCurve);
|
||||||
|
},
|
||||||
|
|
||||||
_setVolumeFromClientX(clientX, bar) {
|
_setVolumeFromClientX(clientX, bar) {
|
||||||
const rect = bar.getBoundingClientRect();
|
const rect = bar.getBoundingClientRect();
|
||||||
const pct = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;
|
const pct = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;
|
||||||
this.setVolume(pct);
|
this.setVolume(this._volumeFromSliderPosition(pct));
|
||||||
},
|
},
|
||||||
|
|
||||||
setVolumeFromClick(event) {
|
setVolumeFromClick(event) {
|
||||||
@@ -740,7 +880,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
_remotePlaybackPayload(track, overrides = {}) {
|
_remotePlaybackPayload(track, overrides = {}) {
|
||||||
const queue = Alpine.store('queue');
|
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);
|
let index = Number.isInteger(overrides.index) ? overrides.index : (queue?.currentIndex ?? 0);
|
||||||
if (track && tracks[index]?.id !== track.id) {
|
if (track && tracks[index]?.id !== track.id) {
|
||||||
const foundIndex = tracks.findIndex(item => item.id === track.id);
|
const foundIndex = tracks.findIndex(item => item.id === track.id);
|
||||||
@@ -787,7 +927,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
const queue = Alpine.store('queue');
|
const queue = Alpine.store('queue');
|
||||||
const tracks = Array.isArray(state.tracks) ? state.tracks.filter(Boolean) : [];
|
const tracks = Array.isArray(state.tracks) ? state.tracks.filter(Boolean) : [];
|
||||||
if (queue && tracks.length > 0) {
|
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));
|
queue.currentIndex = Math.max(0, Math.min(Number(state.index || 0), tracks.length - 1));
|
||||||
}
|
}
|
||||||
const track = state.track || queue?.tracks?.[queue.currentIndex] || null;
|
const track = state.track || queue?.tracks?.[queue.currentIndex] || null;
|
||||||
@@ -830,7 +970,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
if (command.command === 'play_track' || command.command === 'play_from_index' || command.command === 'transfer_state') {
|
if (command.command === 'play_track' || command.command === 'play_from_index' || command.command === 'transfer_state') {
|
||||||
if (Array.isArray(payload.tracks) && payload.tracks.length > 0) {
|
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));
|
queue.currentIndex = Math.max(0, Math.min(Number(payload.index || 0), queue.tracks.length - 1));
|
||||||
}
|
}
|
||||||
const track = payload.track || queue.tracks[queue.currentIndex];
|
const track = payload.track || queue.tracks[queue.currentIndex];
|
||||||
@@ -1070,6 +1210,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
currentJamId: null,
|
currentJamId: null,
|
||||||
open: false,
|
open: false,
|
||||||
jamPanelOpen: false,
|
jamPanelOpen: false,
|
||||||
|
jamPanelMode: 'create',
|
||||||
|
jamPanelJamId: null,
|
||||||
jamQuery: '',
|
jamQuery: '',
|
||||||
jamUsers: [],
|
jamUsers: [],
|
||||||
jamSelectedUsers: [],
|
jamSelectedUsers: [],
|
||||||
@@ -1169,6 +1311,47 @@ document.addEventListener('alpine:init', () => {
|
|||||||
return this.currentJamId ? this.jams.find(jam => jam.id === this.currentJamId) : null;
|
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() {
|
isControllingRemoteJam() {
|
||||||
const jam = this.selectedJam();
|
const jam = this.selectedJam();
|
||||||
return !!jam && !jam.is_owner;
|
return !!jam && !jam.is_owner;
|
||||||
@@ -1243,10 +1426,39 @@ document.addEventListener('alpine:init', () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
openJamPanel() {
|
openJamPanel() {
|
||||||
|
if (this.hasJoinedJam()) return;
|
||||||
|
this.jamPanelMode = 'create';
|
||||||
|
this.jamPanelJamId = null;
|
||||||
|
this.jamSelectedUsers = [];
|
||||||
|
this.jamUsers = [];
|
||||||
|
this.jamQuery = '';
|
||||||
this.jamPanelOpen = !this.jamPanelOpen;
|
this.jamPanelOpen = !this.jamPanelOpen;
|
||||||
if (this.jamPanelOpen && this.jamQuery.trim()) this.searchJamUsers();
|
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() {
|
queueJamSearch() {
|
||||||
clearTimeout(this._jamSearchTimer);
|
clearTimeout(this._jamSearchTimer);
|
||||||
this._jamSearchTimer = setTimeout(() => this.searchJamUsers(), 180);
|
this._jamSearchTimer = setTimeout(() => this.searchJamUsers(), 180);
|
||||||
@@ -1263,7 +1475,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
const res = await fetch('/api/player/jams/users?q=' + encodeURIComponent(query));
|
const res = await fetch('/api/player/jams/users?q=' + encodeURIComponent(query));
|
||||||
if (!res.ok) return;
|
if (!res.ok) return;
|
||||||
const selected = new Set(this.jamSelectedUsers.map(user => user.id));
|
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 {
|
} catch {
|
||||||
} finally {
|
} finally {
|
||||||
this.jamSearching = false;
|
this.jamSearching = false;
|
||||||
@@ -1281,7 +1494,13 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this.jamSelectedUsers = this.jamSelectedUsers.filter(user => user.id !== userId);
|
this.jamSelectedUsers = this.jamSelectedUsers.filter(user => user.id !== userId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
submitJamPanel() {
|
||||||
|
if (this.jamPanelMode === 'manage') this.inviteToJam();
|
||||||
|
else this.createJam();
|
||||||
|
},
|
||||||
|
|
||||||
async createJam() {
|
async createJam() {
|
||||||
|
if (this.hasJoinedJam()) return;
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/player/jams', {
|
const res = await fetch('/api/player/jams', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -1294,6 +1513,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
if (!res.ok) return;
|
if (!res.ok) return;
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
this._apply(data);
|
this._apply(data);
|
||||||
|
Alpine.store('queue')?._ensureCurrentJamAttribution();
|
||||||
this.jamPanelOpen = false;
|
this.jamPanelOpen = false;
|
||||||
this.jamQuery = '';
|
this.jamQuery = '';
|
||||||
this.jamUsers = [];
|
this.jamUsers = [];
|
||||||
@@ -1302,6 +1522,26 @@ document.addEventListener('alpine:init', () => {
|
|||||||
} catch {}
|
} 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) {
|
async selectJam(jam) {
|
||||||
if (!jam) return;
|
if (!jam) return;
|
||||||
try {
|
try {
|
||||||
@@ -1322,6 +1562,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this.currentJamId = jam.id;
|
this.currentJamId = jam.id;
|
||||||
sessionStorage.setItem('furu_player_jam_id', jam.id);
|
sessionStorage.setItem('furu_player_jam_id', jam.id);
|
||||||
this._apply(data);
|
this._apply(data);
|
||||||
|
Alpine.store('queue')?._ensureCurrentJamAttribution();
|
||||||
this.open = false;
|
this.open = false;
|
||||||
const player = Alpine.store('player');
|
const player = Alpine.store('player');
|
||||||
if (player && this.isControllingRemoteJam() && data.playback_state) {
|
if (player && this.isControllingRemoteJam() && data.playback_state) {
|
||||||
@@ -1351,6 +1592,8 @@ document.addEventListener('alpine:init', () => {
|
|||||||
|
|
||||||
clearJamSelection() {
|
clearJamSelection() {
|
||||||
this.currentJamId = null;
|
this.currentJamId = null;
|
||||||
|
this.jamPanelOpen = false;
|
||||||
|
this.jamPanelJamId = null;
|
||||||
sessionStorage.removeItem('furu_player_jam_id');
|
sessionStorage.removeItem('furu_player_jam_id');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1363,13 +1606,21 @@ document.addEventListener('alpine:init', () => {
|
|||||||
currentIndex: 0,
|
currentIndex: 0,
|
||||||
visible: false,
|
visible: false,
|
||||||
_dragIdx: null,
|
_dragIdx: null,
|
||||||
|
_dragOverIdx: null,
|
||||||
|
_pointerDragMove: null,
|
||||||
|
_pointerDragEnd: null,
|
||||||
|
|
||||||
add(track) {
|
add(track) {
|
||||||
this.addToEnd([track]);
|
this.addToEnd([track]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
upcoming(limit = 12) {
|
||||||
|
const start = Math.max(0, this.currentIndex + 1);
|
||||||
|
return this.tracks.slice(start, start + limit);
|
||||||
|
},
|
||||||
|
|
||||||
addToEnd(tracks) {
|
addToEnd(tracks) {
|
||||||
const items = this._trackList(tracks);
|
const items = this._tracksForQueueAdd(tracks);
|
||||||
if (!items.length) return;
|
if (!items.length) return;
|
||||||
if (this._sendRemoteQueueCommand('queue_add_end', { tracks: items })) {
|
if (this._sendRemoteQueueCommand('queue_add_end', { tracks: items })) {
|
||||||
this._addToEndLocal(items);
|
this._addToEndLocal(items);
|
||||||
@@ -1379,7 +1630,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addNextInQueue(tracks) {
|
addNextInQueue(tracks) {
|
||||||
const items = this._trackList(tracks);
|
const items = this._tracksForQueueAdd(tracks);
|
||||||
if (!items.length) return;
|
if (!items.length) return;
|
||||||
if (this._sendRemoteQueueCommand('queue_add_next', { tracks: items })) {
|
if (this._sendRemoteQueueCommand('queue_add_next', { tracks: items })) {
|
||||||
this._addNextLocal(items);
|
this._addNextLocal(items);
|
||||||
@@ -1389,7 +1640,7 @@ document.addEventListener('alpine:init', () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
playRelease(tracks, startIndex) {
|
playRelease(tracks, startIndex) {
|
||||||
this.tracks = [...tracks];
|
this.tracks = this._tracksForQueueAdd(tracks);
|
||||||
this.playFromIndex(startIndex || 0);
|
this.playFromIndex(startIndex || 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1414,6 +1665,74 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this._moveTrackLocal(fromIdx, toIdx);
|
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() {
|
clear() {
|
||||||
if (this._sendRemoteQueueCommand('queue_clear')) {
|
if (this._sendRemoteQueueCommand('queue_clear')) {
|
||||||
this._clearLocal();
|
this._clearLocal();
|
||||||
@@ -1426,6 +1745,53 @@ document.addEventListener('alpine:init', () => {
|
|||||||
return (Array.isArray(tracks) ? tracks : [tracks]).filter(Boolean);
|
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 = {}) {
|
_sendRemoteQueueCommand(command, payload = {}) {
|
||||||
const player = Alpine.store('player');
|
const player = Alpine.store('player');
|
||||||
if (!player?._shouldSendRemote()) return false;
|
if (!player?._shouldSendRemote()) return false;
|
||||||
@@ -1434,13 +1800,13 @@ document.addEventListener('alpine:init', () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_addToEndLocal(tracks) {
|
_addToEndLocal(tracks) {
|
||||||
const items = this._trackList(tracks);
|
const items = this._tracksWithJamDefaults(tracks);
|
||||||
if (!items.length) return;
|
if (!items.length) return;
|
||||||
this.tracks = [...this.tracks, ...items];
|
this.tracks = [...this.tracks, ...items];
|
||||||
},
|
},
|
||||||
|
|
||||||
_addNextLocal(tracks) {
|
_addNextLocal(tracks) {
|
||||||
const items = this._trackList(tracks);
|
const items = this._tracksWithJamDefaults(tracks);
|
||||||
if (!items.length) return;
|
if (!items.length) return;
|
||||||
const insertAt = Math.min(this.currentIndex + 1, this.tracks.length);
|
const insertAt = Math.min(this.currentIndex + 1, this.tracks.length);
|
||||||
this.tracks.splice(insertAt, 0, ...items);
|
this.tracks.splice(insertAt, 0, ...items);
|
||||||
@@ -2706,20 +3072,19 @@ document.addEventListener('alpine:init', () => {
|
|||||||
this.uploadReviewDraft = null;
|
this.uploadReviewDraft = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
async saveUploadReview() {
|
async deleteUploadReview() {
|
||||||
if (!this.uploadReviewEditId || !this.uploadReviewDraft) return;
|
if (!this.uploadReviewEditId) return;
|
||||||
const id = this.uploadReviewEditId;
|
const id = this.uploadReviewEditId;
|
||||||
this.uploadReviewSavingId = id;
|
this.uploadReviewSavingId = id;
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/player/uploads/reviews/${id}`, {
|
const res = await fetch(`/api/player/uploads/reviews/${id}`, {
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify(this.uploadReviewPayload()),
|
|
||||||
});
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (!res.ok) throw new Error(data.error || 'Failed to save review');
|
if (!res.ok) throw new Error(data.error || 'Failed to delete review');
|
||||||
this.uploadPending = this.uploadPending.map(item => item.id === id ? data : item);
|
this.applyUploadPage(data);
|
||||||
this._setMessage('Pending metadata saved');
|
this.cancelUploadReviewEdit();
|
||||||
|
this._setMessage('Review deleted');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._setMessage(err.message || String(err), true);
|
this._setMessage(err.message || String(err), true);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+98
-40
@@ -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)" x-text="$store.library.popularityLabel(track)"></span>
|
||||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||||
</button>
|
</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 }}">
|
<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>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
<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 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
<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"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
<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>
|
||||||
<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>
|
<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>
|
</button>
|
||||||
</div>
|
</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)" x-text="$store.library.popularityLabel(track)"></span>
|
||||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||||
</button>
|
</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 }}">
|
<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>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
<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 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
<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"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
<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>
|
||||||
<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>
|
<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>
|
</button>
|
||||||
</div>
|
</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)" x-text="$store.library.popularityLabel(track)"></span>
|
||||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||||
</button>
|
</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 }}">
|
<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>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
<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 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
<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"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
<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>
|
||||||
<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>
|
<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>
|
</button>
|
||||||
</div>
|
</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)" x-text="$store.library.popularityLabel(track)"></span>
|
||||||
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
<span x-show="!$store.library.hasPopularity(track)" class="info-letter">i</span>
|
||||||
</button>
|
</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 }}">
|
<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>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addNextInQueue([track])" title="{{ t.player_play_next }}">
|
<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 6h14M5 12h8M5 18h14"/><path d="M17 10l4 3-4 3" fill="currentColor" stroke="none"/></svg>
|
<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>
|
||||||
<button class="track-action-btn" @click.stop="$store.queue.addToEnd([track])" title="{{ t.player_add_to_queue }}">
|
<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"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
<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>
|
||||||
<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>
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -904,7 +892,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template x-for="(track, idx) in $store.queue.tracks" :key="idx + '-' + track.id">
|
<template x-for="(track, idx) in $store.queue.tracks" :key="idx + '-' + track.id">
|
||||||
<div class="queue-track"
|
<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)"
|
@click="$store.queue.playFromIndex(idx)"
|
||||||
draggable="true"
|
draggable="true"
|
||||||
@dragstart="$store.queue._dragIdx = idx; $event.dataTransfer.effectAllowed = 'move'"
|
@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')"
|
@dragover.prevent="$event.dataTransfer.dropEffect = 'move'; $event.currentTarget.classList.add('drag-over')"
|
||||||
@dragleave="$event.currentTarget.classList.remove('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; }">
|
@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>
|
<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>
|
||||||
<div class="queue-track-cover">
|
<div class="queue-track-cover">
|
||||||
@@ -955,11 +948,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Player Bar -->
|
<!-- 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">
|
<div class="player-now-playing">
|
||||||
<template x-if="$store.player.currentTrack">
|
<template x-if="$store.player.currentTrack">
|
||||||
<div style="display:flex;align-items:center;gap:12px;overflow:hidden">
|
<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">
|
<template x-if="$store.player.currentTrack.cover_url">
|
||||||
<img :src="$store.player.currentTrack.cover_url" :alt="$store.player.currentTrack.title">
|
<img :src="$store.player.currentTrack.cover_url" :alt="$store.player.currentTrack.title">
|
||||||
</template>
|
</template>
|
||||||
@@ -989,6 +992,9 @@
|
|||||||
<span class="player-release-year" x-text="' · ' + $store.player.currentTrack.release_year"></span>
|
<span class="player-release-year" x-text="' · ' + $store.player.currentTrack.release_year"></span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1029,6 +1035,8 @@
|
|||||||
<div class="progress-bar-thumb"></div>
|
<div class="progress-bar-thumb"></div>
|
||||||
</div>
|
</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>
|
<span class="player-time" x-text="formatTime($store.player.duration)"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="player-version-chip">v{{ t.app_version() }}</div>
|
<div class="player-version-chip">v{{ t.app_version() }}</div>
|
||||||
@@ -1050,7 +1058,7 @@
|
|||||||
<div class="volume-slider"
|
<div class="volume-slider"
|
||||||
@pointerdown.prevent="$store.player.startVolumeDrag($event)"
|
@pointerdown.prevent="$store.player.startVolumeDrag($event)"
|
||||||
aria-label="{{ t.player_volume }}">
|
aria-label="{{ t.player_volume }}">
|
||||||
<div class="volume-slider-fill" :style="'width:' + ($store.player.volume * 100) + '%'">
|
<div class="volume-slider-fill" :style="'width:' + $store.player.volumeSliderPercent() + '%'">
|
||||||
<div class="volume-slider-thumb"></div>
|
<div class="volume-slider-thumb"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1069,6 +1077,13 @@
|
|||||||
<path d="M8 20h8"/>
|
<path d="M8 20h8"/>
|
||||||
<path d="M12 16v4"/>
|
<path d="M12 16v4"/>
|
||||||
</svg>
|
</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>
|
</button>
|
||||||
<div class="device-popover" x-show="$store.devices.open" x-transition x-cloak>
|
<div class="device-popover" x-show="$store.devices.open" x-transition x-cloak>
|
||||||
<template x-for="device in $store.devices.devices" :key="device.id">
|
<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">
|
<template x-for="jam in $store.devices.jams" :key="jam.id">
|
||||||
<button class="device-row jam-row"
|
<button class="device-row jam-row"
|
||||||
:class="{ active: jam.is_active, pending: jam.is_pending }"
|
:class="{ active: jam.is_active, pending: jam.is_pending }"
|
||||||
@click="$store.devices.selectJam(jam)">
|
@click="$store.devices.handleJamRowClick(jam)">
|
||||||
<span class="device-row-icon">
|
<span class="device-row-icon">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<circle cx="8" cy="8" r="3"/>
|
<circle cx="8" cy="8" r="3"/>
|
||||||
@@ -1128,7 +1143,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</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">
|
<span class="device-row-icon">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<path d="M12 5v14"/>
|
<path d="M12 5v14"/>
|
||||||
@@ -1141,6 +1156,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="jam-create-panel" x-show="$store.devices.jamPanelOpen" x-transition x-cloak>
|
<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">
|
<div class="jam-selected-users" x-show="$store.devices.jamSelectedUsers.length > 0">
|
||||||
<template x-for="user in $store.devices.jamSelectedUsers" :key="user.id">
|
<template x-for="user in $store.devices.jamSelectedUsers" :key="user.id">
|
||||||
<button class="jam-user-chip" @click="$store.devices.removeJamInvitee(user.id)">
|
<button class="jam-user-chip" @click="$store.devices.removeJamInvitee(user.id)">
|
||||||
@@ -1162,9 +1178,51 @@
|
|||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</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>
|
</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>
|
</div>
|
||||||
|
|||||||
+706
-47
@@ -687,7 +687,7 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
.track-list-header {
|
.track-list-header {
|
||||||
display: grid;
|
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;
|
padding: 8px 16px;
|
||||||
border-bottom: 1px solid var(--border-color);
|
border-bottom: 1px solid var(--border-color);
|
||||||
color: var(--text-subdued);
|
color: var(--text-subdued);
|
||||||
@@ -699,7 +699,7 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
.track-row {
|
.track-row {
|
||||||
display: grid;
|
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;
|
padding: 8px 16px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
@@ -736,14 +736,18 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.track-album { font-size: 13px; color: var(--text-subdued); }
|
.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 action buttons */
|
||||||
.track-actions {
|
.track-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
min-width: 0;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-action-btn {
|
.track-action-btn {
|
||||||
@@ -759,9 +763,22 @@ button.user-stat:hover {
|
|||||||
transition: color 0.15s, background 0.15s;
|
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:hover { color: var(--text-primary); background: var(--bg-active); }
|
||||||
.track-action-btn.play-btn:hover { color: var(--accent); }
|
.track-action-btn.play-btn:hover { color: var(--accent); }
|
||||||
.track-action-btn svg { width: 16px; height: 16px; }
|
.track-action-btn svg { width: 16px; height: 16px; }
|
||||||
|
.track-action-btn.queue-insert-btn svg { width: 17px; height: 17px; }
|
||||||
|
|
||||||
.info-btn {
|
.info-btn {
|
||||||
color: var(--text-subdued);
|
color: var(--text-subdued);
|
||||||
@@ -1003,6 +1020,15 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
.queue-track:hover { background: var(--bg-hover); }
|
.queue-track:hover { background: var(--bg-hover); }
|
||||||
.queue-track.active { background: var(--bg-active); }
|
.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 {
|
.queue-track-cover {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
@@ -1084,6 +1110,8 @@ button.user-stat:hover {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
touch-action: none;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queue-drag-handle:active { cursor: grabbing; }
|
.queue-drag-handle:active { cursor: grabbing; }
|
||||||
@@ -1167,6 +1195,27 @@ button.user-stat:hover {
|
|||||||
text-overflow: ellipsis;
|
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 {
|
.player-controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
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-time { font-size: 11px; color: var(--text-subdued); min-width: 40px; text-align: center; }
|
||||||
|
|
||||||
|
.player-progress-strip-times {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
@@ -1287,7 +1340,7 @@ button.user-stat:hover {
|
|||||||
.volume-btn svg { width: 18px; height: 18px; }
|
.volume-btn svg { width: 18px; height: 18px; }
|
||||||
|
|
||||||
.volume-slider {
|
.volume-slider {
|
||||||
width: 80px;
|
width: 104px;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
background: var(--bg-active);
|
background: var(--bg-active);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@@ -1336,6 +1389,28 @@ button.user-stat:hover {
|
|||||||
.queue-toggle-btn.active { color: var(--accent); }
|
.queue-toggle-btn.active { color: var(--accent); }
|
||||||
.queue-toggle-btn svg { width: 18px; height: 18px; }
|
.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 {
|
.device-picker {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1484,6 +1559,13 @@ button.user-stat:hover {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jam-panel-title {
|
||||||
|
margin-bottom: 7px;
|
||||||
|
color: #c9dcff;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
.jam-selected-users {
|
.jam-selected-users {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -1547,9 +1629,8 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.jam-create-btn {
|
.jam-create-btn {
|
||||||
width: 100%;
|
flex: 1;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin-top: 8px;
|
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: rgba(82,145,255,0.14);
|
background: rgba(82,145,255,0.14);
|
||||||
@@ -1559,6 +1640,33 @@ button.user-stat:hover {
|
|||||||
cursor: pointer;
|
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 */
|
||||||
.loading-spinner {
|
.loading-spinner {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -2920,13 +3028,13 @@ button.user-stat:hover {
|
|||||||
z-index: 140;
|
z-index: 140;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-end;
|
justify-content: center;
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
background: rgba(0,0,0,0.32);
|
background: rgba(0,0,0,0.32);
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-editor-drawer {
|
.upload-editor-drawer {
|
||||||
width: min(460px, calc(100vw - 48px));
|
width: min(680px, calc(100vw - 48px));
|
||||||
max-height: calc(100vh - 80px);
|
max-height: calc(100vh - 80px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
@@ -3052,7 +3160,7 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
.upload-tree-track {
|
.upload-tree-track {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 24px 30px minmax(0, 1fr) auto;
|
grid-template-columns: 24px minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
min-height: 44px;
|
min-height: 44px;
|
||||||
@@ -3151,7 +3259,7 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
.upload-track-display {
|
.upload-track-display {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 34px minmax(0, 1fr) auto;
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
@@ -3409,6 +3517,11 @@ button.user-stat:hover {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-player-collapse-btn,
|
||||||
|
.mobile-expanded-queue {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.playlist-action-btn {
|
.playlist-action-btn {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
@@ -3463,7 +3576,7 @@ button.user-stat:hover {
|
|||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
:root {
|
:root {
|
||||||
--player-height: 118px;
|
--player-height: 168px;
|
||||||
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3597,54 +3710,175 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.player-bar {
|
.player-bar {
|
||||||
grid-template-columns: minmax(0, 1fr) auto;
|
position: relative;
|
||||||
grid-template-rows: auto auto;
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
gap: 8px 12px;
|
grid-template-rows: 62px 58px;
|
||||||
|
grid-template-areas:
|
||||||
|
"now now"
|
||||||
|
"buttons actions";
|
||||||
|
gap: 4px 10px;
|
||||||
align-items: center;
|
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 {
|
.player-now-playing {
|
||||||
grid-column: 1;
|
grid-area: now;
|
||||||
grid-row: 1;
|
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 {
|
.player-cover {
|
||||||
width: 44px;
|
width: 52px;
|
||||||
height: 44px;
|
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 {
|
.player-controls {
|
||||||
grid-column: 1 / -1;
|
display: contents;
|
||||||
grid-row: 2;
|
|
||||||
gap: 6px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-buttons {
|
.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 {
|
.player-btn {
|
||||||
min-width: 32px;
|
min-width: 42px;
|
||||||
min-height: 32px;
|
min-height: 42px;
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-btn svg {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-btn-play {
|
.player-btn-play {
|
||||||
width: 38px;
|
width: 56px;
|
||||||
height: 38px;
|
height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-btn-play svg {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-timeline {
|
.player-timeline {
|
||||||
max-width: none;
|
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 {
|
.player-version-chip {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
bottom: calc(12px + var(--safe-bottom));
|
||||||
|
width: auto;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
|
margin-top: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
opacity: 0.62;
|
font-size: 8px;
|
||||||
font-size: 9px;
|
line-height: 1;
|
||||||
|
opacity: 0.58;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-time {
|
.player-time {
|
||||||
@@ -3653,17 +3887,35 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.player-right {
|
.player-right {
|
||||||
grid-column: 2;
|
grid-area: actions;
|
||||||
grid-row: 1;
|
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 {
|
.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 {
|
.volume-slider {
|
||||||
width: 74px;
|
display: block;
|
||||||
height: 6px;
|
width: 100%;
|
||||||
|
height: 9px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3672,18 +3924,373 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.volume-slider-thumb {
|
.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;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.queue-toggle-btn {
|
.queue-toggle-btn {
|
||||||
min-width: 36px;
|
min-width: 36px;
|
||||||
min-height: 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) {
|
@media (max-width: 560px) {
|
||||||
:root {
|
:root {
|
||||||
--player-height: 132px;
|
--player-height: 170px;
|
||||||
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
--player-bar-space: calc(var(--player-height) + var(--safe-bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3960,7 +4567,7 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.upload-tree-track {
|
.upload-tree-track {
|
||||||
grid-template-columns: 24px 30px minmax(0, 1fr);
|
grid-template-columns: 24px minmax(0, 1fr);
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3976,7 +4583,7 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.upload-track-display {
|
.upload-track-display {
|
||||||
grid-template-columns: 32px minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
.upload-track-actions {
|
.upload-track-actions {
|
||||||
@@ -4121,11 +4728,24 @@ button.user-stat:hover {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
grid-template-rows: 60px 58px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-track-title { font-size: 12px; }
|
.player-track-title { font-size: 12px; }
|
||||||
.player-track-artist { font-size: 10px; }
|
.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 {
|
.player-version-chip {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@@ -4138,26 +4758,65 @@ button.user-stat:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.volume-btn {
|
.volume-btn {
|
||||||
|
min-width: 24px;
|
||||||
|
min-height: 34px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-toggle-btn {
|
||||||
|
min-width: 34px;
|
||||||
|
min-height: 34px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.volume-slider {
|
.volume-slider {
|
||||||
width: 58px;
|
display: block;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-btn {
|
.player-btn {
|
||||||
min-width: 30px;
|
min-width: 42px;
|
||||||
min-height: 30px;
|
min-height: 42px;
|
||||||
|
padding: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-btn svg {
|
.player-btn svg {
|
||||||
width: 17px;
|
width: 22px;
|
||||||
height: 17px;
|
height: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.player-btn-play {
|
.player-btn-play {
|
||||||
width: 36px;
|
width: 56px;
|
||||||
height: 36px;
|
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