From 62f2a7699894e551bb92af99222e9150ff365d4b Mon Sep 17 00:00:00 2001 From: Mosh Feu Date: Fri, 14 Dec 2018 22:25:33 +0200 Subject: [PATCH] refactor --- src/components/about-modal/about-modal.tsx | 2 +- src/components/about-modal/index.ts | 2 +- src/components/button-progress/button-progress.driver.tsx | 2 +- src/components/button-progress/button-progress.tsx | 2 +- src/components/button-progress/index.ts | 2 +- src/components/main.tsx | 7 ++++--- src/components/video.tsx | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/about-modal/about-modal.tsx b/src/components/about-modal/about-modal.tsx index d9d47de..3175e04 100644 --- a/src/components/about-modal/about-modal.tsx +++ b/src/components/about-modal/about-modal.tsx @@ -10,7 +10,7 @@ interface IAboutModalProps { onClose: () => void; } -export default class AboutModal extends React.Component { +export class AboutModal extends React.Component { render() { const { open, onClose } = this.props; return ( diff --git a/src/components/about-modal/index.ts b/src/components/about-modal/index.ts index 1182609..971564a 100644 --- a/src/components/about-modal/index.ts +++ b/src/components/about-modal/index.ts @@ -1 +1 @@ -export {default} from './about-modal'; \ No newline at end of file +export { AboutModal } from './about-modal'; \ No newline at end of file diff --git a/src/components/button-progress/button-progress.driver.tsx b/src/components/button-progress/button-progress.driver.tsx index eef2efa..a609950 100644 --- a/src/components/button-progress/button-progress.driver.tsx +++ b/src/components/button-progress/button-progress.driver.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { SinonSpy } from 'sinon'; import { shallow } from 'enzyme'; import BaseDriver from '../../../test/base.driver'; -import ButtonProgress, { IButtonProgressProps } from './button-progress'; +import { ButtonProgress, IButtonProgressProps } from './button-progress'; export default class ButtonProgressDriver extends BaseDriver { private text: string; diff --git a/src/components/button-progress/button-progress.tsx b/src/components/button-progress/button-progress.tsx index e1f4616..b9c1762 100644 --- a/src/components/button-progress/button-progress.tsx +++ b/src/components/button-progress/button-progress.tsx @@ -14,7 +14,7 @@ export interface IButtonProgressState { progress: number; } -export default class ButtonProgress extends React.Component { +export class ButtonProgress extends React.Component { private readonly progressDone = 100; constructor(props) { diff --git a/src/components/button-progress/index.ts b/src/components/button-progress/index.ts index f171bd9..b5d77ba 100644 --- a/src/components/button-progress/index.ts +++ b/src/components/button-progress/index.ts @@ -1 +1 @@ -export {default} from './button-progress'; \ No newline at end of file +export {ButtonProgress} from './button-progress'; \ No newline at end of file diff --git a/src/components/main.tsx b/src/components/main.tsx index 2e52b72..632f11b 100644 --- a/src/components/main.tsx +++ b/src/components/main.tsx @@ -8,10 +8,10 @@ import { Video } from './video'; import { IVideoTask } from 'youtube-mp3-downloader'; import { isFFMpegInstalled } from '../services/ffmpeg-installer'; import { Form } from './form'; -import ButtonProgress from './button-progress'; +import { ButtonProgress } from './button-progress'; import { InstallFFMpeg } from './install-ffmpeg'; import { ipcRenderer } from '../services/electron-adapter'; -import AboutModal from './about-modal'; +import { AboutModal } from './about-modal'; interface IMainState { videos: IVideoEntity[]; @@ -48,6 +48,7 @@ class Main extends React.Component<{}, IMainState> { const videos = await fetchVideos(terms); this.setState({videos, inProcess: false}); } + videoIndex = (videoId: string) => { return this.state.videos.findIndex(v => v.id === videoId); } @@ -112,7 +113,7 @@ class Main extends React.Component<{}, IMainState> { } } - error = (err, data) => { + error = (err) => { alert(err); } diff --git a/src/components/video.tsx b/src/components/video.tsx index 00a62c5..1981980 100644 --- a/src/components/video.tsx +++ b/src/components/video.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { IVideoEntity, EVideoStatus } from '../types'; -import ButtonProgress from './button-progress'; +import { ButtonProgress } from './button-progress'; interface IVideoProps { style?: React.CSSProperties,