Skip to content

Commit c7b067c

Browse files
committed
chore: run lint
1 parent 1f01284 commit c7b067c

17 files changed

+463
-329
lines changed

src/App.jsx

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ function App() {
299299
refreshRecentlyPlayed,
300300
} = useSpotifyData(activeSection, false, true);
301301

302-
303302
const {
304303
version: nocturneVersion,
305304
serial,
@@ -735,10 +734,15 @@ function App() {
735734
const isUpdateScreenVisible =
736735
isUpdating || (updateStatus.stage && updateStatus.stage !== "");
737736

738-
const showConnectionLostScreen = !isUpdateScreenVisible && !showTutorial && !pairingRequest && !lastConnectedDevice;
737+
const showConnectionLostScreen =
738+
!isUpdateScreenVisible &&
739+
!showTutorial &&
740+
!pairingRequest &&
741+
!lastConnectedDevice;
739742
// const showConnectionLostScreen = false;
740743

741-
const displayNetworkBanner = showNetworkBanner && !showConnectionLostScreen && !isUpdateScreenVisible;
744+
const displayNetworkBanner =
745+
showNetworkBanner && !showConnectionLostScreen && !isUpdateScreenVisible;
742746

743747
let content;
744748
if (isUpdateScreenVisible) {
@@ -838,65 +842,65 @@ function App() {
838842
refetchInfo={refetchInfo}
839843
/>
840844
)}
841-
<SettingsProvider>
842-
<DeviceSwitcherContext.Provider value={deviceSwitcherContextValue}>
843-
<Router>
844-
<FontLoader />
845-
<main
846-
className="overflow-hidden relative min-h-screen rounded-2xl"
847-
style={{
848-
fontFamily: `var(--font-inter), var(--font-noto-sans-sc), var(--font-noto-sans-tc), var(--font-noto-serif-jp), var(--font-noto-sans-kr), var(--font-noto-naskh-ar), var(--font-noto-sans-bn), var(--font-noto-sans-dv), var(--font-noto-sans-he), var(--font-noto-sans-ta), var(--font-noto-sans-th), var(--font-noto-sans-gk), system-ui, sans-serif`,
849-
fontOpticalSizing: "auto",
850-
}}
851-
>
852-
<GradientBackground
853-
gradientState={gradientState}
854-
className="bg-black"
855-
/>
856-
857-
<div className="relative z-10">
858-
{content}
859-
{!isUpdateScreenVisible &&
860-
!showTetheringScreen &&
861-
!showConnectionLostScreen && (
862-
<>
863-
{pairingRequest ? (
864-
<PairingScreen
865-
pin={pairingRequest.pairingKey}
866-
isConnecting={isConnecting}
867-
onAccept={acceptPairing}
868-
onReject={denyPairing}
869-
/>
870-
) : null}
871-
</>
872-
)}
873-
<NetworkBanner
874-
visible={displayNetworkBanner}
875-
onClose={() => setShowNetworkBanner(false)}
876-
/>
877-
<DeviceSwitcherModal
878-
isOpen={isDeviceSwitcherOpen}
879-
onClose={handleCloseDeviceSwitcher}
880-
initialDevices={prefetchedDevices}
881-
/>
882-
{!showTutorial && (
883-
<ButtonMappingOverlay
884-
show={showGlobalMappingOverlay}
885-
activeButton={globalActiveButton}
845+
<SettingsProvider>
846+
<DeviceSwitcherContext.Provider value={deviceSwitcherContextValue}>
847+
<Router>
848+
<FontLoader />
849+
<main
850+
className="overflow-hidden relative min-h-screen rounded-2xl"
851+
style={{
852+
fontFamily: `var(--font-inter), var(--font-noto-sans-sc), var(--font-noto-sans-tc), var(--font-noto-serif-jp), var(--font-noto-sans-kr), var(--font-noto-naskh-ar), var(--font-noto-sans-bn), var(--font-noto-sans-dv), var(--font-noto-sans-he), var(--font-noto-sans-ta), var(--font-noto-sans-th), var(--font-noto-sans-gk), system-ui, sans-serif`,
853+
fontOpticalSizing: "auto",
854+
}}
855+
>
856+
<GradientBackground
857+
gradientState={gradientState}
858+
className="bg-black"
859+
/>
860+
861+
<div className="relative z-10">
862+
{content}
863+
{!isUpdateScreenVisible &&
864+
!showTetheringScreen &&
865+
!showConnectionLostScreen && (
866+
<>
867+
{pairingRequest ? (
868+
<PairingScreen
869+
pin={pairingRequest.pairingKey}
870+
isConnecting={isConnecting}
871+
onAccept={acceptPairing}
872+
onReject={denyPairing}
886873
/>
887-
)}
888-
<PowerMenuOverlay
889-
show={powerMenuVisible}
890-
onShutdown={handleShutdown}
891-
onReboot={handleReboot}
892-
onClose={() => setPowerMenuVisible(false)}
893-
/>
894-
</div>
895-
</main>
896-
<NotificationsContainer />
897-
</Router>
898-
</DeviceSwitcherContext.Provider>
899-
</SettingsProvider>
874+
) : null}
875+
</>
876+
)}
877+
<NetworkBanner
878+
visible={displayNetworkBanner}
879+
onClose={() => setShowNetworkBanner(false)}
880+
/>
881+
<DeviceSwitcherModal
882+
isOpen={isDeviceSwitcherOpen}
883+
onClose={handleCloseDeviceSwitcher}
884+
initialDevices={prefetchedDevices}
885+
/>
886+
{!showTutorial && (
887+
<ButtonMappingOverlay
888+
show={showGlobalMappingOverlay}
889+
activeButton={globalActiveButton}
890+
/>
891+
)}
892+
<PowerMenuOverlay
893+
show={powerMenuVisible}
894+
onShutdown={handleShutdown}
895+
onReboot={handleReboot}
896+
onClose={() => setPowerMenuVisible(false)}
897+
/>
898+
</div>
899+
</main>
900+
<NotificationsContainer />
901+
</Router>
902+
</DeviceSwitcherContext.Provider>
903+
</SettingsProvider>
900904
</NotificationProvider>
901905
);
902906
}

