Skip to content

Commit a1b7625

Browse files
committed
Fix build issue by commenting out unfinished last fm logic
1 parent dd819b9 commit a1b7625

6 files changed

Lines changed: 155 additions & 76 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "just-another-music-client",
33
"private": true,
4-
"version": "1.2.73",
4+
"version": "1.2.74",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "just-another-music-client"
3-
version = "1.2.73"
3+
version = "1.2.74"
44
description = "A desktop music client"
55
authors = ["you"]
66
edition = "2021"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Just Another Music Client",
4-
"version": "1.2.73",
4+
"version": "1.2.74",
55
"identifier": "com.justanothermusicclient.desktop",
66
"build": {
77
"beforeDevCommand": "npm run dev",

src/ui/pages/SettingsPage.tsx

Lines changed: 149 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type CSSProperties, type KeyboardEvent, useEffect, useState, useSyncExternalStore } from "react";
22
import {
3-
IconBrandLastfm,
3+
// IconBrandLastfm,
44
IconBug,
55
IconChevronDown,
66
IconCoffee,
@@ -77,11 +77,11 @@ import {
7777
removeLocalPlaylistPath,
7878
subscribeToLocalPlaylists,
7979
} from "../../player/localPlaylists";
80-
import { LastFmService, type LastFmAuthStart, type LastFmSessionStatus } from "../../player/LastFm";
81-
import {
82-
setLastFmScrobblingEnabled,
83-
useLastFmScrobblingEnabled,
84-
} from "../settings/lastfm";
80+
// import { LastFmService, type LastFmAuthStart, type LastFmSessionStatus } from "../../player/LastFm";
81+
// import {
82+
// setLastFmScrobblingEnabled,
83+
// useLastFmScrobblingEnabled,
84+
// } from "../settings/lastfm";
8585
import styles from "./SettingsPage.module.css";
8686

8787
const GITHUB_REPOSITORY_URL = "https://github.com/2latemc/JustAnotherMusicClient";
@@ -136,10 +136,10 @@ export function SettingsPage({
136136
const [localPlaylistPathInputs, setLocalPlaylistPathInputs] = useState<Record<string, string>>({});
137137
const [localPlaylistError, setLocalPlaylistError] = useState<string | null>(null);
138138
const [localPlaylistBrowsingId, setLocalPlaylistBrowsingId] = useState<string | null>(null);
139-
const [lastFmSession, setLastFmSession] = useState<LastFmSessionStatus | null>(null);
140-
const [lastFmAuth, setLastFmAuth] = useState<LastFmAuthStart | null>(null);
141-
const [lastFmBusy, setLastFmBusy] = useState(false);
142-
const [lastFmError, setLastFmError] = useState<string | null>(null);
139+
// const [lastFmSession, setLastFmSession] = useState<LastFmSessionStatus | null>(null);
140+
// const [lastFmAuth, setLastFmAuth] = useState<LastFmAuthStart | null>(null);
141+
// const [lastFmBusy, setLastFmBusy] = useState(false);
142+
// const [lastFmError, setLastFmError] = useState<string | null>(null);
143143
const [activeTab, setActiveTab] = useState<SettingsTab>("about");
144144
const [listeningShortcut, setListeningShortcut] = useState<KeyboardShortcutAction | null>(null);
145145
const keyboardShortcuts = useKeyboardShortcuts();
@@ -149,7 +149,7 @@ export function SettingsPage({
149149
const extraPlayerControlsAlwaysVisible = useExtraPlayerControlsAlwaysVisible();
150150
const windowsStyleWindowControls = useWindowsStyleWindowControls();
151151
const nativeWindowControls = useNativeWindowControls();
152-
const lastFmScrobblingEnabled = useLastFmScrobblingEnabled();
152+
// const lastFmScrobblingEnabled = useLastFmScrobblingEnabled();
153153
const localPlaylists = useSyncExternalStore(
154154
subscribeToLocalPlaylists,
155155
getLocalPlaylists,
@@ -192,21 +192,21 @@ export function SettingsPage({
192192
};
193193
}, []);
194194

195-
useEffect(() => {
196-
let active = true;
197-
void LastFmService.getSession()
198-
.then((session) => {
199-
if (active) setLastFmSession(session);
200-
})
201-
.catch((error) => {
202-
if (active) {
203-
setLastFmError(error instanceof Error ? error.message : "Unable to load Last.fm connection.");
204-
}
205-
});
206-
return () => {
207-
active = false;
208-
};
209-
}, []);
195+
// useEffect(() => {
196+
// let active = true;
197+
// void LastFmService.getSession()
198+
// .then((session) => {
199+
// if (active) setLastFmSession(session);
200+
// })
201+
// .catch((error) => {
202+
// if (active) {
203+
// setLastFmError(error instanceof Error ? error.message : "Unable to load Last.fm connection.");
204+
// }
205+
// });
206+
// return () => {
207+
// active = false;
208+
// };
209+
// }, []);
210210

211211
useEffect(() => {
212212
if (!resetSettingsConfirming) return undefined;
@@ -352,48 +352,48 @@ export function SettingsPage({
352352
}
353353
};
354354

355-
const handleStartLastFmAuth = async () => {
356-
setLastFmBusy(true);
357-
setLastFmError(null);
358-
try {
359-
const auth = await LastFmService.startAuth();
360-
setLastFmAuth(auth);
361-
} catch (error) {
362-
setLastFmError(error instanceof Error ? error.message : "Unable to start Last.fm sign-in.");
363-
} finally {
364-
setLastFmBusy(false);
365-
}
366-
};
367-
368-
const handleFinishLastFmAuth = async () => {
369-
if (!lastFmAuth) return;
370-
setLastFmBusy(true);
371-
setLastFmError(null);
372-
try {
373-
const session = await LastFmService.completeAuth(lastFmAuth.token);
374-
setLastFmSession(session);
375-
setLastFmAuth(null);
376-
setLastFmScrobblingEnabled(true);
377-
} catch (error) {
378-
setLastFmError(error instanceof Error ? error.message : "Unable to finish Last.fm sign-in.");
379-
} finally {
380-
setLastFmBusy(false);
381-
}
382-
};
383-
384-
const handleDisconnectLastFm = async () => {
385-
setLastFmBusy(true);
386-
setLastFmError(null);
387-
try {
388-
await LastFmService.disconnect();
389-
setLastFmSession(null);
390-
setLastFmAuth(null);
391-
} catch (error) {
392-
setLastFmError(error instanceof Error ? error.message : "Unable to disconnect Last.fm.");
393-
} finally {
394-
setLastFmBusy(false);
395-
}
396-
};
355+
// const handleStartLastFmAuth = async () => {
356+
// setLastFmBusy(true);
357+
// setLastFmError(null);
358+
// try {
359+
// const auth = await LastFmService.startAuth();
360+
// setLastFmAuth(auth);
361+
// } catch (error) {
362+
// setLastFmError(error instanceof Error ? error.message : "Unable to start Last.fm sign-in.");
363+
// } finally {
364+
// setLastFmBusy(false);
365+
// }
366+
// };
367+
368+
// const handleFinishLastFmAuth = async () => {
369+
// if (!lastFmAuth) return;
370+
// setLastFmBusy(true);
371+
// setLastFmError(null);
372+
// try {
373+
// const session = await LastFmService.completeAuth(lastFmAuth.token);
374+
// setLastFmSession(session);
375+
// setLastFmAuth(null);
376+
// setLastFmScrobblingEnabled(true);
377+
// } catch (error) {
378+
// setLastFmError(error instanceof Error ? error.message : "Unable to finish Last.fm sign-in.");
379+
// } finally {
380+
// setLastFmBusy(false);
381+
// }
382+
// };
383+
384+
// const handleDisconnectLastFm = async () => {
385+
// setLastFmBusy(true);
386+
// setLastFmError(null);
387+
// try {
388+
// await LastFmService.disconnect();
389+
// setLastFmSession(null);
390+
// setLastFmAuth(null);
391+
// } catch (error) {
392+
// setLastFmError(error instanceof Error ? error.message : "Unable to disconnect Last.fm.");
393+
// } finally {
394+
// setLastFmBusy(false);
395+
// }
396+
// };
397397

398398
const handleAddLocalPlaylistPath = (playlistId: string) => {
399399
setLocalPlaylistError(null);
@@ -590,8 +590,87 @@ export function SettingsPage({
590590
{libraryState.error && <p className={styles.error}>{libraryState.error}</p>}
591591
</section>
592592

593-
593+
{/* <section className={styles.card} aria-labelledby="lastfm-settings-title">
594+
<div className={styles.cardHeader}>
595+
<div>
596+
<h2 id="lastfm-settings-title">Last.fm</h2>
597+
<p>
598+
{lastFmSession
599+
? `Connected as ${lastFmSession.username}`
600+
: "Connect Last.fm to scrobble your listening history."}
601+
</p>
602+
</div>
603+
<span className={`${styles.status} ${lastFmSession ? styles.connected : ""}`}>
604+
{lastFmSession ? "Connected" : "Signed out"}
605+
</span>
606+
</div>
594607
608+
<div className={styles.settingsList}>
609+
<label className={`${styles.settingRow} ${!lastFmSession ? styles.toggleRowDisabled : ""}`}>
610+
<span className={styles.toggleDescription}>
611+
<strong>Scrobble plays</strong>
612+
<span>
613+
Send now playing updates and scrobbles after a track reaches the Last.fm listening threshold.
614+
</span>
615+
</span>
616+
<input
617+
className={styles.toggleInput}
618+
type="checkbox"
619+
checked={lastFmSession ? lastFmScrobblingEnabled : false}
620+
disabled={!lastFmSession}
621+
onChange={(event) => setLastFmScrobblingEnabled(event.target.checked)}
622+
/>
623+
<span className={styles.toggle} aria-hidden="true" />
624+
</label>
625+
626+
<div className={styles.actionRow}>
627+
<span className={styles.toggleDescription}>
628+
<strong>Account connection</strong>
629+
<span>
630+
{lastFmAuth
631+
? "Approve the connection in your browser, then finish it here."
632+
: lastFmSession
633+
? "Disconnecting stops future Last.fm updates from this app."
634+
: "A browser window will open so you can approve this app on Last.fm."}
635+
</span>
636+
</span>
637+
{lastFmSession ? (
638+
<button
639+
className={styles.secondaryButton}
640+
type="button"
641+
disabled={lastFmBusy}
642+
onClick={() => void handleDisconnectLastFm()}
643+
>
644+
<IconBrandLastfm size={18} />
645+
{lastFmBusy ? "Disconnecting..." : "Disconnect"}
646+
</button>
647+
) : lastFmAuth ? (
648+
<button
649+
className={styles.signInButton}
650+
type="button"
651+
disabled={lastFmBusy}
652+
onClick={() => void handleFinishLastFmAuth()}
653+
>
654+
<IconBrandLastfm size={18} />
655+
{lastFmBusy ? "Finishing..." : "Finish connection"}
656+
</button>
657+
) : (
658+
<button
659+
className={styles.signInButton}
660+
type="button"
661+
disabled={lastFmBusy}
662+
onClick={() => void handleStartLastFmAuth()}
663+
>
664+
<IconBrandLastfm size={18} />
665+
{lastFmBusy ? "Opening..." : "Connect Last.fm"}
666+
</button>
667+
)}
668+
</div>
669+
670+
{lastFmError && <p className={styles.error}>{lastFmError}</p>}
671+
</div>
672+
</section>
673+
*/}
595674
<section className={styles.card} aria-labelledby="about-settings-title">
596675
<div className={styles.compactHeader}>
597676
<h2 id="about-settings-title">About</h2>
@@ -1098,4 +1177,4 @@ export function SettingsPage({
10981177

10991178
</main>
11001179
);
1101-
}
1180+
}

0 commit comments

Comments
 (0)