@behindthemusictree/app-kit 34.1.0 → 35.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-QZXZHP4R.js → chunk-ULSVAC23.js} +29 -30
- package/dist/chunk-ULSVAC23.js.map +1 -0
- package/dist/genre-tree/index.cjs +28 -29
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +208 -209
- package/dist/genre-tree/index.js +1 -1
- package/dist/index.cjs +28 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-QZXZHP4R.js.map +0 -1
|
@@ -271,12 +271,12 @@ var CriteriaDetailedSchema = import_zod11.z.object({
|
|
|
271
271
|
wikidataId: import_zod11.z.string().nullable().optional(),
|
|
272
272
|
parent: CriteriaMinimumSchema.nullable(),
|
|
273
273
|
ascendants: import_zod11.z.array(CriteriaLineageRelWithoutDescendantSchema),
|
|
274
|
-
descendants: import_zod11.z.array(CriteriaLineageRelWithoutAscendantSchema),
|
|
274
|
+
descendants: import_zod11.z.array(CriteriaLineageRelWithoutAscendantSchema).optional(),
|
|
275
275
|
root: CriteriaMinimumSchema,
|
|
276
276
|
children: import_zod11.z.array(CriteriaMinimumSchema),
|
|
277
277
|
catalogue: GenreCatalogueCountsSchema.optional(),
|
|
278
|
-
criteriaPlaylist: import_zod11.z.union([GenrePlaylistSummarySchema, CriteriaPlaylistMinimumSchema]),
|
|
279
|
-
tracks: import_zod11.z.array(TrackMinimumSchema),
|
|
278
|
+
criteriaPlaylist: import_zod11.z.union([GenrePlaylistSummarySchema, CriteriaPlaylistMinimumSchema]).nullable(),
|
|
279
|
+
tracks: import_zod11.z.array(TrackMinimumSchema).optional(),
|
|
280
280
|
essentialSongs: import_zod11.z.array(TrackMinimumSchema),
|
|
281
281
|
tracksCount: import_zod11.z.number(),
|
|
282
282
|
updatedOn: import_zod11.z.string().datetime().nullable()
|
|
@@ -332,7 +332,7 @@ var CriteriaPlaylistSimpleSchema = CriteriaPlaylistDetailedSchema.pick({
|
|
|
332
332
|
// src/genre-tree/schemas/reference-genre.ts
|
|
333
333
|
var ReferenceGenreDetailedSchema = CriteriaDetailedSchema.extend({
|
|
334
334
|
catalogue: GenreCatalogueCountsSchema,
|
|
335
|
-
criteriaPlaylist: GenrePlaylistSummarySchema
|
|
335
|
+
criteriaPlaylist: GenrePlaylistSummarySchema.nullable()
|
|
336
336
|
});
|
|
337
337
|
var ReferenceGenrePlaylistSchema = CriteriaPlaylistSimpleSchema.extend({
|
|
338
338
|
...GenreCountsSchema.shape,
|
|
@@ -1998,43 +1998,40 @@ function useGenreTreeViewState({
|
|
|
1998
1998
|
getBackendBaseUrl,
|
|
1999
1999
|
viewMode: controlledViewMode,
|
|
2000
2000
|
artistUuid,
|
|
2001
|
-
|
|
2002
|
-
|
|
2001
|
+
selectedGenreUuid: controlledSelectedGenreUuid,
|
|
2002
|
+
onSelectedGenreUuidChange,
|
|
2003
2003
|
criteriaOverviewSchema
|
|
2004
2004
|
}) {
|
|
2005
2005
|
const [internalViewMode, setInternalViewMode] = (0, import_react11.useState)("pop-core");
|
|
2006
2006
|
const [allowWheelRotation, setAllowWheelRotation] = (0, import_react11.useState)(false);
|
|
2007
|
-
const [
|
|
2008
|
-
const isSelectionControlled =
|
|
2009
|
-
const
|
|
2010
|
-
const
|
|
2007
|
+
const [internalSelectedGenreUuid, setInternalSelectedGenreUuid] = (0, import_react11.useState)(null);
|
|
2008
|
+
const isSelectionControlled = controlledSelectedGenreUuid !== void 0;
|
|
2009
|
+
const selectedGenreUuid = isSelectionControlled ? controlledSelectedGenreUuid : internalSelectedGenreUuid;
|
|
2010
|
+
const selectGenre = (0, import_react11.useCallback)(
|
|
2011
2011
|
(nodeId) => {
|
|
2012
|
-
if (!isSelectionControlled)
|
|
2013
|
-
|
|
2012
|
+
if (!isSelectionControlled) setInternalSelectedGenreUuid(nodeId);
|
|
2013
|
+
onSelectedGenreUuidChange?.(nodeId);
|
|
2014
2014
|
},
|
|
2015
|
-
[isSelectionControlled,
|
|
2015
|
+
[isSelectionControlled, onSelectedGenreUuidChange]
|
|
2016
2016
|
);
|
|
2017
2017
|
const { isLoading, isFetching, genrePlaylists } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
2018
2018
|
const genrePlaylistByNodeId = (0, import_react11.useMemo)(() => new Map(genrePlaylists.map((gp) => [gp.uuid, gp])), [genrePlaylists]);
|
|
2019
2019
|
const selectedGenrePlaylist = (0, import_react11.useMemo)(
|
|
2020
|
-
() => genrePlaylists.find((gp) => gp.uuid ===
|
|
2021
|
-
|
|
2022
|
-
genrePlaylists.find((gp) => gp.criteria?.uuid === requestedSelectedNodeId),
|
|
2023
|
-
[genrePlaylists, requestedSelectedNodeId]
|
|
2020
|
+
() => genrePlaylists.find((gp) => gp.criteria?.uuid === selectedGenreUuid),
|
|
2021
|
+
[genrePlaylists, selectedGenreUuid]
|
|
2024
2022
|
);
|
|
2025
|
-
const selectedNodeId = selectedGenrePlaylist?.uuid ??
|
|
2026
|
-
(0, import_react11.
|
|
2027
|
-
if (!
|
|
2028
|
-
|
|
2023
|
+
const selectedNodeId = selectedGenrePlaylist?.uuid ?? null;
|
|
2024
|
+
const selectNode = (0, import_react11.useCallback)((node) => {
|
|
2025
|
+
if (!node) selectGenre(null);
|
|
2026
|
+
else {
|
|
2027
|
+
const genreUuid = genrePlaylistByNodeId.get(node.id)?.criteria?.uuid;
|
|
2028
|
+
if (genreUuid) selectGenre(genreUuid);
|
|
2029
2029
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
(genrePlaylist) => setSelectedNodeId(genrePlaylist.uuid),
|
|
2036
|
-
[setSelectedNodeId]
|
|
2037
|
-
);
|
|
2030
|
+
}, [selectGenre, genrePlaylistByNodeId]);
|
|
2031
|
+
const clearSelection = (0, import_react11.useCallback)(() => selectGenre(null), [selectGenre]);
|
|
2032
|
+
const selectGenrePlaylist = (0, import_react11.useCallback)((playlist) => {
|
|
2033
|
+
if (playlist.criteria) selectGenre(playlist.criteria.uuid);
|
|
2034
|
+
}, [selectGenre]);
|
|
2038
2035
|
const prefetchGenreOverview = usePrefetchGenreOverview(scope, getBackendBaseUrl, criteriaOverviewSchema);
|
|
2039
2036
|
const hoverPrefetchTimerRef = (0, import_react11.useRef)(null);
|
|
2040
2037
|
(0, import_react11.useEffect)(
|
|
@@ -2084,6 +2081,8 @@ function useGenreTreeViewState({
|
|
|
2084
2081
|
genrePlaylistByNodeId,
|
|
2085
2082
|
visibleGenrePlaylists,
|
|
2086
2083
|
groupedGenrePlaylistsByRoot,
|
|
2084
|
+
selectedGenreUuid,
|
|
2085
|
+
selectGenre,
|
|
2087
2086
|
selectedNodeId,
|
|
2088
2087
|
selectedGenrePlaylist,
|
|
2089
2088
|
selectNode,
|