empede/templates/index.html

205 lines
5.4 KiB
HTML
Raw Normal View History

2023-04-25 01:26:27 +00:00
{# Template #}
<!DOCTYPE html>
<html>
<head>
<title>Empede</title>
<script src="https://unpkg.com/htmx.org@1.9.0" integrity="sha384-aOxz9UdWG0yBiyrTwPeMibmaoq07/d3a96GCbb9x60f3mOt5zwkjdbcHFnKH8qls" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
2023-04-25 01:26:27 +00:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,1,0" />
2023-04-25 02:15:01 +00:00
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABqklEQVRoQ+2XOy8FURSF720oJRK3U3lfohYahULjF6CU3Erjf0hoJH6BUqeWeIRGId5RoVMpaH1bLpkIkz17ztw5wz7JSiaZvfesddY+j6nXKj7qFedfcwFlO+gO/AcHbhE5pBR6R9ywMvYjrBMt5ALSHHEHFP3qLVR2C90kdpZTnt9SCD3wblnh6ldIp9fACF+Wlgo2XIBiKpOL2B34PmHeQt5Cihko+xzwRewO5GxTbyFvob/cQnKSL4J50ATjoAucgE2wA64S12n5YZcf92Ajz1WiBxa7YDaFzTXvGqC3HRONgG4Iyc/JZMapjEbANsRXMpKX8Ciu0xMQOTeQl5QoHNiAyKpRQBQOHEN+qsoCLiAvW6ZlDJJ0b0n8LceyjR5QbMZIQrbeF2Puj2kWAVtUahlIPJLTb8hLTbEIkFN3z0BknZw1Q15wAVLwEExnICNtMwCeM+SoQi0OSOE+sA/GFF95JWYOyO4VfFgFCBHNXeiJuAVwFpx5u2AeAZ+clniQdSE30VEgpC/BEZAbqThQ2AghoDBymsIuQDNLRca4A0XOrqZ25R14B64XVDFuhNlbAAAAAElFTkSuQmCC" rel="icon" type="image/png">
2023-04-25 01:26:27 +00:00
<style>
body {
font-family: sans;
background-color: #112;
color: #fff;
2023-04-25 14:32:51 +00:00
display: flex;
margin: 0;
}
body > div {
padding: 1rem;
}
.browser {
flex: 1;
2023-04-25 01:26:27 +00:00
}
a {
color: #fff;
font-weight: bold;
text-decoration: none;
}
ul {
list-style: none;
padding: 0;
2023-04-25 14:32:51 +00:00
margin: 0;
}
ul.queue {
margin-top: 1.0rem;
2023-04-25 01:26:27 +00:00
}
ul.queue li {
2023-04-25 14:32:51 +00:00
padding: 1.0rem 0.75rem;
border-radius: .25rem;
2023-04-25 01:26:27 +00:00
}
2023-04-25 14:32:51 +00:00
2023-04-25 01:26:27 +00:00
ul.queue li.playing {
2023-04-25 14:32:51 +00:00
background-color: #334;
2023-04-25 01:26:27 +00:00
font-weight: bold;
}
ul.breadcrumb {
display: flex;
margin-bottom: 1rem;
flex-wrap: wrap;
list-style: none;
background-color: #334;
border-radius: .25rem;
padding: .75rem 1rem;
}
ul.breadcrumb li:not(:first-child)::before {
display: inline-block;
padding-left: .5rem;
2023-04-25 02:03:33 +00:00
padding-right: .1rem;
2023-04-25 01:26:27 +00:00
color: #6c757d;
content: "/";
}
ul.dir li {
cursor: pointer;
padding: .75rem .75rem;
border-radius: 3px;
display: flex;
align-items: center;
}
2023-04-25 14:32:51 +00:00
ul.dir li img {
width: 48px;
height: 48px;
object-fit: contain;
}
2023-04-25 01:26:27 +00:00
ul.dir li:hover {
background-color: #334;
}
ul.dir li .material-symbols-outlined {
margin-right: 0.75rem;
width: 24px;
}
2023-04-25 14:32:51 +00:00
.song__name {
2023-04-25 01:26:27 +00:00
font-weight: bold;
}
2023-04-25 14:32:51 +00:00
.player {
width: 25rem;
}
.player .nowplaying {
2023-04-25 16:59:37 +00:00
display: flex;
2023-04-25 14:32:51 +00:00
flex-flow: column;
background-color: #334;
border-radius: 0.25rem;
2023-04-25 16:59:37 +00:00
height: 9.5rem;
2023-04-25 14:32:51 +00:00
}
.player .controls {
display: flex;
justify-content: space-around;
padding: 0.5rem;
}
.player .control {
2023-04-25 01:26:27 +00:00
font-size: 40px;
cursor: pointer;
}
2023-04-25 14:32:51 +00:00
.player .current {
display: flex;
flex-flow: row;
align-items: center;
padding: 0.5rem;
2023-04-25 16:59:37 +00:00
flex: 1;
2023-04-25 14:32:51 +00:00
}
.player .albumart {
width: 80px;
height: 80px;
object-fit: contain;
display: block;
margin-right: 1.0rem;
border-radius: 0.25rem;
}
.player .metadata {
flex: 1;
}
2023-04-25 16:59:37 +00:00
.player .idle {
font-weight: bold;
text-align: center;
}
2023-04-25 01:26:27 +00:00
</style>
</head>
<body>
2023-04-25 14:32:51 +00:00
<div class="browser">
<ul class="breadcrumb">
<li><a href="?path=">Root</a></li>
{% for (i, component) in path.iter().enumerate() %}
<li>
{% if i == path.len() - 1 %}
2023-04-25 01:26:27 +00:00
{{ component }}
2023-04-25 14:32:51 +00:00
{% else %}
<a href="?path={{ path[..i + 1].join("/") }}">
{{ component }}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
<ul class="dir">
{% for entry in entries %}
{% match entry %}
{% when mpd::Entry::Song with { name, path, artist } %}
<li hx-post="/queue?path={{path}}" hx-swap="none" role="button" >
<span class="material-symbols-outlined">music_note</span>
<!-- img src="/art?path={{path}}" -->
<div class="song">
<div class="song__name">{{ name }}</div>
<div class="song__artist">{{ artist }}</div>
</a>
</li>
{% when mpd::Entry::Directory with { name, path }%}
<li onclick="window.location = '?path={{path}}'">
<span class="material-symbols-outlined">folder</span>
<a href="?path={{path}}">{{ name }}</a>
</li>
{% when mpd::Entry::Playlist with { name, path } %}
<li hx-post="/queue?path={{path}}" hx-swap="none" role="button" >
<span class="material-symbols-outlined">playlist_play</span>
<div class="song">
<div class="song__name">{{ name }}</div>
</a>
</li>
{% endmatch %}
{% endfor %}
</ul>
</div>
<div class="player" hx-ext="sse" sse-connect="/sse">
2023-04-25 16:58:34 +00:00
<div hx-trigger="sse:player" hx-get="/player"></div>
<div hx-trigger="sse:playlist,sse:player" hx-get="/queue"></div>
2023-04-25 14:32:51 +00:00
</div>
2023-04-25 01:26:27 +00:00
</body>
</html>