This commit is contained in:
Feross Aboukhadijeh
2019-08-14 16:29:25 -07:00
parent 0c1d7d6e0f
commit 85c6816c23
13 changed files with 92 additions and 46 deletions

View File

@@ -10,19 +10,22 @@ class Header extends React.Component {
className='header' className='header'
onMouseMove={dispatcher('mediaMouseMoved')} onMouseMove={dispatcher('mediaMouseMoved')}
onMouseEnter={dispatcher('mediaControlsMouseEnter')} onMouseEnter={dispatcher('mediaControlsMouseEnter')}
onMouseLeave={dispatcher('mediaControlsMouseLeave')}> onMouseLeave={dispatcher('mediaControlsMouseLeave')}
>
{this.getTitle()} {this.getTitle()}
<div className='nav left float-left'> <div className='nav left float-left'>
<i <i
className={'icon back ' + (loc.hasBack() ? '' : 'disabled')} className={'icon back ' + (loc.hasBack() ? '' : 'disabled')}
title='Back' title='Back'
onClick={dispatcher('back')}> onClick={dispatcher('back')}
>
chevron_left chevron_left
</i> </i>
<i <i
className={'icon forward ' + (loc.hasForward() ? '' : 'disabled')} className={'icon forward ' + (loc.hasForward() ? '' : 'disabled')}
title='Forward' title='Forward'
onClick={dispatcher('forward')}> onClick={dispatcher('forward')}
>
chevron_right chevron_right
</i> </i>
</div> </div>
@@ -46,7 +49,8 @@ class Header extends React.Component {
<i <i
className='icon add' className='icon add'
title='Add torrent' title='Add torrent'
onClick={dispatcher('openFiles')}> onClick={dispatcher('openFiles')}
>
add add
</i> </i>
) )

View File

@@ -12,13 +12,15 @@ module.exports = class ModalOKCancel extends React.Component {
className='control cancel' className='control cancel'
style={cancelStyle} style={cancelStyle}
label={cancelText} label={cancelText}
onClick={onCancel} /> onClick={onCancel}
/>
<RaisedButton <RaisedButton
className='control ok' className='control ok'
primary primary
label={okText} label={okText}
onClick={onOK} onClick={onOK}
autoFocus /> autoFocus
/>
</div> </div>
) )
} }

View File

@@ -15,13 +15,15 @@ module.exports = class OpenTorrentAddressModal extends React.Component {
className='control' className='control'
ref={(c) => { this.torrentURL = c }} ref={(c) => { this.torrentURL = c }}
fullWidth fullWidth
onKeyDown={handleKeyDown.bind(this)} /> onKeyDown={handleKeyDown.bind(this)}
/>
</div> </div>
<ModalOKCancel <ModalOKCancel
cancelText='CANCEL' cancelText='CANCEL'
onCancel={dispatcher('exitModal')} onCancel={dispatcher('exitModal')}
okText='OK' okText='OK'
onOK={handleOK.bind(this)} /> onOK={handleOK.bind(this)}
/>
</div> </div>
) )
} }

View File

@@ -78,10 +78,12 @@ class PathSelector extends React.Component {
</div> </div>
<TextField <TextField
className='control' disabled id={id} value={text} className='control' disabled id={id} value={text}
inputStyle={textareaStyle} style={textFieldStyle} /> inputStyle={textareaStyle} style={textFieldStyle}
/>
<RaisedButton <RaisedButton
className='control' label='Change' onClick={this.handleClick} className='control' label='Change' onClick={this.handleClick}
style={buttonStyle} /> style={buttonStyle}
/>
</div> </div>
) )
} }

View File

@@ -18,7 +18,8 @@ module.exports = class RemoveTorrentModal extends React.Component {
cancelText='CANCEL' cancelText='CANCEL'
onCancel={dispatcher('exitModal')} onCancel={dispatcher('exitModal')}
okText={buttonText} okText={buttonText}
onOK={handleRemove} /> onOK={handleRemove}
/>
</div> </div>
) )

View File

@@ -45,7 +45,8 @@ class ShowMore extends React.Component {
<RaisedButton <RaisedButton
className='control' className='control'
onClick={this.handleClick} onClick={this.handleClick}
label={label} /> label={label}
/>
</div> </div>
) )
} }

View File

@@ -28,7 +28,8 @@ module.exports = class UnsupportedMediaModal extends React.Component {
cancelText='CANCEL' cancelText='CANCEL'
onCancel={dispatcher('backToList')} onCancel={dispatcher('backToList')}
okText={actionText} okText={actionText}
onOK={onAction} /> onOK={onAction}
/>
<p className='error-text'>{errorMessage}</p> <p className='error-text'>{errorMessage}</p>
</div> </div>
) )

