Skip to content

Commit 7c4a13c

Browse files
committed
Merge branch 'master' into add-designer-top-10-alt
2 parents 1f7e166 + 55dbbf0 commit 7c4a13c

File tree

91 files changed

+2490
-2199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2490
-2199
lines changed

docs/developers/devel-env.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Update the ``LASTFM_API_KEY`` field with your Last.fm API key.
118118
You also need to update the ``API_URL`` field value to ``http://localhost:8100``.
119119

120120
To use the Spotify importer you need to register an application on the
121-
`Spotify Developer Dashboard`_. Use ``http://localhost:8100/settings/music-services/spotify/callback/``
121+
`Spotify Developer Dashboard`_. Use ``http://127.0.0.1:8100/settings/music-services/spotify/callback/``
122122
as the callback URL.
123123

124124
After that, fill out the Spotify client ID and client secret in the following

frontend/css/sass/buttons.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@
2626
.btn-rounded {
2727
--bs-btn-border-radius: 3em;
2828
}
29+
.btn-small-rounding,
30+
.btn.dropdown-toggle {
31+
--bs-btn-border-radius: #{$btn-border-radius-lg};
32+
}
2933
@each $color, $value in $theme-colors {
3034
.btn-outline-#{$color} {
3135
--bs-btn-border-radius: #{$btn-border-radius-lg};
3236
}
3337
}
34-
.btn.dropdown-toggle {
35-
--bs-btn-border-radius: 4px;
36-
}
3738

3839
.btn-link {
3940
color: $listenbrainz-blue;

frontend/css/sass/playlists.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ $long-description-lines: 8;
99
gap: 1rem;
1010
}
1111

12+
.playlist-info .description {
13+
white-space: pre-wrap;
14+
}
15+
1216
#playlists-container {
1317
display: flex;
1418
flex-wrap: wrap;

frontend/css/sass/stats.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@use "sass:map";
22

33
.user-stats-card {
4-
margin-top: 20px;
54
padding: 0 20px;
5+
min-height: 400px;
66
}
77

