Add button to clear queue
This commit is contained in:
parent
eb834b02a8
commit
6053b098db
|
@ -94,6 +94,11 @@ async fn post_queue(req: tide::Request<()>) -> tide::Result {
|
||||||
Ok("".into())
|
Ok("".into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn delete_queue(_req: tide::Request<()>) -> tide::Result {
|
||||||
|
mpd::connect()?.clear()?;
|
||||||
|
Ok("".into())
|
||||||
|
}
|
||||||
|
|
||||||
async fn post_play(_req: tide::Request<()>) -> tide::Result {
|
async fn post_play(_req: tide::Request<()>) -> tide::Result {
|
||||||
mpd::connect()?.play()?;
|
mpd::connect()?.play()?;
|
||||||
Ok("".into())
|
Ok("".into())
|
||||||
|
@ -182,6 +187,8 @@ async fn main() -> tide::Result<()> {
|
||||||
app.at("/sse").get(tide::sse::endpoint(sse));
|
app.at("/sse").get(tide::sse::endpoint(sse));
|
||||||
|
|
||||||
app.at("/queue").post(post_queue);
|
app.at("/queue").post(post_queue);
|
||||||
|
app.at("/queue").delete(delete_queue);
|
||||||
|
|
||||||
app.at("/play").post(post_play);
|
app.at("/play").post(post_play);
|
||||||
app.at("/pause").post(post_pause);
|
app.at("/pause").post(post_pause);
|
||||||
app.at("/previous").post(post_previous);
|
app.at("/previous").post(post_previous);
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[role=button] {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
@ -38,18 +42,35 @@ ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.queue {
|
.queue-header {
|
||||||
margin-top: 1.0rem;
|
margin-top: 1.0rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.queue-next {
|
||||||
|
font-weight: bold;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.queue-clear {
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
.queue-clear .material-symbols-outlined {
|
||||||
|
margin-right: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.queue li {
|
.queue {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue li {
|
||||||
padding: 0 0.5rem;
|
padding: 0 0.5rem;
|
||||||
border-radius: .25rem;
|
border-radius: .25rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
.queue li.playing {
|
||||||
ul.queue li.playing {
|
|
||||||
background-color: #334;
|
background-color: #334;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +173,6 @@ ul.dir li .material-symbols-outlined {
|
||||||
|
|
||||||
.player .control {
|
.player .control {
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.player .current {
|
.player .current {
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
{# Template #}
|
{# Template #}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<div class="queue-header">
|
||||||
|
<div class="queue-next">Next in queue</div>
|
||||||
|
<div class="queue-clear" role="button" hx-delete="/queue">
|
||||||
|
<span class="material-symbols-outlined">playlist_remove</span>
|
||||||
|
Clear
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ul class="queue">
|
<ul class="queue">
|
||||||
{% for item in queue %}
|
{% for item in queue %}
|
||||||
<li {% if item.playing %}class="playing"{% endif %}>
|
<li {% if item.playing %}class="playing"{% endif %}>
|
||||||
|
|
Loading…
Reference in New Issue