mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
Publish: Make 'Channel' setting persistent.
## Issue
Users are annoyed with the constant reset of the 'channel' setting in the Publish page.
## Changes
1. Revert the previous attempt in ff7b4092
. The `usePersistedState` method is bad, as it will clash with the Redux value.
2. Implemented the persistence in Redux -- requires "https://github.com/lbryio/lbry-redux/pull/347".
This commit is contained in:
parent
b58c9709e2
commit
f3362c4e59
4 changed files with 4 additions and 19 deletions
|
@ -136,7 +136,7 @@
|
||||||
"imagesloaded": "^4.1.4",
|
"imagesloaded": "^4.1.4",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#7df96d47671308c09db0a28892dbbfd6486d81f4",
|
"lbry-redux": "lbryio/lbry-redux#05b949d470dd1f3436b45ab1e252c0dcc0ae9a3f",
|
||||||
"lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c",
|
"lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
|
|
@ -77,7 +77,6 @@ type Props = {
|
||||||
// Add back type
|
// Add back type
|
||||||
updatePublishForm: any => void,
|
updatePublishForm: any => void,
|
||||||
checkAvailability: string => void,
|
checkAvailability: string => void,
|
||||||
onChannelChange: string => void,
|
|
||||||
ytSignupPending: boolean,
|
ytSignupPending: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,7 +113,6 @@ function PublishForm(props: Props) {
|
||||||
publish,
|
publish,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
checkAvailability,
|
checkAvailability,
|
||||||
onChannelChange,
|
|
||||||
ytSignupPending,
|
ytSignupPending,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
@ -209,7 +207,6 @@ function PublishForm(props: Props) {
|
||||||
}, [name, channel, resolveUri, updatePublishForm, checkAvailability]);
|
}, [name, channel, resolveUri, updatePublishForm, checkAvailability]);
|
||||||
|
|
||||||
function handleChannelNameChange(channel) {
|
function handleChannelNameChange(channel) {
|
||||||
onChannelChange(channel);
|
|
||||||
updatePublishForm({ channel });
|
updatePublishForm({ channel });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import Page from 'component/page';
|
||||||
import Yrbl from 'component/yrbl';
|
import Yrbl from 'component/yrbl';
|
||||||
import LbcSymbol from 'component/common/lbc-symbol';
|
import LbcSymbol from 'component/common/lbc-symbol';
|
||||||
import RewardAuthIntro from 'component/rewardAuthIntro';
|
import RewardAuthIntro from 'component/rewardAuthIntro';
|
||||||
import usePersistedState from 'effects/use-persisted-state';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
balance: number,
|
balance: number,
|
||||||
|
@ -15,8 +14,6 @@ type Props = {
|
||||||
function PublishPage(props: Props) {
|
function PublishPage(props: Props) {
|
||||||
const { balance } = props;
|
const { balance } = props;
|
||||||
|
|
||||||
const [channel, setChannel] = usePersistedState('publish-channel', '');
|
|
||||||
|
|
||||||
function scrollToTop() {
|
function scrollToTop() {
|
||||||
const mainContent = document.querySelector('main');
|
const mainContent = document.querySelector('main');
|
||||||
if (mainContent) {
|
if (mainContent) {
|
||||||
|
@ -24,10 +21,6 @@ function PublishPage(props: Props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleChannelChange(channel) {
|
|
||||||
setChannel(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
{balance === 0 ? (
|
{balance === 0 ? (
|
||||||
|
@ -62,12 +55,7 @@ function PublishPage(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
) : (
|
) : (
|
||||||
<PublishForm
|
<PublishForm scrollToTop={scrollToTop} disabled={balance === 0} />
|
||||||
scrollToTop={scrollToTop}
|
|
||||||
disabled={balance === 0}
|
|
||||||
channel={channel}
|
|
||||||
onChannelChange={handleChannelChange}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|
|
@ -6413,9 +6413,9 @@ lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#7df96d47671308c09db0a28892dbbfd6486d81f4:
|
lbry-redux@lbryio/lbry-redux#05b949d470dd1f3436b45ab1e252c0dcc0ae9a3f:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/7df96d47671308c09db0a28892dbbfd6486d81f4"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/05b949d470dd1f3436b45ab1e252c0dcc0ae9a3f"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue