This commit is contained in:
Ondrej Zara 2020-03-10 15:25:43 +01:00
parent 479cb3fd3c
commit 0b008659c7
No known key found for this signature in database
GPG key ID: B0A5751E616840C5
11 changed files with 58 additions and 75 deletions

View file

@ -39,6 +39,7 @@ button {
.flex-row; .flex-row;
display: inline-flex; display: inline-flex;
flex-shrink: 0;
background-color: transparent; background-color: transparent;
padding: 0; padding: 0;

View file

@ -2,13 +2,15 @@ cyp-app {
.flex-column; .flex-column;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto;
max-width: 800px;
height: 100vh;
font-family: lato, sans-serif; font-family: lato, sans-serif;
line-height: 1.25; line-height: 1.25;
background-color: var(--bg); background-color: var(--bg);
color: var(--fg); color: var(--fg);
text-shadow: var(--text-shadow); text-shadow: var(--text-shadow);
max-width: 800px;
margin: 0 auto; white-space: nowrap;
overflow: hidden;
height: 100vh;
} }

View file

@ -18,8 +18,8 @@ cyp-menu, cyp-commands {
cyp-menu button { cyp-menu button {
flex: 1 0 0; flex: 1 0 0;
border-top: 4px solid transparent; border-top: var(--border-width) solid transparent;
border-bottom: 4px solid transparent; border-bottom: var(--border-width) solid transparent;
.icon { .icon {
margin-right: var(--icon-spacing); margin-right: var(--icon-spacing);

View file

@ -34,7 +34,7 @@ cyp-player {
margin: 0; margin: 0;
} }
.title, .subtitle { .no-wrap; } .title, .subtitle { .ellipsis; }
} }
.timeline { .timeline {

View file

@ -16,6 +16,6 @@ cyp-song {
margin: 0; margin: 0;
} }
// h2, div { .long-line; } FIXME vyresit zalamovani/vypustku h2, div { .ellipsis; } // FIXME vyresit zalamovani/vypustku
} }
} }

View file

