[Content] grab "Skip publish preview"

This commit is contained in:
infinite-persistence 2021-08-07 20:50:24 +08:00
parent f7caeba787
commit 2cda3d0a62
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
6 changed files with 16 additions and 49 deletions

View file

@ -1419,6 +1419,7 @@
"Transcode": "Transcode",
"Estimated transaction fee:": "Estimated transaction fee:",
"Est. transaction fee:": "Est. transaction fee:",
"Publish confirmation": "Publish confirmation",
"Skip preview and confirmation": "Skip preview and confirmation",
"Upload settings": "Upload settings",
"Currently Uploading": "Currently Uploading",

View file

@ -1,15 +0,0 @@
import { SETTINGS } from 'lbry-redux';
import { connect } from 'react-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doSetClientSetting } from 'redux/actions/settings';
import PublishSettings from './view';
const select = state => ({
enablePublishPreview: makeSelectClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW)(state),
});
const perform = dispatch => ({
setEnablePublishPreview: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW, value)),
});
export default connect(select, perform)(PublishSettings);

View file

@ -1,31 +0,0 @@
// @flow
import React from 'react';
import { FormField } from 'component/common/form';
import { withRouter } from 'react-router';
type Props = {
enablePublishPreview: boolean,
setEnablePublishPreview: boolean => void,
};
function PublishSettings(props: Props) {
const { enablePublishPreview, setEnablePublishPreview } = props;
function handleChange() {
setEnablePublishPreview(!enablePublishPreview);
}
return (
<div>
<FormField
type="checkbox"
name="sync_toggle"
label={__('Skip preview and confirmation')}
checked={!enablePublishPreview}
onChange={handleChange}
/>
</div>
);
}
export default withRouter(PublishSettings);

View file

@ -16,6 +16,7 @@ const select = (state) => ({
myChannelUrls: selectMyChannelUrls(state),
instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
enablePublishPreview: makeSelectClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW)(state),
});
const perform = (dispatch) => ({

View file

@ -18,6 +18,7 @@ type Price = {
};
type Props = {
// --- select ---
isAuthenticated: boolean,
floatingPlayer: boolean,
autoplay: boolean,
@ -26,6 +27,8 @@ type Props = {
myChannelUrls: ?Array<string>,
instantPurchaseEnabled: boolean,
instantPurchaseMax: Price,
enablePublishPreview: boolean,
// --- perform ---
setClientSetting: (string, boolean | string | number) => void,
clearPlayingUri: () => void,
openModal: (string) => void,
@ -41,6 +44,7 @@ export default function SettingContent(props: Props) {
myChannelUrls,
instantPurchaseEnabled,
instantPurchaseMax,
enablePublishPreview,
setClientSetting,
clearPlayingUri,
openModal,
@ -149,6 +153,16 @@ export default function SettingContent(props: Props) {
</>
)}
<SettingsRow title={__('Publish confirmation')} subtitle={__('Skip preview and confirmation')}>
<FormField
type="checkbox"
name="sync_toggle"
label={__('')}
checked={!enablePublishPreview}
onChange={() => setClientSetting(SETTINGS.ENABLE_PUBLISH_PREVIEW, !enablePublishPreview)}
/>
</SettingsRow>
{/* @if TARGET='app' */}
<SettingsRow title={__('Max purchase price')} subtitle={__(HELP_MAX_PURCHASE_PRICE)} useVerticalSeparator>
<MaxPurchasePrice />

View file

@ -12,7 +12,6 @@ import { SETTINGS } from 'lbry-redux';
import Card from 'component/common/card';
import { getPasswordFromCookie } from 'util/saved-passwords';
import Spinner from 'component/spinner';
import PublishSettings from 'component/publishSettings';
type Price = {
currency: string,
@ -360,8 +359,6 @@ class SettingsAdvancedPage extends React.PureComponent<Props, State> {
{/* @if TARGET='app' */}
<Card title={__('Comments server')} actions={<SettingCommentsServer />} />
{/* @endif */}
<Card title={__('Upload settings')} actions={<PublishSettings />} />
</div>
)}
</Page>