This commit is contained in:
Sean Yesmunt 2019-10-02 18:05:41 -04:00
parent 4e7a8f1be5
commit 54c09edec8
15 changed files with 98 additions and 43 deletions

View file

@ -128,8 +128,8 @@
"husky": "^0.14.3",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#973d28e46290c77f2d9d468304008f80f71fd8cd",
"lbryinc": "lbryio/lbryinc#7c94a38683344262fe34773dc50bfbe6d2a9e116",
"lbry-redux": "lbryio/lbry-redux#74f55ba9e3b81b5364788a8cbdd89bd2884d40d0",
"lbryinc": "lbryio/lbryinc#5aba3127c879f5aaa9b1eccaf57aae97449df183",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",
"lodash-es": "^4.17.14",

View file

@ -186,6 +186,7 @@ function ChannelForm(props: Props) {
suggestMature
help={__('The better your tags are, the easier it will be for people to discover your channel.')}
empty={__('No tags added')}
placeholder={__('Add a tag')}
onSelect={newTag => {
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
setParams({ ...params, tags: [...params.tags, newTag] });

View file

@ -78,7 +78,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
properties,
onClick,
} = props;
const shouldFetch = claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta));
const shouldFetch =
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
const abandoned = !isResolvingUri && !claim;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
const showPublishLink = abandoned && placeholder === 'publish';

View file

