Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow playlist images to be null #187

Merged
merged 2 commits into from
Apr 2, 2024
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
2 changes: 1 addition & 1 deletion client/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ type Playlist {
**Note**: If returned, the source URL for the image (`url`) is temporary and
will expire in less than a day.
"""
images: [Image!]!
images: [Image!]

"""
The name of the playlist.
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/LoggedInLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
> = gql`
query SidebarQuery($offset: Int, $limit: Int) {
me {
user {

Check warning on line 89 in client/src/components/LoggedInLayout.tsx

View workflow job for this annotation

GitHub Actions / ESLint

This field is marked as deprecated in your GraphQL schema (reason: Use the profile field instead which provides richer current user information.)
id
}
playlists(offset: $offset, limit: $limit)
Expand Down Expand Up @@ -176,7 +176,9 @@
pinned={false}
key={playlist.id}
playlist={playlist}
coverPhoto={<CoverPhoto image={thumbnail(playlist.images)} />}
coverPhoto={
<CoverPhoto image={thumbnail(playlist.images ?? [])} />
}
to={`/playlists/${playlist.id}`}
onMouseOverEdit={(playlist) =>
preloadPlaylistDetails({ id: playlist.id })
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/PlaylistDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const PlaylistDetails = ({ queryRef }: PlaylistDetailsProps) => {
<Form form={form} className="flex gap-4">
<CoverPhoto
animateIn
image={playlist.images[0]}
image={(playlist.images ?? [])[0]}
className="row-span-2 flex-1"
/>
<div className="flex flex-col gap-4 flex-1">
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/PlaylistTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const PlaylistTile = ({ playlist }: PlaylistTileProps) => {
}
>
<MediaTile to={`/playlists/${playlist.id}`}>
<MediaTile.CoverPhoto image={playlist.images[0]} />
<MediaTile.CoverPhoto image={(playlist.images ?? [])[0]} />
<div className="flex flex-col">
<MediaTile.Title>{playlist.name}</MediaTile.Title>
<MediaTile.Details>
Expand Down
16 changes: 8 additions & 8 deletions client/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ export type Playlist = {
* **Note**: If returned, the source URL for the image (`url`) is temporary and
* will expire in less than a day.
*/
images: Array<Image>;
images: Maybe<Array<Image>>;
/** The name of the playlist. */
name: Scalars['String']['output'];
/** The user who owns the playlist. */
Expand Down Expand Up @@ -2595,7 +2595,7 @@ export type SidebarQuery = {
id: string;
uri: string;
name: string;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
owner: { __typename: 'User'; id: string; displayName: string | null };
};
}>;
Expand Down Expand Up @@ -2884,7 +2884,7 @@ export type PlaylistDetailsModalQuery = {
id: string;
name: string;
description: string | null;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
} | null;
};

Expand Down Expand Up @@ -2913,7 +2913,7 @@ export type PlaylistTile_playlist = {
name: string;
description: string | null;
uri: string;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
};

export type PlaylistTitleCell_playbackState = {
Expand Down Expand Up @@ -3635,7 +3635,7 @@ export type CollectionPlaylistsRouteQuery = {
name: string;
description: string | null;
uri: string;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
};
}>;
} | null;
Expand Down Expand Up @@ -3666,7 +3666,7 @@ export type CollectionPlaylistsRoutePaginatedQuery = {
name: string;
description: string | null;
uri: string;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
};
}>;
} | null;
Expand Down Expand Up @@ -3851,7 +3851,7 @@ export type IndexRouteQuery = {
name: string;
description: string | null;
uri: string;
images: Array<{ __typename: 'Image'; url: string }>;
images: Array<{ __typename: 'Image'; url: string }> | null;
};
}>;
} | null;
Expand All @@ -3876,7 +3876,7 @@ export type PlaylistQuery = {
__typename: 'Image';
url: string;
vibrantColor: string | null;
}>;
}> | null;
owner: { __typename: 'User'; id: string; displayName: string | null };
tracks: {
__typename: 'PlaylistTrackConnection';
Expand Down
4 changes: 2 additions & 2 deletions shared/spotify-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export namespace Spotify {
followers: Followers;
href: string;
id: string;
images: Image[];
images: Image[] | null;
name: string;
owner: UserSimplified;
primary_color: string | null;
Expand All @@ -338,7 +338,7 @@ export namespace Spotify {
external_urls: ExternalUrl;
href: string;
id: string;
images: Image[];
images: Image[] | null;
name: string;
owner: User;
primary_color: string | null;
Expand Down
2 changes: 1 addition & 1 deletion subgraphs/spotify/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ type Playlist @key(fields: "id") {
**Note**: If returned, the source URL for the image (`url`) is temporary and
will expire in less than a day.
"""
images: [Image!]!
images: [Image!]

"""
The name of the playlist.
Expand Down
8 changes: 6 additions & 2 deletions subgraphs/spotify/src/__generated__/resolvers-types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading