Skip to content

Commit 4031e91

Browse files
authored
Merge pull request #523 from Yooooomi/fix-release-defects
Fix release defects
2 parents 3ce9507 + 1188a01 commit 4031e91

File tree

37 files changed

+1781
-1867
lines changed

37 files changed

+1781
-1867
lines changed

apps/client/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@your_spotify/client",
3-
"version": "1.13.0",
3+
"version": "1.13.1",
44
"private": true,
55
"scripts": {
66
"start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
@@ -17,24 +17,24 @@
1717
"@mui/material": "^6.4.8",
1818
"@mui/system": "^6.4.8",
1919
"@mui/x-date-pickers": "^7.28.0",
20-
"@reduxjs/toolkit": "^2.6.1",
21-
"axios": "^1.8.4",
20+
"@reduxjs/toolkit": "^2.7.0",
21+
"axios": "^1.9.0",
2222
"clsx": "^2.1.1",
2323
"date-fns": "^4.1.0",
24-
"react": "^19.0.0",
24+
"react": "^19.1.0",
2525
"react-copy-to-clipboard": "^5.1.0",
26-
"react-dom": "^19.0.0",
26+
"react-dom": "^19.1.0",
2727
"react-infinite-scroll-component": "^6.1.0",
2828
"react-redux": "^9.2.0",
29-
"react-router-dom": "^7.4.0",
30-
"recharts": "^2.15.1",
29+
"react-router-dom": "^7.5.2",
30+
"recharts": "^2.15.3",
3131
"redux": "^5.0.1"
3232
},
3333
"devDependencies": {
34-
"@types/node": "^22.13.11",
34+
"@types/node": "^22.15.2",
3535
"@types/react-copy-to-clipboard": "^5.0.7",
3636
"@types/react-date-range": "^1.4.10",
37-
"@types/react-dom": "^19.0.4",
37+
"@types/react-dom": "^19.1.2",
3838
"@your_spotify/dev": "*",
3939
"react-scripts": "^5.0.1"
4040
},

apps/client/src/components/ImplementedCharts/ListeningRepartition/ListeningRepartition.tsx

+25-9
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ import Bar from "../../charts/Bar";
66
import { ImplementedChartProps } from "../types";
77
import ChartCard from "../../ChartCard";
88
import LoadingImplementedChart from "../LoadingImplementedChart";
9-
import { selectRawIntervalDetail } from "../../../services/redux/modules/user/selector";
9+
import {
10+
selectRawIntervalDetail,
11+
selectStatMeasurement,
12+
} from "../../../services/redux/modules/user/selector";
1013
import Tooltip from "../../Tooltip";
1114
import { TitleFormatter, ValueFormatter } from "../../Tooltip/Tooltip";
1215
import { DateFormatter } from "../../../services/date";
16+
import { msToMinutes } from "../../../services/stats";
1317

1418
interface ListeningRepartitionProps extends ImplementedChartProps {}
1519

@@ -21,6 +25,7 @@ const tooltipTitle: TitleFormatter<unknown[]> = ({ x }) =>
2125
export default function ListeningRepartition({
2226
className,
2327
}: ListeningRepartitionProps) {
28+
const measurement = useSelector(selectStatMeasurement);
2429
const { interval } = useSelector(selectRawIntervalDetail);
2530
const result = useAPI(api.timePerHourOfDay, interval.start, interval.end);
2631

@@ -49,14 +54,25 @@ export default function ListeningRepartition({
4954
);
5055

5156
const tooltipValue = useCallback<ValueFormatter<typeof data>>(
52-
(payload, value) => (
53-
<div>
54-
{`${value}% of your daily listening`}
55-
<br />
56-
{`${payload.count} out of ${total} songs`}
57-
</div>
58-
),
59-
[total],
57+
(payload, value) => {
58+
if (measurement === "number") {
59+
return (
60+
<div>
61+
{`${value}% of your daily listening`}
62+
<br />
63+
{`${payload.count} out of ${total} songs`}
64+
</div>
65+
);
66+
}
67+
return (
68+
<div>
69+
{`${value}% of your daily listening`}
70+
<br />
71+
{`${msToMinutes(payload.count)} out of ${msToMinutes(total)} minutes`}
72+
</div>
73+
);
74+
},
75+
[measurement, total],
6076
);
6177

6278
if (!result) {

apps/client/src/components/Layout/Sider/Sider.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import {
1919
import Text from "../../Text";
2020
import { useNavigate } from "../../../services/hooks/useNavigate";
2121
import SiderCategory from "./SiderCategory/SiderCategory";
22-
import { links } from "./types";
2322
import SiderTitle from "./SiderTitle";
2423
import s from "./index.module.css";
24+
import { useLinks } from "./useLinks";
2525

2626
interface SiderProps {
2727
className?: string;
@@ -83,6 +83,8 @@ export default function Sider({ className, isDrawer }: SiderProps) {
8383
const version = useSelector(selectVersion);
8484
const updateAvailable = useSelector(selectUpdateAvailable);
8585

86+
const links = useLinks();
87+
8688
if (!user) {
8789
return null;
8890
}
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
import { ReactNode } from "react";
2-
import {
3-
Home,
4-
HomeOutlined,
5-
BarChart,
6-
BarChartOutlined,
7-
MusicNote,
8-
MusicNoteOutlined,
9-
Album,
10-
AlbumOutlined,
11-
Person,
12-
PersonOutlined,
13-
Settings,
14-
SettingsOutlined,
15-
ExitToApp,
16-
Share,
17-
ShareOutlined,
18-
Speed,
19-
SpeedOutlined,
20-
} from "@mui/icons-material";
212

223
export interface SiderLink {
234
label: string;
@@ -31,87 +12,3 @@ export interface SiderCategory {
3112
label: string;
3213
items: SiderLink[];
3314
}
34-
35-
export const links: SiderCategory[] = [
36-
{
37-
label: "General",
38-
items: [
39-
{
40-
label: "Home",
41-
link: "/",
42-
icon: <HomeOutlined />,
43-
iconOn: <Home />,
44-
},
45-
{
46-
label: "Longest sessions",
47-
link: "/sessions",
48-
icon: <SpeedOutlined />,
49-
iconOn: <Speed />,
50-
},
51-
{
52-
label: "All stats",
53-
link: "/all",
54-
icon: <BarChartOutlined />,
55-
iconOn: <BarChart />,
56-
},
57-
],
58-
},
59-
{
60-
label: "Tops",
61-
items: [
62-
{
63-
label: "Top songs",
64-
link: "/top/songs",
65-
icon: <MusicNoteOutlined />,
66-
iconOn: <MusicNote />,
67-
},
68-
{
69-
label: "Top artists",
70-
link: "/top/artists",
71-
icon: <PersonOutlined />,
72-
iconOn: <Person />,
73-
},
74-
{
75-
label: "Top albums",
76-
link: "/top/albums",
77-
icon: <AlbumOutlined />,
78-
iconOn: <Album />,
79-
},
80-
],
81-
},
82-
{
83-
label: "With people",
84-
items: [
85-
{
86-
label: "Affinity",
87-
link: "/collaborative/affinity",
88-
icon: <MusicNoteOutlined />,
89-
iconOn: <MusicNote />,
90-
restrict: "guest",
91-
},
92-
],
93-
},
94-
{
95-
label: "Settings",
96-
items: [
97-
{
98-
label: "Share this page",
99-
link: "/share",
100-
icon: <ShareOutlined />,
101-
iconOn: <Share />,
102-
},
103-
{
104-
label: "Settings",
105-
link: "/settings/account",
106-
icon: <SettingsOutlined />,
107-
iconOn: <Settings />,
108-
},
109-
{
110-
label: "Logout",
111-
link: "/logout",
112-
icon: <ExitToApp />,
113-
iconOn: <ExitToApp />,
114-
},
115-
],
116-
},
117-
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import {
2+
Home,
3+
HomeOutlined,
4+
BarChart,
5+
BarChartOutlined,
6+
MusicNote,
7+
MusicNoteOutlined,
8+
Album,
9+
AlbumOutlined,
10+
Person,
11+
PersonOutlined,
12+
Settings,
13+
SettingsOutlined,
14+
ExitToApp,
15+
Share,
16+
ShareOutlined,
17+
Speed,
18+
SpeedOutlined,
19+
} from "@mui/icons-material";
20+
import { useMemo } from "react";
21+
import { useSelector } from "react-redux";
22+
import { selectAffinityEnabled } from "../../../services/redux/modules/settings/selector";
23+
import { compact } from "../../../services/tools";
24+
import { SiderCategory } from "./types";
25+
26+
export function useLinks() {
27+
const affinityEnabled = useSelector(selectAffinityEnabled);
28+
29+
return useMemo<SiderCategory[]>(
30+
() =>
31+
compact([
32+
{
33+
label: "General",
34+
items: [
35+
{
36+
label: "Home",
37+
link: "/",
38+
icon: <HomeOutlined />,
39+
iconOn: <Home />,
40+
},
41+
{
42+
label: "Longest sessions",
43+
link: "/sessions",
44+
icon: <SpeedOutlined />,
45+
iconOn: <Speed />,
46+
},
47+
{
48+
label: "All stats",
49+
link: "/all",
50+
icon: <BarChartOutlined />,
51+
iconOn: <BarChart />,
52+
},
53+
],
54+
},
55+
{
56+
label: "Tops",
57+
items: [
58+
{
59+
label: "Top songs",
60+
link: "/top/songs",
61+
icon: <MusicNoteOutlined />,
62+
iconOn: <MusicNote />,
63+
},
64+
{
65+
label: "Top artists",
66+
link: "/top/artists",
67+
icon: <PersonOutlined />,
68+
iconOn: <Person />,
69+
},
70+
{
71+
label: "Top albums",
72+
link: "/top/albums",
73+
icon: <AlbumOutlined />,
74+
iconOn: <Album />,
75+
},
76+
],
77+
},
78+
affinityEnabled
79+
? {
80+
label: "With people",
81+
items: [
82+
{
83+
label: "Affinity",
84+
link: "/collaborative/affinity",
85+
icon: <MusicNoteOutlined />,
86+
iconOn: <MusicNote />,
87+
restrict: "guest",
88+
},
89+
],
90+
}
91+
: undefined,
92+
{
93+
label: "Settings",
94+
items: [
95+
{
96+
label: "Share this page",
97+
link: "/share",
98+
icon: <ShareOutlined />,
99+
iconOn: <Share />,
100+
},
101+
{
102+
label: "Settings",
103+
link: "/settings/account",
104+
icon: <SettingsOutlined />,
105+
iconOn: <Settings />,
106+
},
107+
{
108+
label: "Logout",
109+
link: "/logout",
110+
icon: <ExitToApp />,
111+
iconOn: <ExitToApp />,
112+
},
113+
],
114+
},
115+
]),
116+
[affinityEnabled],
117+
);
118+
}

apps/client/src/scenes/ArtistStats/DayRepartition/DayRepartition.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, useCallback } from "react";
1+
import { useMemo, useCallback } from "react";
22
import ChartCard from "../../../components/ChartCard";
33
import Bar from "../../../components/charts/Bar";
44
import Tooltip from "../../../components/Tooltip";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Button } from "@mui/material";
2+
import { useCallback } from "react";
3+
import Text from "../../../components/Text";
4+
import TitleCard from "../../../components/TitleCard";
5+
import { enableAffinity } from "../../../services/redux/modules/settings/thunk";
6+
import { useAppDispatch } from "../../../services/redux/tools";
7+
import { GlobalPreferences } from "../../../services/types";
8+
import SettingLine from "../SettingLine";
9+
10+
interface EnableAffinityProps {
11+
settings: GlobalPreferences;
12+
}
13+
14+
export default function EnableAffinity({ settings }: EnableAffinityProps) {
15+
const dispatch = useAppDispatch();
16+
17+
console.log("affiinity", settings);
18+
19+
const handleEnable = useCallback(() => {
20+
if (!settings) {
21+
return;
22+
}
23+
dispatch(enableAffinity(!settings.allowAffinity)).catch(console.error);
24+
}, [dispatch, settings]);
25+
26+
return (
27+
<TitleCard title="Affinity">
28+
<SettingLine
29+
left={<Text>Enable affinity feature</Text>}
30+
right={
31+
<Button onClick={handleEnable}>
32+
{settings.allowAffinity ? "YES" : "NO"}
33+
</Button>
34+
}
35+
/>
36+
</TitleCard>
37+
);
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "./EnableAffinity";

0 commit comments

Comments
 (0)