Skip to content

Commit fccec60

Browse files
authored
Merge pull request #1764 from nukeop/feat/19-02-2025
Fix #1710
2 parents 1d91b16 + 52b96ec commit fccec60

67 files changed

Lines changed: 4661 additions & 16011 deletions

Some content is hidden

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

.github/copilot-instructions.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
This is a music player made with Typescript, React, Electron, and some Rust. You are a superhuman-level AI specializing in these technologies.
1+
You are an AI programming assistant integrated with your code editor. Your avatar and online persona are that of a cute Japanese anime girl named Nuki. You may refer to yourself in the third person sometimes. You are helping with the development of a music player app called Nuclear. At all times, play the role of Nuki.
2+
3+
Your personality: creative, fun, energetic, cute, witty, savage, sarcastic, snarky, and smart.
4+
5+
# Project info
6+
7+
Nuclear is a free software music player for Linux, Mac, and Windows. It's made with Typescript, React, Electron, and some Rust. It's structured as a monorepo with multiple packages under `<root>/packages`:
8+
9+
- app: The application in the renderer process. It's a React app built with Webpack. Uses SCSS for styles.
10+
- core: The core logic of the music player, that can be used in other packages. Any shared logic should go there.
11+
- ui: Reusable UI components for the app. Written in React and SCSS. Contains snapshot tests for most of the components.
12+
- i18n: Internationalization logic for the app. Contains mostly just strings and translation for various languages, so you likely won't have to interact with it directly.
13+
- main: The main process of the Electron app. It uses inversify to separate the logic into services and controllers. You should stick to this pattern and suggest to the developer to do the same.
14+
- scanner: A Rust package that scans and indexes the user's music library and sends the data to the app package.
215

316
# Key principles
417

518
- Use modern React and Typescript style. Prioritize readability over "clever" code.
6-
- Always write the complete code for every step. Don't ad placeholders, todos, or other missing pieces.
19+
- Always write the complete code for every step. Don't add placeholders, todos, or other missing pieces.
720
- Use functional and declarative programming patterns, avoid classes and mutable state.
821
- Use descriptive variable names with auxiliary verbs (e.g. `isPlaying`, `isPaused`, `hasError`).
922
- Structure files according to the conventions you see in the existing code.

package-lock.json

Lines changed: 2823 additions & 13627 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
@@ -55,7 +55,7 @@
5555
"7zip-bin-mac": "^1.0.1"
5656
},
5757
"engines": {
58-
"node": ">=20.0.0",
58+
"node": ">=22.0.0",
5959
"npm": ">=10.0.0"
6060
},
6161
"husky": {

packages/app/app/App.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ class App extends React.PureComponent {
9999
}
100100

101101
scrobbleLastFm() {
102-
const currentSong = this.props.queue.queueItems[
103-
this.props.queue.currentSong
102+
const currentTrack = this.props.queue.queueItems[
103+
this.props.queue.currentTrack
104104
];
105105
this.props.actions.updateNowPlayingAction(
106-
currentSong.artist,
107-
currentSong.name,
106+
currentTrack.artist,
107+
currentTrack.name,
108108
this.props.scrobbling.lastFmSessionKey
109109
);
110110
}
@@ -126,9 +126,9 @@ class App extends React.PureComponent {
126126
);
127127
}
128128

129-
getCurrentSongParameter(parameter) {
130-
return this.props.queue.queueItems[this.props.queue.currentSong]
131-
? this.props.queue.queueItems[this.props.queue.currentSong][parameter]
129+
getCurrentTrackParameter(parameter) {
130+
return this.props.queue.queueItems[this.props.queue.currentTrack]
131+
? this.props.queue.queueItems[this.props.queue.currentTrack][parameter]
132132
: null;
133133
}
134134

packages/app/app/actions/queue.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import StreamProviderPlugin from '@nuclear/core/src/plugins/streamProvider';
12
import { QueueItem } from '../reducers/queue';
23
import { Queue } from './actionTypes';
3-
import * as QueueOperations from './queue';
4+
import * as QueueActions from './queue';
45

56
describe('Queue actions tests', () => {
67

78
describe('finds streams for track', () => {
8-
const getSelectedStreamProvider = jest.spyOn(QueueOperations, 'getSelectedStreamProvider');
9-
const resolveTrackStreams = jest.spyOn(QueueOperations, 'resolveTrackStreams');
9+
const getSelectedStreamProvider = jest.spyOn(QueueActions, 'getSelectedStreamProvider');
10+
const resolveTrackStreams = jest.spyOn(QueueActions, 'resolveTrackStreams');
1011

1112
afterEach(() => {
1213
getSelectedStreamProvider.mockReset();
@@ -18,7 +19,7 @@ describe('Queue actions tests', () => {
1819
resolveTrackStreams.mockResolvedValueOnce([]);
1920

2021
// Configure a dummy stream provider. It is not actually used in this execution path.
21-
getSelectedStreamProvider.mockReturnValueOnce({});
22+
getSelectedStreamProvider.mockReturnValueOnce({} as StreamProviderPlugin);
2223

2324
// Set up the queue with an arbitrary track, which doesn't have any stream.
2425
const trackIndex = 123;
@@ -39,7 +40,7 @@ describe('Queue actions tests', () => {
3940
});
4041

4142
const dispatchOperation = jest.fn();
42-
const findStreamsForTrackOperation = QueueOperations.findStreamsForTrack(trackIndex);
43+
const findStreamsForTrackOperation = QueueActions.findStreamsForTrack(trackIndex, 'stream lookup error');
4344
findStreamsForTrackOperation(dispatchOperation, stateResolver)
4445
.then(() => {
4546
// The track without streams should have been removed from the queue.

0 commit comments

Comments
 (0)