src/components/auth/NetworkScreen.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ const NetworkScreen = ({ isConnectionLost = true, onConnectionRestored }) => {
6666
if (isAnimating) return;
6767
setIsAnimating(true);
6868

69-
const bluetoothOption = networkOptions.find(opt => opt.id === 'bluetooth');
69+
const bluetoothOption = networkOptions.find(
70+
(opt) => opt.id === "bluetooth",
71+
);
7072
setActiveSubItem(bluetoothOption);
71-
73+
7274
setMainClasses("-translate-x-full opacity-0");
7375
setSubpageClasses("translate-x-0 opacity-100");
7476

@@ -189,8 +191,8 @@ const NetworkScreen = ({ isConnectionLost = true, onConnectionRestored }) => {
189191
Connection Lost
190192
</h2>
191193
<p className="text-[28px] text-white/60 tracking-tight w-[32rem]">
192-
Enable Bluetooth Tethering and connect to "Nocturne" in
193-
your phone's settings.
194+
Enable Bluetooth Tethering and connect to "Nocturne" in your
195+
phone's settings.
194196
</p>
195197

196198
<button

src/components/common/LockView.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,24 @@ export default function LockView({
6565
useEffect(() => {
6666
if (currentPlayback?.item && updateGradientColors) {
6767
let imageUrl = null;
68-
68+
6969
if (currentPlayback.item.type === "episode") {
70-
imageUrl = currentPlayback.item.show?.images?.[0]?.url ||
71-
currentPlayback.item.images?.[0]?.url;
70+
imageUrl =
71+
currentPlayback.item.show?.images?.[0]?.url ||
72+
currentPlayback.item.images?.[0]?.url;
7273
} else if (currentPlayback.item.type === "track") {
7374
imageUrl = currentPlayback.item.album?.images?.[0]?.url;
7475
}
75-
76+
7677
if (imageUrl) {
7778
updateGradientColors(imageUrl, "lock");
7879
}
7980
}
80-
}, [currentPlayback?.item?.id, currentPlayback?.item?.type, updateGradientColors]);
81+
}, [
82+
currentPlayback?.item?.id,
83+
currentPlayback?.item?.type,
84+
updateGradientColors,
85+
]);
8186

8287
return (
8388
<div

src/components/common/SpotifyImage.jsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,19 @@ export default function SpotifyImage({
4545
setCurrentSrc(imageUrl);
4646
setIsLoading(false);
4747
setHasError(false);
48-
48+
4949
if (extractColors && onColorsExtracted) {
50-
import("../../utils/colorExtractor").then(({ extractColorsFromImage }) => {
51-
extractColorsFromImage(imageUrl).then((colors) => {
52-
if (colors && onColorsExtracted) {
53-
onColorsExtracted(colors);
54-
}
55-
});
56-
});
50+
import("../../utils/colorExtractor").then(
51+
({ extractColorsFromImage }) => {
52+
extractColorsFromImage(imageUrl).then((colors) => {
53+
if (colors && onColorsExtracted) {
54+
onColorsExtracted(colors);
55+
}
56+
});
57+
},
58+
);
5759
}
58-
60+
5961
if (onLoad) {
6062
onLoad();
6163
}

src/components/common/navigation/StatusBar.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { useState, useEffect } from "react";
2-
import {
3-
BatteryIcon,
4-
BluetoothIcon,
5-
USBIcon,
6-
} from "../../common/icons";
2+
import { BatteryIcon, BluetoothIcon, USBIcon } from "../../common/icons";
73
import { useBluetooth } from "../../../hooks/useNocturned";
84
import { useCurrentTime } from "../../../hooks/useCurrentTime";
95

src/components/common/overlays/ButtonMappingOverlay.jsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const ButtonMappingOverlay = memo(function ButtonMappingOverlay({
1313
const preloadImagesCacheRef = useRef({});
1414
const timerRef = useRef(null);
1515
const blobUrlsRef = useRef([]);
16-
16+
1717
const { sendSpotifyCommand } = useSpotifyWebSocket();
1818

1919
useEffect(() => {
@@ -27,8 +27,9 @@ const ButtonMappingOverlay = memo(function ButtonMappingOverlay({
2727
const contentType = localStorage.getItem(`button${buttonNum}Type`);
2828

2929
if (imageUrl) {
30-
const isLocalImage = imageUrl.startsWith('/images/') || imageUrl.startsWith('images/');
31-
30+
const isLocalImage =
31+
imageUrl.startsWith("/images/") || imageUrl.startsWith("images/");
32+
3233
if (
3334
!preloadImagesCacheRef.current[buttonNum] ||
3435
preloadImagesCacheRef.current[buttonNum] !== imageUrl
@@ -37,22 +38,25 @@ const ButtonMappingOverlay = memo(function ButtonMappingOverlay({
3738
const img = new Image();
3839
img.src = imageUrl;
3940
preloadImagesCacheRef.current[buttonNum] = imageUrl;
40-
preloadImagesCacheRef.current[buttonNum + '_data'] = imageUrl;
41+
preloadImagesCacheRef.current[buttonNum + "_data"] = imageUrl;
4142
hasChanged = true;
4243
images[buttonNum] = imageUrl;
4344
types[buttonNum] = contentType;
4445
} else {
4546
try {
4647
const result = await sendSpotifyCommand("spotify.image.fetch", {
47-
url: imageUrl
48+
url: imageUrl,
4849
});
49-
50+
5051
if (result && result.data) {
5152
let blobUrl;
5253
const imageData = result.data;
53-
54+
5455
if (typeof imageData === "string") {
55-
if (imageData.startsWith("data:") || imageData.startsWith("blob:")) {
56+
if (
57+
imageData.startsWith("data:") ||
58+
imageData.startsWith("blob:")
59+
) {
5660
blobUrl = imageData;
5761
} else {
5862
blobUrl = `data:image/jpeg;base64,${imageData}`;
@@ -67,22 +71,26 @@ const ButtonMappingOverlay = memo(function ButtonMappingOverlay({
6771
} else {
6872
blobUrl = String(imageData);
6973
}
70-
74+
7175
const img = new Image();
7276
img.src = blobUrl;
73-
77+
7478
preloadImagesCacheRef.current[buttonNum] = imageUrl;
75-
preloadImagesCacheRef.current[buttonNum + '_data'] = blobUrl;
79+
preloadImagesCacheRef.current[buttonNum + "_data"] = blobUrl;
7680
hasChanged = true;
7781
images[buttonNum] = blobUrl;
7882
types[buttonNum] = contentType;
7983
}
8084
} catch (error) {
81-
console.error(`Failed to fetch image for button ${buttonNum}:`, error);
85+
console.error(
86+
`Failed to fetch image for button ${buttonNum}:`,
87+
error,
88+
);
8289
}
8390
}
8491
} else {
85-
const cachedData = preloadImagesCacheRef.current[buttonNum + '_data'];
92+
const cachedData =
93+
preloadImagesCacheRef.current[buttonNum + "_data"];
8694
if (cachedData) {
8795
images[buttonNum] = cachedData;
8896
types[buttonNum] = contentType;
@@ -118,7 +126,7 @@ const ButtonMappingOverlay = memo(function ButtonMappingOverlay({
118126

119127
useEffect(() => {
120128
return () => {
121-
blobUrlsRef.current.forEach(url => {
129+
blobUrlsRef.current.forEach((url) => {
122130
URL.revokeObjectURL(url);
123131
});
124132
blobUrlsRef.current = [];

0 commit comments

Comments
 (0)