Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Yesmunt committed Sep 30, 2019
1 parent 3950c73 commit 6db47e7
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 49 deletions.
1 change: 1 addition & 0 deletions src/ui/component/syncPassword/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function SyncPassword(props: Props) {
<Form onSubmit={handleSubmit}>
<Card
title={__('Enter Your LBRY Password')}
subtitle={__('You set your wallet password when you previously installed LBRY.')}
actions={
<div>
<FormField
Expand Down
33 changes: 20 additions & 13 deletions src/ui/component/userEmailNew/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,26 @@ function UserEmailNew(props: Props) {
error={errorMessage}
onChange={e => setEmail(e.target.value)}
/>
<FormField
type="checkbox"
name="sync_checkbox"
label={__('Sync your balance between devices')}
helper={
balance > 0
? __("This is only available if you don't have a balance")
: __('Maybe some more text about something')
}
checked={syncEnabled}
onChange={() => setSync(!syncEnabled)}
disabled={balance > 0}
/>
{!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.')
) : (
<React.Fragment>
{__('Blockchain expert?')}{' '}
<Button button="link" href="https://lbry.com/faq/account-sync" label={__('Learn More')} />
</React.Fragment>
)
}
checked={syncEnabled}
onChange={() => setSync(!syncEnabled)}
disabled={balance > 0}
/>
)}
<div className="card__actions">
<Button button="primary" type="submit" label={__('Continue')} disabled={!newEmail || !valid || isPending} />
</div>
Expand Down
38 changes: 13 additions & 25 deletions src/ui/component/youtubeTransferStatus/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,13 @@ export default function YoutubeTransferStatus(props: Props) {
const { youtubeChannels, ytImportPending, claimChannels, videosImported, checkYoutubeTransfer, updateUser } = props;
const hasChannels = youtubeChannels && youtubeChannels.length;

let transferEnabled = false;
let transferStarted = false;
let transferComplete = false;
if (hasChannels) {
for (var i = 0; i < youtubeChannels.length; i++) {
const { transfer_state: transferState, transferable } = youtubeChannels[i];
if (transferable) {
transferEnabled = true;
}

if (transferState === COMPLETED_TRANSFER) {
transferComplete = true;
}

if (transferState === PENDING_TRANSFER) {
transferStarted = true;
}
}
}
const transferEnabled = youtubeChannels.some(status => status.transferable);
const hasPendingTransfers = youtubeChannels.some(status => status.transfer_state === PENDING_TRANSFER);
const hasCompleteTransfers = youtubeChannels.some(status => status.transfer_state === COMPLETED_TRANSFER);

let total;
let complete;
if (!transferComplete && videosImported) {
if (hasPendingTransfers && videosImported) {
complete = videosImported[0];
total = videosImported[1];
}
Expand All @@ -66,7 +50,7 @@ export default function YoutubeTransferStatus(props: Props) {

React.useEffect(() => {
// If a channel is transferrable, theres nothing to check
if (transferStarted && !transferComplete) {
if (hasPendingTransfers) {
checkYoutubeTransfer();

let interval = setInterval(() => {
Expand All @@ -78,17 +62,17 @@ export default function YoutubeTransferStatus(props: Props) {
clearInterval(interval);
};
}
}, [transferComplete, transferStarted, checkYoutubeTransfer, updateUser]);
}, [hasPendingTransfers, checkYoutubeTransfer, updateUser]);

return (
hasChannels &&
!transferComplete && (
(hasPendingTransfers || (!hasPendingTransfers && !hasCompleteTransfers)) && (
<div>
<Card
title={youtubeChannels.length > 1 ? __('Your YouTube Channels') : __('Your YouTube Channel')}
subtitle={
<span>
{transferStarted
{hasPendingTransfers
? __('Your videos are currently being transferred. There is nothing else for you to do.')
: __('Your videos are ready to be transferred.')}
</span>
Expand Down Expand Up @@ -116,7 +100,11 @@ export default function YoutubeTransferStatus(props: Props) {
transferEnabled &&
!ytImportPending && (
<div className="card__actions">
<Button button="primary" onClick={claimChannels} label={__('Claim Channels')} />
<Button
button="primary"
onClick={claimChannels}
label={youtubeChannels.length > 1 ? __('Claim Channels') : __('Claim Channel')}
/>
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/youtube#transfer" />
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/ui/page/channels/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function ChannelsPage(props: Props) {
{channels && channels.length ? (
<div className="card">
<ClaimList
header={__('Your Channels On LBRY')}
header={__('Your Channels')}
loading={fetchingChannels}
uris={channels.map(channel => channel.permanent_url)}
/>
Expand Down
5 changes: 5 additions & 0 deletions src/ui/scss/component/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
stroke: $lbry-white;
}
}

[data-mode='dark'] & {
border-color: $lbry-teal-4;
color: $lbry-teal-3;
}
}

.button--alt {
Expand Down
8 changes: 8 additions & 0 deletions src/ui/scss/component/_form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ textarea {
border-radius: var(--input-border-radius);
background-color: $lbry-white;
border-width: 1px;

[data-mode='dark'] & {
background-color: var(--dm-color-02);
}
}

fieldset-section {
Expand All @@ -69,6 +73,10 @@ fieldset-section {
width: auto;
text-transform: none;
color: lighten($lbry-black, 20%);

[data-mode='dark'] & {
color: $lbry-gray-3;
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/ui/scss/component/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
overflow: auto;
padding: var(--spacing-large);
word-break: break-word;
box-shadow: none;

@media (min-width: 501px) {
min-width: 500px;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/scss/component/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

.navigation-links__inline {
margin-left: 1.7rem;
margin-left: calc(var(--spacing-medium) + var(--spacing-small));
}

.navigation-link__wrapper {
Expand Down
14 changes: 7 additions & 7 deletions src/ui/scss/component/_tags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ $main: $lbry-teal-5;
// Nested style needed for more specificity
.tag__input {
@extend .tag--remove;
border: 1px dashed;
border-color: $lbry-teal-5;
background-color: mix($lbry-teal-1, $lbry-white, 10%);
height: auto;
padding: calc(var(--spacing-miniscule) - 1px) var(--spacing-small);
margin-top: -2px;
border: 1px dashed lighten($lbry-teal-5, 10%);
background-color: mix($lbry-teal-1, $lbry-white, 10%);
border: 1px dashed;
border-color: lighten($lbry-teal-5, 10%);
margin-top: -2px; // To handle the border height

::placeholder {
color: black;
[data-mode='dark'] & {
background-color: var(--dm-color-02);
border-color: $lbry-white;
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion static/app-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -834,5 +834,10 @@
"Add Tags": "Add Tags",
"You have %credit_amount% in unclaimed rewards.": "You have %credit_amount% in unclaimed rewards.",
"to fix it. If that doesn't work, press CMD/CTRL-R to reset to the homepage.": "to fix it. If that doesn't work, press CMD/CTRL-R to reset to the homepage.",
"Your videos are ready to be transferred.": "Your videos are ready to be transferred."
"Your videos are ready to be transferred.": "Your videos are ready to be transferred.",
"Claim Channel": "Claim Channel",
"Sync balance and preferences across devices": "Sync balance and preferences across devices",
"Blockchain expert?": "Blockchain expert?",
"Learn More": "Learn More",
"Not a valid LBRY address": "Not a valid LBRY address"
}

0 comments on commit 6db47e7

Please sign in to comment.