@ -1,6 +1,6 @@
.icon { .icon {
width: 24px; width: 24px;
flex-shrink: 0; // flex-shrink: 0;
path, polygon, circle { path, polygon, circle {
&:not([fill]) { &:not([fill]) {

View file

@ -9,8 +9,7 @@
flex-direction: column; flex-direction: column;
} }
.no-wrap { .ellipsis {
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -24,7 +23,7 @@
*/ */
.selectable { .selectable {
border-left: 4px solid transparent; border-left: var(--border-width) solid transparent;
cursor: pointer; cursor: pointer;
&.selected { &.selected {
@ -35,9 +34,12 @@
.item { .item {
.flex-row; .flex-row;
.selectable; .selectable;
padding: 8px 4px; padding: 8px;
padding-left: calc(8px - var(--border-width));
&:nth-child(odd) { // FIXME nutno poresit lepe s ohledem na search &:nth-child(odd) { // FIXME nutno poresit lepe s ohledem na search
background-color: var(--bg-alt); background-color: var(--bg-alt);
} }
button .icon { width: 32px; }
} }

View file

@ -6,6 +6,7 @@ cyp-app {
--primary: rgb(var(--primary-raw)); --primary: rgb(var(--primary-raw));
--spacing: 8px; --spacing: 8px;
--box-shadow: 0 0 3px #000; --box-shadow: 0 0 3px #000;
--border-width: 4px;
} }
.light() { .light() {

View file

@ -41,6 +41,7 @@ button {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
display: inline-flex; display: inline-flex;
flex-shrink: 0;
background-color: transparent; background-color: transparent;
padding: 0; padding: 0;
border: none; border: none;
@ -75,7 +76,6 @@ select {
} }
.icon { .icon {
width: 24px; width: 24px;
flex-shrink: 0;
} }
.icon path:not([fill]), .icon path:not([fill]),
.icon polygon:not([fill]), .icon polygon:not([fill]),
@ -95,8 +95,7 @@ select {
.flex-column:not([hidden]) { .flex-column:not([hidden]) {
display: flex; display: flex;
} }
.no-wrap { .ellipsis {
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -108,7 +107,7 @@ select {
} }
*/ */
.selectable { .selectable {
border-left: 4px solid transparent; border-left: var(--border-width) solid transparent;
cursor: pointer; cursor: pointer;
} }
.selectable.selected { .selectable.selected {
@ -117,9 +116,10 @@ select {
.item { .item {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-left: 4px solid transparent; border-left: var(--border-width) solid transparent;
cursor: pointer; cursor: pointer;
padding: 8px 4px; padding: 8px;
padding-left: calc(8px - var(--border-width));
} }
.item:not([hidden]) { .item:not([hidden]) {
display: flex; display: flex;
@ -130,6 +130,9 @@ select {
.item:nth-child(odd) { .item:nth-child(odd) {
background-color: var(--bg-alt); background-color: var(--bg-alt);
} }
.item button .icon {
width: 32px;
}
.component header { .component header {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
@ -376,6 +379,7 @@ cyp-app {
--primary: rgb(var(--primary-raw)); --primary: rgb(var(--primary-raw));
--spacing: 8px; --spacing: 8px;
--box-shadow: 0 0 3px #000; --box-shadow: 0 0 3px #000;
--border-width: 4px;
} }
cyp-app[theme=light] { cyp-app[theme=light] {
--fg: #333; --fg: #333;
@ -422,15 +426,15 @@ cyp-app[color=limegreen] {
cyp-app { cyp-app {
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
margin: 0 auto;
max-width: 800px;
height: 100vh;
font-family: lato, sans-serif; font-family: lato, sans-serif;
line-height: 1.25; line-height: 1.25;
background-color: var(--bg); background-color: var(--bg);
color: var(--fg); color: var(--fg);
text-shadow: var(--text-shadow); text-shadow: var(--text-shadow);
max-width: 800px; white-space: nowrap;
margin: 0 auto;
overflow: hidden;
height: 100vh;
} }
cyp-app:not([hidden]) { cyp-app:not([hidden]) {
display: flex; display: flex;
@ -468,8 +472,8 @@ cyp-commands button:not([hidden]) {
} }
cyp-menu button { cyp-menu button {
flex: 1 0 0; flex: 1 0 0;
border-top: 4px solid transparent; border-top: var(--border-width) solid transparent;
border-bottom: 4px solid transparent; border-bottom: var(--border-width) solid transparent;
} }
cyp-menu button .icon { cyp-menu button .icon {
margin-right: var(--icon-spacing); margin-right: var(--icon-spacing);
@ -501,9 +505,10 @@ cyp-commands button.last {
cyp-song { cyp-song {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-left: 4px solid transparent; border-left: var(--border-width) solid transparent;
cursor: pointer; cursor: pointer;
padding: 8px 4px; padding: 8px;
padding-left: calc(8px - var(--border-width));
} }
cyp-song:not([hidden]) { cyp-song:not([hidden]) {
display: flex; display: flex;
@ -514,6 +519,9 @@ cyp-song.selected {
cyp-song:nth-child(odd) { cyp-song:nth-child(odd) {
background-color: var(--bg-alt); background-color: var(--bg-alt);
} }
cyp-song button .icon {
width: 32px;
}
cyp-song .info { cyp-song .info {
flex-grow: 1; flex-grow: 1;
overflow: hidden; overflow: hidden;
@ -527,6 +535,11 @@ cyp-song .info h2 {
font-size: var(--font-size-large); font-size: var(--font-size-large);
margin: 0; margin: 0;
} }
cyp-song .info h2,
cyp-song .info div {
overflow: hidden;
text-overflow: ellipsis;
}
cyp-player { cyp-player {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
@ -574,7 +587,6 @@ cyp-player .info h2 {
} }
cyp-player .info .title, cyp-player .info .title,
cyp-player .info .subtitle { cyp-player .info .subtitle {
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -826,9 +838,10 @@ x-range:not([disabled]) .-thumb:hover {
cyp-playlist { cyp-playlist {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
border-left: 4px solid transparent; border-left: var(--border-width) solid transparent;
cursor: pointer; cursor: pointer;
padding: 8px 4px; padding: 8px;
padding-left: calc(8px - var(--border-width));
} }
cyp-playlist:not([hidden]) { cyp-playlist:not([hidden]) {
display: flex; display: flex;
@ -839,6 +852,9 @@ cyp-playlist.selected {
cyp-playlist:nth-child(odd) { cyp-playlist:nth-child(odd) {
background-color: var(--bg-alt); background-color: var(--bg-alt);
} }
cyp-playlist button .icon {
width: 32px;
}
cyp-playlist:nth-child(odd) { cyp-playlist:nth-child(odd) {
background-color: var(--bg-alt); background-color: var(--bg-alt);
} }

View file

@ -16,9 +16,10 @@ export default class Song extends Item {
html.node("h2", {}, lines.shift(), info); html.node("h2", {}, lines.shift(), info);
lines.length && html.node("div", {}, lines.shift(), info); lines.length && html.node("div", {}, lines.shift(), info);
/* html.button({icon:"play"}, "", this).addEventListener("click", async e => {
playButton(TYPE_ID, id, node); e.stopPropagation(); // do not select
*/ await this._mpd.command(`playid ${this.data["Id"]}`);
});
} }
} }

View file

@ -90,32 +90,6 @@ function playButton(type, what, parent) {
return button; return button;
} }
function deleteButton(type, id, parent) {
let title;
switch (type) {
case TYPE_ID: title = "Delete from queue"; break;
case TYPE_PLAYLIST: title = "Delete playlist"; break;
}
let button = html.button({icon:"close", title}, "", parent);
button.addEventListener("click", async e => {
switch (type) {
case TYPE_ID:
await mpd.command(`deleteid ${id}`);
pubsub.publish("queue-change");
return;
case TYPE_PLAYLIST:
let ok = confirm(`Really delete playlist '${id}'?`);
if (!ok) { return; }
await mpd.command(`rm "${mpd.escape(id)}"`);
pubsub.publish("playlists-change");
return;
}
});
return button;
}
function addButton(type, what, parent) { function addButton(type, what, parent) {
let button = html.button({icon:"plus", title:"Add to queue"}, "", parent); let button = html.button({icon:"plus", title:"Add to queue"}, "", parent);
button.addEventListener("click", async e => { button.addEventListener("click", async e => {
@ -177,17 +151,3 @@ export function group(ctx, label, urlOrFilter, parent) {
return node; return node;
} }
export function playlist(name, parent) {
let node = html.node("li", {}, "", parent);
let info = html.node("span", {className:"info"}, "", node);
html.icon("playlist-music", info)
html.node("h2", {}, name, info);
playButton(TYPE_PLAYLIST, name, node);
addButton(TYPE_PLAYLIST, name, node);
deleteButton(TYPE_PLAYLIST, name, node);
return node;
}