@ -37,7 +37,7 @@ class InviteList extends React.PureComponent<Props> {
return (
<section className="card">
<div className="table__header">
<h2 className="card__title">
<h2 className="card__title--between">
{__('Invite History')}
{referralReward && showClaimable && (
<RewardLink

View file

@ -34,7 +34,9 @@ function PublishFile(props: Props) {
icon={ICONS.PUBLISH}
disabled={disabled || balance === 0}
title={isStillEditing ? __('Edit') : __('Publish')}
subtitle={isStillEditing ? __('You are currently editing a claim.') : __('Jeremy please change this.')}
subtitle={
isStillEditing ? __('You are currently editing a claim.') : __('Publish something totally wacky and wild.')
}
actions={
<React.Fragment>
<FileSelector currentPath={filePath} onFileChosen={handleFileChange} />

View file

@ -135,6 +135,7 @@ function PublishForm(props: Props) {
suggestMature
help={__('The better your tags are, the easier it will be for people to discover your content.')}
empty={__('No tags added')}
placeholder={__('Add a tag')}
onSelect={newTag => {
if (!tags.map(savedTag => savedTag.name).includes(newTag.name)) {
updatePublishForm({ tags: [...tags, newTag] });

View file

@ -3,7 +3,7 @@ import React from 'react';
import { Form, FormField } from 'component/common/form';
import Button from 'component/button';
import Card from 'component/common/card';
import { setSavedPassword } from 'util/saved-passwords';
import { setSavedPassword, deleteSavedPassword } from 'util/saved-passwords';
type Props = {
getSync: (?string) => void,
@ -18,6 +18,8 @@ function SyncPassword(props: Props) {
function handleSubmit() {
if (rememberPassword) {
setSavedPassword(password);
} else {
deleteSavedPassword();
}
getSync(password);

View file

@ -12,9 +12,10 @@ type Props = {
onSelect?: Tag => void,
suggestMature?: boolean,
onRemove: Tag => void,
placeholder?: string,
};
export default function TagSelect(props: Props) {
export default function TagsSearch(props: Props) {
const {
tagsPasssedIn,
unfollowedTags = [],
@ -24,6 +25,7 @@ export default function TagSelect(props: Props) {
onSelect,
onRemove,
suggestMature,
placeholder,
} = props;
const [newTag, setNewTag] = useState('');
@ -96,7 +98,7 @@ export default function TagSelect(props: Props) {
autoFocus
className="tag__input"
onChange={onChange}
placeholder={__('Follow more tags')}
placeholder={placeholder || __('Follow more tags')}
type="text"
value={newTag}
/>

View file

@ -20,6 +20,7 @@ type Props = {
tagsChosen?: Array<Tag>,
onSelect?: Tag => void,
onRemove?: Tag => void,
placeholder?: string,
};
export default function TagSelect(props: Props) {
@ -33,6 +34,7 @@ export default function TagSelect(props: Props) {
onSelect,
onRemove,
suggestMature,
placeholder,
} = props;
const [hasClosed, setHasClosed] = usePersistedState('tag-select:has-closed', false);
const tagsToDisplay = tagsChosen || followedTags;
@ -88,6 +90,7 @@ export default function TagSelect(props: Props) {
onSelect={onSelect}
suggestMature={suggestMature && !hasMatureTag}
tagsPasssedIn={tagsToDisplay}
placeholder={placeholder}
/>
</React.Fragment>
}

View file

@ -5,6 +5,7 @@ import Button from 'component/button';
import { Lbryio } from 'lbryinc';
import analytics from 'analytics';
import { EMAIL_REGEX } from 'constants/email';
import I18nMessage from 'component/i18nMessage';
type Props = {
errorMessage: ?string,
@ -18,6 +19,7 @@ type Props = {
function UserEmailNew(props: Props) {
const { errorMessage, isPending, addUserEmail, syncEnabled, setSync, balance } = props;
const [newEmail, setEmail] = useState('');
const [ageConfirmation, setAgeConfirmation] = useState(false);
const valid = newEmail.match(EMAIL_REGEX);
function handleSubmit() {
@ -52,28 +54,57 @@ function UserEmailNew(props: Props) {
error={errorMessage}
onChange={e => setEmail(e.target.value)}
/>
{!IS_WEB && (
<div className="section">
<FormField
type="checkbox"
name="sync_checkbox"
label={__('Sync balance and preferences across devices')}
helper={
balance > 0 ? (
__('This feature is not yet available for wallets with balances, but the gerbils are working on it.')
) : (
<React.Fragment>
{__('Blockchain expert?')}{' '}
<Button button="link" href="https://lbry.com/faq/account-sync" label={__('Learn More')} />
</React.Fragment>
)
label={
<I18nMessage
tokens={{
terms: (
<Button button="link" href="https://www.lbry.com/termsofservice" label={__('Terms of Service')} />
),
}}
>
I am over the age of 13 and agree to the %terms%.
</I18nMessage>
}
checked={syncEnabled}
onChange={() => setSync(!syncEnabled)}
disabled={balance > 0}
checked={ageConfirmation}
onChange={() => setAgeConfirmation(!ageConfirmation)}
/>
)}
<div className="card__actions">
<Button button="primary" type="submit" label={__('Continue')} disabled={!newEmail || !valid || isPending} />
{!IS_WEB && (
<FormField
type="checkbox"
name="sync_checkbox"
label={__('Sync balance and preferences across devices')}
helper={
balance > 0 ? (
__('This feature is not yet available for wallets with balances, but the gerbils are working on it.')
) : (
<I18nMessage
tokens={{
learn_more: (
<Button button="link" href="https://lbry.com/faq/account-sync" label={__('Learn More')} />
),
}}
>
Blockchain expert? %learn_more%
</I18nMessage>
)
}
checked={syncEnabled}
onChange={() => setSync(!syncEnabled)}
disabled={balance > 0}
/>
)}
<div className="card__actions">
<Button
button="primary"
type="submit"
label={__('Continue')}
disabled={!newEmail || !valid || !ageConfirmation || isPending}
/>
</div>
</div>
</Form>
</div>

View file

@ -60,9 +60,6 @@ function UserSignIn(props: Props) {
const channelCount = channels ? channels.length : 0;
const hasClaimedEmailAward = claimedRewards.some(reward => reward.reward_type === REWARDS.TYPE_CONFIRM_EMAIL);
const hasYoutubeChannels = youtubeChannels && Boolean(youtubeChannels.length);
// const hasTransferrableYoutubeChannels = hasYoutubeChannels && youtubeChannels.some(channel => channel.transferable);
// const hasPendingYoutubeTransfer =
// hasYoutubeChannels && youtubeChannels.some(channel => channel.transfer_state === YOUTUBE_STATUSES.PENDING_TRANSFER);
const isYoutubeTransferComplete =
hasYoutubeChannels &&
youtubeChannels.every(channel => channel.transfer_state === YOUTUBE_STATUSES.COMPLETED_TRANSFER);
@ -71,13 +68,12 @@ function UserSignIn(props: Props) {
// We can't just check if we are currently fetching something
// We may want to keep a component rendered while something is being fetched, instead of replacing it with the large spinner
// The verbose variable names are an attempt to alleviate _some_ of the confusion from handling all edge cases that come from
// reward claiming (plus the balance updating after), channel creation, account syncing, and youtube transfer
const canHijackSignInFlowWithSpinner = hasVerifiedEmail && !getSyncError && balance === 0;
// reward claiming, channel creation, account syncing, and youtube transfer
const canHijackSignInFlowWithSpinner = hasVerifiedEmail && !getSyncError;
const isCurrentlyFetchingSomething = fetchingChannels || claimingReward || syncingWallet;
const isWaitingForSomethingToFinish =
// If the user has claimed the email award, we need to wait until the balance updates sometime in the future
!hasFetchedReward || (hasFetchedReward && balance === 0) || (syncEnabled && !hasSynced);
(!hasFetchedReward && !hasClaimedEmailAward) || (syncEnabled && !hasSynced);
// The possible screens for the sign in flow
const showEmail = !emailToVerify && !hasVerifiedEmail;
const showEmailVerification = emailToVerify && !hasVerifiedEmail;

View file

@ -33,7 +33,7 @@ import {
selectUpgradeTimer,
selectModal,
} from 'redux/selectors/app';
import { Lbryio, doAuthenticate, doGetSync, selectSyncHash } from 'lbryinc';
import { Lbryio, doAuthenticate, doGetSync, selectSyncHash, doResetSync } from 'lbryinc';
import { lbrySettings as config, version as appVersion } from 'package.json';
import { push } from 'connected-react-router';
import analytics from 'analytics';
@ -465,7 +465,7 @@ export function doSignIn() {
const balance = selectBalance(state);
// For existing users, check if they've synced before, or have 0 balance
if (syncEnabled && (!syncHash || balance === 0)) {
if (syncEnabled && (syncHash || balance === 0)) {
dispatch(doGetSync());
}
// @endif
@ -483,9 +483,14 @@ export function doSignOut() {
// @if TARGET='web'
window.persistor.purge();
// @endif
// @if TARGET='app'
return dispatch(doResetSync());
// @endif
})
.then(() => {
location.reload();
setTimeout(() => {
location.reload();
});
})
.catch(() => location.reload());
};

View file

@ -40,6 +40,7 @@
.button--inverse {
height: var(--button-height);
border-radius: var(--button-radius);
font-size: var(--font-body);
padding-top: 0;
padding-bottom: 0;
box-sizing: border-box;

View file

@ -773,8 +773,6 @@
"LBC Currently Staked": "LBC Currently Staked",
"Your Supports": "Your Supports",
"Add Tags": "Add Tags",
"Jeremy please change this": "Jeremy please change this",
"Jeremy please change this.": "Jeremy please change this.",
"Extra Verification Needed": "Extra Verification Needed",
"We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.": "We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.",
"Proof via Text": "Proof via Text",
@ -797,5 +795,17 @@
"You have no rewards available.": "You have no rewards available.",
"light": "light",
"dark": "dark",
"Dark": "Dark"
}
"Dark": "Dark",
"Blockchain expert?": "Blockchain expert?",
"Learn More": "Learn More",
"Creating": "Creating",
"Enter Your LBRY Password": "Enter Your LBRY Password",
"You set your wallet password when you previously installed LBRY.": "You set your wallet password when you previously installed LBRY.",
"Remember My Password": "Remember My Password",
"Failed to load translations.": "Failed to load translations.",
"Terms of Service": "Terms of Service",
"I am over the age of 13 and agree to the %terms%.": "I am over the age of 13 and agree to the %terms%.",
"Nothing published to LBRY yet.": "Nothing published to LBRY yet.",
"Add a tag": "Add a tag",
"Claim Your 20 LBC Invite Reward": "Claim Your 20 LBC Invite Reward"
}

View file

@ -6850,17 +6850,17 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#973d28e46290c77f2d9d468304008f80f71fd8cd:
lbry-redux@lbryio/lbry-redux#74f55ba9e3b81b5364788a8cbdd89bd2884d40d0:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/973d28e46290c77f2d9d468304008f80f71fd8cd"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/74f55ba9e3b81b5364788a8cbdd89bd2884d40d0"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
lbryinc@lbryio/lbryinc#7c94a38683344262fe34773dc50bfbe6d2a9e116:
lbryinc@lbryio/lbryinc#5aba3127c879f5aaa9b1eccaf57aae97449df183:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/7c94a38683344262fe34773dc50bfbe6d2a9e116"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/5aba3127c879f5aaa9b1eccaf57aae97449df183"
dependencies:
reselect "^3.0.0"