feat(home): land on Home, and make it worth landing on
The app opened on Tracks — an alphabetical list of everything, which is the one entry point that is identical every time and therefore gives the user nothing to start from. Home is listed first in the nav and is the page built to answer 'what should I play' (H-8). Two things had to be true before that was an improvement. An album with no cover rendered as a small dim icon on a surface the same colour as the page, so a shelf read as having holes in it, while the Albums and Artists grids both drew a letter tile (H-9). It draws the same tile now. And a shelf that repeats the one above it is suppressed, the way an empty one already is — 'On repeat' was 'Pick up where you left off' reordered. The rule fires only when the shelf is not showing the whole library: a repeat is a fault only if a different row was possible, and measured against a fixed shelf size instead this let an 11-album library keep three identical shelves while a 13-album one lost them. The first two versions of that rule were wrong and the *existing* Go tests caught both — it collapsed a four-album library to a single shelf. Nine e2e specs assumed the app starts on Tracks and now navigate there, and one new spec freezes the landing itself. Home's page-header action is 'Shuffle suggestions': 'Shuffle' alone was two different controls with one accessible name, which only became reachable together once a cached Home was always in the tree.
This commit is contained in:
@@ -137,6 +137,28 @@ export class HomeView extends ViewLifecycleMixin(LitElement) {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* An album with no cover used to be a small dim icon on a
|
||||
surface the same colour as the page, so a shelf read as
|
||||
having holes in it (H-9) — while the Albums and Artists
|
||||
grids both drew a letter tile. This is that tile, and the
|
||||
gradient is what makes it a tile rather than a gap. */
|
||||
.art .placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--yj-bg-overlay, #404040) 0%,
|
||||
var(--yj-bg-surface, #282828) 100%
|
||||
);
|
||||
color: var(--yj-text-secondary, #b3b3b3);
|
||||
font-size: 48px;
|
||||
font-weight: 300;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.play {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
@@ -238,6 +260,11 @@ export class HomeView extends ViewLifecycleMixin(LitElement) {
|
||||
override render() {
|
||||
return html`
|
||||
<page-header heading="Home">
|
||||
<!-- "Shuffle" alone was two different controls with one
|
||||
name: this one and the transport's shuffle mode.
|
||||
They were never on screen together until the app
|
||||
started landing on Home (H-8), and a cached view is
|
||||
in the accessibility tree either way. -->
|
||||
<wa-button
|
||||
slot="actions"
|
||||
size="small"
|
||||
@@ -246,7 +273,7 @@ export class HomeView extends ViewLifecycleMixin(LitElement) {
|
||||
@click=${() => void this.load()}
|
||||
>
|
||||
<wa-icon slot="start" name="shuffle"></wa-icon>
|
||||
Shuffle
|
||||
Shuffle suggestions
|
||||
</wa-button>
|
||||
</page-header>
|
||||
<p class="lede">Somewhere to start listening.</p>
|
||||
@@ -304,8 +331,10 @@ export class HomeView extends ViewLifecycleMixin(LitElement) {
|
||||
>
|
||||
<div class="art">
|
||||
${art
|
||||
? html`<img src=${art} alt="" loading="lazy" />`
|
||||
: html`<wa-icon name="compact-disc"></wa-icon>`}
|
||||
? html`<img src=${art} alt="" loading="lazy" decoding="async" />`
|
||||
: html`<div class="placeholder" aria-hidden="true">
|
||||
${album.Name.charAt(0).toUpperCase()}
|
||||
</div>`}
|
||||
<button
|
||||
class="play"
|
||||
title="Play this album"
|
||||
|
||||
@@ -154,8 +154,11 @@ export class AppSidebar extends LitElement {
|
||||
/** Delay in ms before a drag-hover triggers navigation. */
|
||||
private static readonly HOVER_NAV_DELAY = 600;
|
||||
|
||||
/** Home, because that is where `index.ts` now navigates on startup
|
||||
* (H-8). The sidebar does not hear a `navigate` it did not send,
|
||||
* so this default is what keeps `aria-current` honest on arrival. */
|
||||
@state()
|
||||
private activeView: View = 'tracks';
|
||||
private activeView: View = 'home';
|
||||
|
||||
@state()
|
||||
private isDragging = false;
|
||||
|
||||
Reference in New Issue
Block a user