88
.stats-full-width-graph {

frontend/js/src/album/AlbumPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { Vibrant } from "node-vibrant/browser";
1414
import { Helmet } from "react-helmet";
1515
import { Link, useLocation, useParams } from "react-router";
1616
import { toast } from "react-toastify";
17+
import { useSetAtom } from "jotai";
1718
import CBReview from "../cb-review/CBReview";
18-
import { useBrainzPlayerDispatch } from "../common/brainzplayer/BrainzPlayerContext";
1919
import ListenCard from "../common/listens/ListenCard";
2020
import Username from "../common/Username";
2121
import OpenInMusicBrainzButton from "../components/OpenInMusicBrainz";
@@ -32,6 +32,7 @@ import {
3232
ListeningStats,
3333
popularRecordingToListen,
3434
} from "./utils";
35+
import { setAmbientQueueAtom } from "../common/brainzplayer/BrainzPlayerAtoms";
3536

3637
// not the same format of tracks as what we get in the ArtistPage props
3738
type AlbumRecording = {
@@ -183,13 +184,10 @@ export default function AlbumPage(): JSX.Element {
183184
listensFromAlbumRecordings
184185
);
185186

186-
const dispatch = useBrainzPlayerDispatch();
187+
const setAmbientQueue = useSetAtom(setAmbientQueueAtom);
187188

188189
React.useEffect(() => {
189-
dispatch({
190-
type: "SET_AMBIENT_QUEUE",
191-
data: listensFromAlbumsRecordingsFlattened,
192-
});
190+
setAmbientQueue(listensFromAlbumsRecordingsFlattened);
193191
// eslint-disable-next-line react-hooks/exhaustive-deps
194192
}, [listensFromAlbumsRecordingsFlattened]);
195193

frontend/js/src/artist/ArtistPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { Helmet } from "react-helmet";
2020
import { useQuery } from "@tanstack/react-query";
2121
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
22+
import { useSetAtom } from "jotai";
2223
import { getReviewEventContent } from "../utils/utils";
2324
import TagsComponent from "../tags/TagsComponent";
2425
import ListenCard from "../common/listens/ListenCard";
@@ -35,12 +36,12 @@ import type {
3536
} from "../album/utils";
3637
import ReleaseCard from "../explore/fresh-releases/components/ReleaseCard";
3738
import { RouteQuery } from "../utils/Loader";
38-
import { useBrainzPlayerDispatch } from "../common/brainzplayer/BrainzPlayerContext";
3939
import SimilarArtistComponent from "../explore/music-neighborhood/components/SimilarArtist";
4040
import Pill from "../components/Pill";
4141
import HorizontalScrollContainer from "../components/HorizontalScrollContainer";
4242
import Username from "../common/Username";
4343
import CBReview from "../cb-review/CBReview";
44+
import { setAmbientQueueAtom } from "../common/brainzplayer/BrainzPlayerAtoms";
4445

4546
export function SortingButtons({
4647
sort,
@@ -239,13 +240,10 @@ export default function ArtistPage(): JSX.Element {
239240
const listensFromPopularRecordings =
240241
popularRecordings?.map(popularRecordingToListen) ?? [];
241242

242-
const dispatch = useBrainzPlayerDispatch();
243+
const setAmbientQueue = useSetAtom(setAmbientQueueAtom);
243244

244245
React.useEffect(() => {
245-
dispatch({
246-
type: "SET_AMBIENT_QUEUE",
247-
data: listensFromPopularRecordings,
248-
});
246+
setAmbientQueue(listensFromPopularRecordings);
249247
// eslint-disable-next-line react-hooks/exhaustive-deps
250248
}, [listensFromPopularRecordings]);
251249

frontend/js/src/common/brainzplayer/AppleMusicPlayer.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
} from "../../utils/utils";
1111
import { DataSourceProps, DataSourceType } from "./BrainzPlayer";
1212
import GlobalAppContext from "../../utils/GlobalAppContext";
13-
import { BrainzPlayerContext } from "./BrainzPlayerContext";
1413
import { dataSourcesInfo } from "../../settings/brainzplayer/BrainzPlayerSettings";
14+
import { currentDataSourceNameAtom, store } from "./BrainzPlayerAtoms";
1515

1616
export type AppleMusicPlayerProps = DataSourceProps;
1717

@@ -149,20 +149,20 @@ export default class AppleMusicPlayer
149149
}
150150

151151
componentDidUpdate(prevProps: DataSourceProps) {
152-
const { show, volume } = this.props;
153-
const player = this.appleMusicPlayer;
154-
if (prevProps.volume !== volume && player) {
155-
player.volume = (volume ?? 100) / 100;
156-
}
157-
if (prevProps.show && !show) {
158-
this.stopAndClear();
152+
const { volume } = this.props;
153+
if (this.appleMusicPlayer && prevProps.volume !== volume) {
154+
this.appleMusicPlayer.volume = (volume ?? 100) / 100;
159155
}
160156
}
161157

162158
componentWillUnmount(): void {
163159
this.disconnectAppleMusicPlayer();
164160
}
165161

162+
stop = () => {
163+
this.appleMusicPlayer?.pause();
164+
};
165+
166166
playAppleMusicId = async (
167167
appleMusicId: string,
168168
retryCount = 0
@@ -260,8 +260,9 @@ export default class AppleMusicPlayer
260260
};
261261

262262
playListen = async (listen: Listen | JSPFTrack): Promise<void> => {
263-
const { show } = this.props;
264-
if (!show) {
263+
const isCurrentDataSource =
264+
store.get(currentDataSourceNameAtom) === this.name;
265+
if (!isCurrentDataSource) {
265266
return;
266267
}
267268
const apple_music_id = AppleMusicPlayer.getURLFromListen(listen as Listen);
@@ -471,8 +472,9 @@ export default class AppleMusicPlayer
471472
};
472473

473474
render() {
474-
const { show } = this.props;
475-
if (!show) {
475+
const isCurrentDataSource =
476+
store.get(currentDataSourceNameAtom) === this.name;
477+
if (!isCurrentDataSource) {
476478
return null;
477479
}
478480
return <div>{this.getAlbumArt()}</div>;

0 commit comments

Comments
 (0)