wip publish page
This commit is contained in:
parent
179f758f4d
commit
82658618d0
2 changed files with 23 additions and 18 deletions
|
@ -1,6 +1,9 @@
|
|||
// @flow
|
||||
import * as React from 'react';
|
||||
// @if TARGET='app'
|
||||
// $FlowFixMe
|
||||
import { remote } from 'electron';
|
||||
// @endif
|
||||
import Button from 'component/button';
|
||||
import { FormField } from 'component/common/form';
|
||||
import path from 'path';
|
||||
|
@ -26,7 +29,7 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
type: 'file',
|
||||
};
|
||||
|
||||
fileInput: { current: React.ElementRef<any> };
|
||||
fileInput: React.ElementRef<any>;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -61,19 +64,19 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
// TODO: Add this back for web publishing
|
||||
// handleFileInputSelection() {
|
||||
// const { files } = this.fileInput.current;
|
||||
// if (!files) {
|
||||
// return;
|
||||
// }
|
||||
handleFileInputSelection() {
|
||||
const { files } = this.fileInput.current;
|
||||
if (!files) {
|
||||
return;
|
||||
}
|
||||
|
||||
// const filePath = files[0];
|
||||
// const fileName = filePath.name;
|
||||
const filePath = files[0];
|
||||
const fileName = filePath.name;
|
||||
|
||||
// if (this.props.onFileChosen) {
|
||||
// this.props.onFileChosen(filePath, fileName);
|
||||
// }
|
||||
// }
|
||||
if (this.props.onFileChosen) {
|
||||
this.props.onFileChosen(filePath, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
input: ?HTMLInputElement;
|
||||
|
||||
|
@ -84,6 +87,7 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
|
||||
return (
|
||||
<React.Fragment>
|
||||
{/* @if TARGET='app' */}
|
||||
<FormField
|
||||
label={label}
|
||||
webkitdirectory="true"
|
||||
|
@ -91,12 +95,16 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
type="text"
|
||||
ref={this.fileInput}
|
||||
onFocus={() => {
|
||||
if (this.fileInput) this.fileInput.current.select();
|
||||
if (this.fileInput) this.fileInput.select();
|
||||
}}
|
||||
readOnly="readonly"
|
||||
value={currentPath || placeholder || __('Choose a file')}
|
||||
inputButton={<Button button="primary" label={buttonLabel} onClick={() => this.handleButtonClick()} />}
|
||||
inputButton={<Button button="primary" onClick={() => this.handleButtonClick()} label={buttonLabel} />}
|
||||
/>
|
||||
{/* @endif */}
|
||||
{/* @if TARGET='web' */}
|
||||
<input type="file" ref={this.fileInput} onChange={() => this.handleFileInputSelection()} />
|
||||
{/* @endif */}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import { buildURI, isURIValid, isNameValid, THUMBNAIL_STATUSES } from 'lbry-redu
|
|||
import Button from 'component/button';
|
||||
import ChannelSection from 'component/selectChannel';
|
||||
import classnames from 'classnames';
|
||||
import UnsupportedOnWeb from 'component/common/unsupported-on-web';
|
||||
import TagsSelect from 'component/tagsSelect';
|
||||
import PublishText from 'component/publishText';
|
||||
import PublishPrice from 'component/publishPrice';
|
||||
|
@ -123,9 +122,7 @@ function PublishForm(props: Props) {
|
|||
|
||||
return (
|
||||
<Fragment>
|
||||
<UnsupportedOnWeb />
|
||||
|
||||
<PublishFile disabled={formDisabled} />
|
||||
<PublishFile disabled={formDisabled}/>
|
||||
<div className={classnames({ 'card--disabled': formDisabled })}>
|
||||
<PublishText disabled={formDisabled} />
|
||||
<Card actions={<SelectThumbnail />} />
|
||||
|
|
Loading…
Add table
Reference in a new issue