View File

@@ -18,7 +18,8 @@ module.exports = class UpdateAvailableModal extends React.Component {
cancelText='SKIP THIS RELEASE' cancelText='SKIP THIS RELEASE'
onCancel={handleSkip} onCancel={handleSkip}
okText='SHOW DOWNLOAD PAGE' okText='SHOW DOWNLOAD PAGE'
onOK={handleShow} /> onOK={handleShow}
/>
</div> </div>
) )

View File

@@ -90,7 +90,8 @@ class App extends React.Component {
return ( return (
<div <div
key='errors' key='errors'
className={'error-popover ' + (hasErrors ? 'visible' : 'hidden')}> className={'error-popover ' + (hasErrors ? 'visible' : 'hidden')}
>
<div key='title' className='title'>Error</div> <div key='title' className='title'>Error</div>
{errorElems} {errorElems}
</div> </div>

View File

@@ -94,7 +94,8 @@ class CreateTorrentPage extends React.Component {
marginBottom: 10 marginBottom: 10
}} }}
hideLabel='Hide advanced settings...' hideLabel='Hide advanced settings...'
showLabel='Show advanced settings...'> showLabel='Show advanced settings...'
>
{this.renderAdvanced()} {this.renderAdvanced()}
</ShowMore> </ShowMore>
<div className='float-right'> <div className='float-right'>
@@ -104,12 +105,14 @@ class CreateTorrentPage extends React.Component {
style={{ style={{
marginRight: 10 marginRight: 10
}} }}
onClick={dispatcher('cancel')} /> onClick={dispatcher('cancel')}
/>
<RaisedButton <RaisedButton
className='control create-torrent-button' className='control create-torrent-button'
label='Create Torrent' label='Create Torrent'
primary primary
onClick={this.handleSubmit} /> onClick={this.handleSubmit}
/>
</div> </div>
</div> </div>
) )
@@ -143,7 +146,8 @@ class CreateTorrentPage extends React.Component {
className='torrent-is-private control' className='torrent-is-private control'
style={{ display: '' }} style={{ display: '' }}
checked={this.state.isPrivate} checked={this.state.isPrivate}
onCheck={this.setIsPrivate} /> onCheck={this.setIsPrivate}
/>
</div> </div>
<div key='trackers' className='torrent-attribute'> <div key='trackers' className='torrent-attribute'>
<label>Trackers:</label> <label>Trackers:</label>
@@ -155,7 +159,8 @@ class CreateTorrentPage extends React.Component {
rows={2} rows={2}
rowsMax={10} rowsMax={10}
value={this.state.trackers} value={this.state.trackers}
onChange={this.setTrackers} /> onChange={this.setTrackers}
/>
</div> </div>
<div key='comment' className='torrent-attribute'> <div key='comment' className='torrent-attribute'>
<label>Comment:</label> <label>Comment:</label>
@@ -168,7 +173,8 @@ class CreateTorrentPage extends React.Component {
rows={2} rows={2}
rowsMax={10} rowsMax={10}
value={this.state.comment} value={this.state.comment}
onChange={this.setComment} /> onChange={this.setComment}
/>
</div> </div>
<div key='files' className='torrent-attribute'> <div key='files' className='torrent-attribute'>
<label>Files:</label> <label>Files:</label>

View File

@@ -22,7 +22,8 @@ module.exports = class Player extends React.Component {
<div <div
className='player' className='player'
onWheel={handleVolumeWheel} onWheel={handleVolumeWheel}
onMouseMove={dispatcher('mediaMouseMoved')}> onMouseMove={dispatcher('mediaMouseMoved')}
>
{showVideo ? renderMedia(state) : renderCastScreen(state)} {showVideo ? renderMedia(state) : renderCastScreen(state)}
{showControls ? renderPlayerControls(state) : null} {showControls ? renderPlayerControls(state) : null}
</div> </div>
@@ -112,7 +113,8 @@ function renderMedia (state) {
default={isSelected ? 'default' : ''} default={isSelected ? 'default' : ''}
label={track.label} label={track.label}
type='subtitles' type='subtitles'
src={track.buffer} /> src={track.buffer}
/>
) )
} }
} }
@@ -140,7 +142,8 @@ function renderMedia (state) {
<div <div
key='letterbox' key='letterbox'
className='letterbox' className='letterbox'
onMouseMove={dispatcher('mediaMouseMoved')}> onMouseMove={dispatcher('mediaMouseMoved')}
>
{mediaTag} {mediaTag}
{renderOverlay(state)} {renderOverlay(state)}
</div> </div>
@@ -490,41 +493,47 @@ function renderPlayerControls (state) {
<div <div
key='cursor' key='cursor'
className='playback-cursor' className='playback-cursor'
style={playbackCursorStyle} /> style={playbackCursorStyle}
/>
<div <div
key='scrub-bar' key='scrub-bar'
className='scrub-bar' className='scrub-bar'
draggable='true' draggable='true'
onDragStart={handleDragStart} onDragStart={handleDragStart}
onClick={handleScrub} onClick={handleScrub}
onDrag={handleScrub} /> onDrag={handleScrub}
/>
</div>, </div>,
<i <i
key='skip-previous' key='skip-previous'
className={'icon skip-previous float-left ' + prevClass} className={'icon skip-previous float-left ' + prevClass}
onClick={dispatcher('previousTrack')}> onClick={dispatcher('previousTrack')}
>
skip_previous skip_previous
</i>, </i>,
<i <i
key='play' key='play'
className='icon play-pause float-left' className='icon play-pause float-left'
onClick={dispatcher('playPause')}> onClick={dispatcher('playPause')}
>
{state.playing.isPaused ? 'play_arrow' : 'pause'} {state.playing.isPaused ? 'play_arrow' : 'pause'}
</i>, </i>,
<i <i
key='skip-next' key='skip-next'
className={'icon skip-next float-left ' + nextClass} className={'icon skip-next float-left ' + nextClass}
onClick={dispatcher('nextTrack')}> onClick={dispatcher('nextTrack')}
>
skip_next skip_next
</i>, </i>,
<i <i
key='fullscreen' key='fullscreen'
className='icon fullscreen float-right' className='icon fullscreen float-right'
onClick={dispatcher('toggleFullScreen')}> onClick={dispatcher('toggleFullScreen')}
>
{state.window.isFullScreen ? 'fullscreen_exit' : 'fullscreen'} {state.window.isFullScreen ? 'fullscreen_exit' : 'fullscreen'}
</i> </i>
] ]
@@ -535,7 +544,8 @@ function renderPlayerControls (state) {
<i <i
key='subtitles' key='subtitles'
className={'icon closed-caption float-right ' + captionsClass} className={'icon closed-caption float-right ' + captionsClass}
onClick={handleSubtitles}> onClick={handleSubtitles}
>
closed_caption closed_caption
</i> </i>
)) ))
@@ -579,7 +589,8 @@ function renderPlayerControls (state) {
<i <i
key={castType} key={castType}
className={'icon device float-right ' + buttonClass} className={'icon device float-right ' + buttonClass}
onClick={buttonHandler}> onClick={buttonHandler}
>
{buttonIcon} {buttonIcon}
</i> </i>
)) ))
@@ -602,7 +613,8 @@ function renderPlayerControls (state) {
<div key='volume' className='volume float-left'> <div key='volume' className='volume float-left'>
<i <i
className='icon volume-icon float-left' className='icon volume-icon float-left'
onMouseDown={handleVolumeMute}> onMouseDown={handleVolumeMute}
>
{volumeIcon} {volumeIcon}
</i> </i>
<input <input
@@ -610,7 +622,8 @@ function renderPlayerControls (state) {
type='range' min='0' max='1' step='0.05' type='range' min='0' max='1' step='0.05'
value={volume} value={volume}
onChange={handleVolumeScrub} onChange={handleVolumeScrub}
style={volumeStyle} /> style={volumeStyle}
/>
</div> </div>
)) ))
@@ -636,7 +649,8 @@ function renderPlayerControls (state) {
<div <div
key='controls' className='controls' key='controls' className='controls'
onMouseEnter={dispatcher('mediaControlsMouseEnter')} onMouseEnter={dispatcher('mediaControlsMouseEnter')}
onMouseLeave={dispatcher('mediaControlsMouseLeave')}> onMouseLeave={dispatcher('mediaControlsMouseLeave')}
>
{elements} {elements}
{renderCastOptions(state)} {renderCastOptions(state)}
{renderSubtitleOptions(state)} {renderSubtitleOptions(state)}

View File

@@ -41,7 +41,8 @@ class PreferencesPage extends React.Component {
}} }}
onChange={this.handleDownloadPathChange} onChange={this.handleDownloadPathChange}
title='Download location' title='Download location'
value={this.props.state.saved.prefs.downloadPath} /> value={this.props.state.saved.prefs.downloadPath}
/>
</Preference> </Preference>
) )
} }
@@ -57,7 +58,8 @@ class PreferencesPage extends React.Component {
className='control' className='control'
checked={!this.props.state.saved.prefs.openExternalPlayer} checked={!this.props.state.saved.prefs.openExternalPlayer}
label={'Play torrent media files using WebTorrent'} label={'Play torrent media files using WebTorrent'}
onCheck={this.handleOpenExternalPlayerChange} /> onCheck={this.handleOpenExternalPlayerChange}
/>
</Preference> </Preference>
) )
} }
@@ -103,7 +105,8 @@ class PreferencesPage extends React.Component {
displayValue={playerName} displayValue={playerName}
onChange={this.handleExternalPlayerPathChange} onChange={this.handleExternalPlayerPathChange}
title='External player' title='External player'
value={playerPath ? path.dirname(playerPath) : null} /> value={playerPath ? path.dirname(playerPath) : null}
/>
</Preference> </Preference>
) )
} }
@@ -156,7 +159,8 @@ class PreferencesPage extends React.Component {
displayValue={torrentsFolderPath || ''} displayValue={torrentsFolderPath || ''}
onChange={this.handletorrentsFolderPathChange} onChange={this.handletorrentsFolderPathChange}
title='Folder to watch' title='Folder to watch'
value={torrentsFolderPath ? path.dirname(torrentsFolderPath) : null} /> value={torrentsFolderPath ? path.dirname(torrentsFolderPath) : null}
/>
</Preference> </Preference>
) )
} }
@@ -180,7 +184,8 @@ class PreferencesPage extends React.Component {
<RaisedButton <RaisedButton
className='control' className='control'
onClick={this.handleSetDefaultApp} onClick={this.handleSetDefaultApp}
label='Make WebTorrent the default' /> label='Make WebTorrent the default'
/>
</Preference> </Preference>
) )
} }
@@ -213,7 +218,8 @@ class PreferencesPage extends React.Component {
className='control' className='control'
checked={this.props.state.saved.prefs.soundNotifications} checked={this.props.state.saved.prefs.soundNotifications}
label={'Enable sounds'} label={'Enable sounds'}
onCheck={this.handleSoundNotificationsChange} /> onCheck={this.handleSoundNotificationsChange}
/>
</Preference> </Preference>
) )
} }

