Skip to content

Commit

Permalink
Convert QueuePopupContainer to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Dec 4, 2024
1 parent cc05f6e commit 4ce5b97
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion packages/app/app/components/PlayQueue/QueuePopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as QueueActions from '../../../actions/queue';
import styles from './styles.scss';
import { PluginsState } from '../../../reducers/plugins';

type QueuePopupProps = {
export type QueuePopupProps = {
trigger: React.ReactNode;
isQueueItemCompact: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ describe('Play Queue container', () => {
setupI18Next();
});

beforeEach(() => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { store } = require('@nuclear/core');
beforeEach(async () => {
const { store } = await import('@nuclear/core');
store.clear();
});

Expand Down
26 changes: 0 additions & 26 deletions packages/app/app/containers/QueuePopupContainer/index.js

This file was deleted.

26 changes: 26 additions & 0 deletions packages/app/app/containers/QueuePopupContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { clipboard } from 'electron';
import * as QueueActions from '../../actions/queue';
import QueuePopup, { QueuePopupProps } from '../../components/PlayQueue/QueuePopup';
import { RootState } from '../../reducers';
import { bindActionCreators } from 'redux';

type QueuePopupContainerProps = Omit<QueuePopupProps, 'plugins' | 'actions' | 'copyToClipboard'>;

const QueuePopupContainer: React.FC<QueuePopupContainerProps> = (props) => {
const dispatch = useDispatch();
const plugins = useSelector((state: RootState) => state.plugin);

const copyToClipboard = (text: string) => {
if (text?.length) {
clipboard.writeText(text);
}
};

const actions = React.useMemo(() => bindActionCreators(QueueActions, dispatch), [dispatch]);

return <QueuePopup plugins={plugins} actions={actions} copyToClipboard={copyToClipboard} {...props} />;
};

export default QueuePopupContainer;

0 comments on commit 4ce5b97

Please sign in to comment.