Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions client/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,22 @@ describe('App search', () => {
);
});

it('renders aria-hidden skeleton cards while loading and replaces them with results', async () => {
const { container } = renderApp([mockSearch('', [album])]);
const region = screen.getByRole('region', { name: 'Browse albums' });
expect(region).toHaveAttribute('aria-busy', 'true');
expect(resultStatus()).toHaveTextContent('Loading albums…');
const skeletonGrid = container.querySelector('.album-grid--loading');
expect(skeletonGrid).toBeInTheDocument();
expect(skeletonGrid).toHaveAttribute('aria-hidden', 'true');
expect(skeletonGrid?.querySelectorAll('.album-skeleton')).toHaveLength(8);
expect(screen.queryByRole('article')).not.toBeInTheDocument();

await screen.findByRole('article', { name: 'Abbey Road' });
expect(container.querySelector('.album-grid--loading')).not.toBeInTheDocument();
expect(region).toHaveAttribute('aria-busy', 'false');
});

it('replaces results for a new query rather than retaining the previous search', async () => {
renderApp([mockSearch('Abbey'), mockSearch('missing', [])]);
submitSearch('Abbey');
Expand Down
76 changes: 76 additions & 0 deletions client/src/components/ResultsLayout.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,82 @@
.album-grid > li {
min-width: 0;
}
.album-skeleton {
height: 100%;
display: flex;
flex-direction: column;
}
@container album-grid (width < 37.375rem) {
.album-skeleton {
max-width: 26rem;
margin-inline: auto;
}
}
.album-skeleton__cover,
.album-skeleton__line,
.album-skeleton__pill {
background: var(--surface-raised);
animation: album-skeleton-pulse 1.5s ease-in-out infinite;
}
.album-skeleton__cover {
aspect-ratio: 1;
border: 1px solid var(--border);
border-radius: 3px;
}
.album-skeleton__info {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 1.125rem 1rem 1rem;
}
.album-skeleton__line {
border-radius: 4px;
}
.album-skeleton__line--meta {
height: 0.85rem;
width: 45%;
}
.album-skeleton__line--title {
height: 1.4rem;
width: 82%;
}
.album-skeleton__line--artist {
height: 0.95rem;
width: 60%;
}
.album-skeleton__footer {
display: flex;
justify-content: space-between;
align-items: center;
gap: 0.75rem;
margin-top: auto;
padding-top: 1rem;
}
.album-skeleton__pill {
height: 1.75rem;
width: 4.5rem;
border-radius: 100px;
}
.album-skeleton__pill--short {
width: 5.5rem;
}
@keyframes album-skeleton-pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.55;
}
}
@media (prefers-reduced-motion: reduce) {
.album-skeleton__cover,
.album-skeleton__line,
.album-skeleton__pill {
animation: none;
}
}
.empty-state {
text-align: center;
padding: 3rem 1rem;
Expand Down
23 changes: 22 additions & 1 deletion client/src/components/ResultsLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ interface Props {
onReset: () => void;
}

const SKELETON_CARD_COUNT = 8;

export default function ResultsLayout(props: Props) {
const sentinel = useRef<HTMLDivElement>(null);
const {
Expand Down Expand Up @@ -129,7 +131,26 @@ export default function ResultsLayout(props: Props) {
{props.hasQuery ? 'Retry search' : 'Retry albums'}
</button>
</div>
) : props.loading ? null : props.totalCount === 0 ? (
) : props.loading ? (
<ul className="album-grid album-grid--loading" aria-hidden="true">
{Array.from({ length: SKELETON_CARD_COUNT }, (_, index) => (
<li key={index}>
<div className="album-skeleton">
<div className="album-skeleton__cover" />
<div className="album-skeleton__info">
<div className="album-skeleton__line album-skeleton__line--meta" />
<div className="album-skeleton__line album-skeleton__line--title" />
<div className="album-skeleton__line album-skeleton__line--artist" />
<div className="album-skeleton__footer">
<div className="album-skeleton__pill" />
<div className="album-skeleton__pill album-skeleton__pill--short" />
</div>
</div>
</div>
</li>
))}
</ul>
) : props.totalCount === 0 ? (
<div className="empty-state">
<h3>No albums found</h3>
<p>
Expand Down
1 change: 1 addition & 0 deletions docs/AI-USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ the part that matters most.
| 2026-11-17 | erikhfj | Antigravity | #91, E2E search helper fix: updated `e2e/tests/search.spec.ts` to match the `Search` and `Filters` buttons with `exact: true` so `Clear recent searches` does not trigger a strict-mode violation, and cleared `E2E_USER_ID`'s recorded search history during cleanup. Verified locally with two consecutive full `pnpm test:e2e` runs against a throwaway seeded PostgreSQL stack. |
| 2026-11-20 | erikhfj | Antigravity | #100, review author privacy: removed `User.id` from `schema.graphql` and the `AlbumDetail` query, replaced `Listener <uuid-prefix>` with deterministic SHA-256 music pseudonyms in `server/src/userIdentity.ts` (including read-time sanitization of legacy labels in `Review.user`), added `User` cache merge policy, and updated schema/unit/client tests and `docs/architecture.md`. Verified with `pnpm codegen`, `pnpm format:check`, `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. |
| 2026-11-20 | erikhfj | Antigravity | #103, search history error visibility and focus: moved the search history error message and Retry button inside the open `RecentSearches` dropdown so closed-state errors cannot overlap page content, returned retry success from `useSearchHistory`, restored focus to the search input after a successful retry in `SearchForm`, and added unit/integration tests. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build`. |
| 2026-11-20 | erikhfj | Antigravity | #95, loading skeleton cards: rendered 8 `aria-hidden="true"` placeholder cards inside `.album-grid--loading` while `ResultsLayout` is loading so the layout does not collapse, styled with plain CSS and `prefers-reduced-motion` support, kept `role="status"` and `aria-busy` unchanged, and added a loading-state test in `App.test.tsx`. Verified with `pnpm format:check && pnpm lint && pnpm typecheck && pnpm test && pnpm build`. |
| 2026-11-22 | evenkkl | Claude | #96, skip count and facet queries on Load more: Claude made the search aggregates lazy `AlbumConnection` field resolvers, added a `SearchAlbumsPage` query for Load more, kept page one's count and facets in the Apollo merge, and added server and client tests. Verified with lint, typecheck, the test suites and the PostgreSQL tests on PGlite. |

## Notes
Expand Down