From f39449b46c8d1039ba9cb24497fccb02150f434b Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 26 Jul 2019 07:45:20 -0700 Subject: [PATCH] Refactor to functional component, and remove unused dispatch prop --- js/components/MainWindow/index.tsx | 199 ++++++++++++++--------------- 1 file changed, 95 insertions(+), 104 deletions(-) diff --git a/js/components/MainWindow/index.tsx b/js/components/MainWindow/index.tsx index 79c24307..32225c09 100644 --- a/js/components/MainWindow/index.tsx +++ b/js/components/MainWindow/index.tsx @@ -2,12 +2,7 @@ import React from "react"; import { connect } from "react-redux"; import classnames from "classnames"; import { WINDOWS, MEDIA_STATUS, LOAD_STYLE } from "../../constants"; -import { - loadFilesFromReferences, - toggleMainWindowShadeMode, - scrollVolume, - loadMedia, -} from "../../actionCreators"; +import * as Actions from "../../actionCreators"; import { getWindowShade } from "../../selectors"; import DropTarget from "../DropTarget"; @@ -57,7 +52,6 @@ interface StateProps { } interface DispatchProps { - loadFilesFromReferences(files: FileList): void; scrollVolume(e: React.WheelEvent): void; toggleMainWindowShadeMode(): void; loadMedia(e: React.DragEvent): void; @@ -70,102 +64,100 @@ interface OwnProps { type Props = StateProps & DispatchProps & OwnProps; -export class MainWindow extends React.Component { - render() { - const { - focused, - loading, - doubled, - mainShade, - llama, - status, - working, - filePickers, - } = this.props; +const MainWindow = (props: Props) => { + const { + focused, + loading, + doubled, + mainShade, + llama, + status, + working, + filePickers, + } = props; - const className = classnames({ - window: true, - play: status === MEDIA_STATUS.PLAYING, - stop: status === MEDIA_STATUS.STOPPED, - pause: status === MEDIA_STATUS.PAUSED, - selected: focused === WINDOWS.MAIN, - shade: mainShade, - draggable: true, - loading, - doubled, - llama, - }); + const className = classnames({ + window: true, + play: status === MEDIA_STATUS.PLAYING, + stop: status === MEDIA_STATUS.STOPPED, + pause: status === MEDIA_STATUS.PAUSED, + selected: focused === WINDOWS.MAIN, + shade: mainShade, + draggable: true, + loading, + doubled, + llama, + }); - return ( - - - -