View File

@@ -67,7 +67,8 @@ module.exports = class TorrentList extends React.Component {
style={style} style={style}
className={classes.join(' ')} className={classes.join(' ')}
onContextMenu={infoHash && dispatcher('openTorrentContextMenu', infoHash)} onContextMenu={infoHash && dispatcher('openTorrentContextMenu', infoHash)}
onClick={infoHash && dispatcher('toggleSelectTorrent', infoHash)}> onClick={infoHash && dispatcher('toggleSelectTorrent', infoHash)}
>
{this.renderTorrentMetadata(torrentSummary)} {this.renderTorrentMetadata(torrentSummary)}
{infoHash ? this.renderTorrentButtons(torrentSummary) : null} {infoHash ? this.renderTorrentButtons(torrentSummary) : null}
{isSelected ? this.renderTorrentDetails(torrentSummary) : null} {isSelected ? this.renderTorrentDetails(torrentSummary) : null}
@@ -130,7 +131,8 @@ module.exports = class TorrentList extends React.Component {
}} }}
checked={isActive} checked={isActive}
onClick={stopPropagation} onClick={stopPropagation}
onCheck={dispatcher('toggleTorrent', infoHash)} /> onCheck={dispatcher('toggleTorrent', infoHash)}
/>
) )
} }
@@ -233,7 +235,8 @@ module.exports = class TorrentList extends React.Component {
key='play-button' key='play-button'
title='Start streaming' title='Start streaming'
className={'icon play'} className={'icon play'}
onClick={dispatcher('playFile', infoHash)}> onClick={dispatcher('playFile', infoHash)}
>
play_circle_outline play_circle_outline
</i> </i>
) )
@@ -246,7 +249,8 @@ module.exports = class TorrentList extends React.Component {
key='delete-button' key='delete-button'
className='icon delete' className='icon delete'
title='Remove torrent' title='Remove torrent'
onClick={dispatcher('confirmDeleteTorrent', infoHash, false)}> onClick={dispatcher('confirmDeleteTorrent', infoHash, false)}
>
close close
</i> </i>
</div> </div>
@@ -357,7 +361,8 @@ module.exports = class TorrentList extends React.Component {
</td> </td>
<td <td
className='col-select' className='col-select'
onClick={dispatcher('toggleTorrentFile', infoHash, index)}> onClick={dispatcher('toggleTorrentFile', infoHash, index)}
>
<i className='icon deselect-file'>{isSelected ? 'close' : 'add'}</i> <i className='icon deselect-file'>{isSelected ? 'close' : 'add'}</i>
</td> </td>
</tr> </tr>