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