-
Notifications
You must be signed in to change notification settings - Fork 0
feat: #11 add album detail view #57
Merged
+645
−39
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d283a7f
feat: #11 add album detail view
robertky cd35ef9
fix: #11 support base paths and average ratings
robertky 58b2b17
fix: #11 preserve discovery state
robertky 44cfa10
fix: #11 batch review counts
robertky 9a31c26
fix: #11 preserve review cursor precision
robertky b0bf948
fix: #11 make discovery navigation consistent
robertky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import schemaSource from '../../../schema.graphql?raw'; | ||
| import { buildSchema, validate } from 'graphql'; | ||
| import { expect, it } from 'vitest'; | ||
|
|
||
| import { ALBUM_DETAIL } from './albumDetail.js'; | ||
|
|
||
| it('validates the album-detail operation against the repository schema', () => { | ||
| expect(validate(buildSchema(schemaSource), ALBUM_DETAIL)).toEqual([]); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { gql } from '@apollo/client'; | ||
| import type { TypedDocumentNode } from '@apollo/client'; | ||
|
|
||
| export type AlbumDetail = { | ||
| id: string; | ||
| title: string; | ||
| releaseYear: number | null; | ||
| artists: { id: string; name: string }[]; | ||
| genres: { id: string; name: string }[]; | ||
| tracks: { | ||
| id: string; | ||
| title: string; | ||
| trackNumber: number; | ||
| durationSeconds: number | null; | ||
| }[]; | ||
| averageRating: number | null; | ||
| reviewCount: number; | ||
| reviews: { | ||
| edges: { | ||
| cursor: string; | ||
| node: { | ||
| id: string; | ||
| rating: number; | ||
| comment: string; | ||
| createdAt: string; | ||
| user: { id: string; displayName: string }; | ||
| }; | ||
| }[]; | ||
| pageInfo: { hasNextPage: boolean; endCursor: string | null }; | ||
| totalCount: number; | ||
| }; | ||
| }; | ||
|
|
||
| type AlbumDetailData = { album: AlbumDetail | null }; | ||
| type AlbumDetailVariables = { | ||
| id: string; | ||
| reviewFirst: number; | ||
| reviewAfter?: string | null; | ||
| }; | ||
|
|
||
| export const ALBUM_DETAIL: TypedDocumentNode<AlbumDetailData, AlbumDetailVariables> = gql` | ||
| query AlbumDetail($id: ID!, $reviewFirst: Int!, $reviewAfter: String) { | ||
| album(id: $id) { | ||
| id | ||
| title | ||
| releaseYear | ||
| artists { | ||
| id | ||
| name | ||
| } | ||
| genres { | ||
| id | ||
| name | ||
| } | ||
| tracks { | ||
| id | ||
| title | ||
| trackNumber | ||
| durationSeconds | ||
| } | ||
| averageRating | ||
| reviewCount | ||
| reviews(first: $reviewFirst, after: $reviewAfter) { | ||
| edges { | ||
| cursor | ||
| node { | ||
| id | ||
| rating | ||
| comment | ||
| createdAt | ||
| user { | ||
| id | ||
| displayName | ||
| } | ||
| } | ||
| } | ||
| totalCount | ||
| pageInfo { | ||
| hasNextPage | ||
| endCursor | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| .album-detail { | ||
| padding-block: 2rem 3rem; | ||
| } | ||
| .back-link { | ||
| color: var(--accent); | ||
| font-weight: 700; | ||
| } | ||
| .album-detail__header { | ||
| border-bottom: 1px solid var(--border); | ||
| margin: 1.5rem 0; | ||
| padding-bottom: 1.5rem; | ||
| } | ||
| .album-detail__header h1 { | ||
| font-size: clamp(2rem, 4vw, 3.5rem); | ||
| letter-spacing: -0.05em; | ||
| line-height: 1.1; | ||
| margin: 0; | ||
| } | ||
| .album-detail__artists { | ||
| font-size: 1.15rem; | ||
| margin: 0.5rem 0 0; | ||
| } | ||
| .album-detail__columns { | ||
| display: grid; | ||
| gap: 2rem; | ||
| grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); | ||
| } | ||
| .album-detail h2 { | ||
| font-size: 1.25rem; | ||
| } | ||
| .tracklist, | ||
| .review-list { | ||
| margin: 1rem 0; | ||
| padding: 0; | ||
| list-style: none; | ||
| } | ||
| .tracklist { | ||
| counter-reset: tracks; | ||
| } | ||
| .tracklist li { | ||
| border-bottom: 1px solid var(--border); | ||
| counter-increment: tracks; | ||
| display: flex; | ||
| gap: 0.75rem; | ||
| justify-content: space-between; | ||
| padding: 0.65rem 0; | ||
| } | ||
| .tracklist li::before { | ||
| color: var(--muted); | ||
| content: counter(tracks); | ||
| min-width: 1.5rem; | ||
| } | ||
| .tracklist li > span:first-of-type { | ||
| flex: 1; | ||
| } | ||
| .review-list { | ||
| display: grid; | ||
| gap: 0.8rem; | ||
| } | ||
| .review-list article { | ||
| background: var(--surface); | ||
| border: 1px solid var(--border); | ||
| border-radius: 8px; | ||
| padding: 1rem; | ||
| } | ||
| .review-list header { | ||
| display: flex; | ||
| gap: 0.75rem; | ||
| justify-content: space-between; | ||
| } | ||
| .review-list header span { | ||
| color: var(--accent); | ||
| } | ||
| .review-list p { | ||
| margin-bottom: 0.5rem; | ||
| } | ||
| .review-list time { | ||
| color: var(--muted); | ||
| font-size: 0.85rem; | ||
| } | ||
| @media (max-width: 700px) { | ||
| .album-detail__columns { | ||
| grid-template-columns: 1fr; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.