Sign-up page optimization (#489)

This commit is contained in:
infinite-persistence 2021-12-14 18:02:01 +08:00
commit 20ba4b9b13
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
6 changed files with 26 additions and 47 deletions

View file

@ -63,7 +63,7 @@ export default function Card(props: Props) {
} }
}} }}
> >
<div> <div className="card__first-pane">
{(title || subtitle) && ( {(title || subtitle) && (
<div <div
className={classnames('card__header--between', { className={classnames('card__header--between', {

View file

@ -1,37 +1,13 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { SITE_NAME, LOGIN_IMG_URL } from 'config'; import { SITE_NAME, LOGIN_IMG_URL } from 'config';
import { getThumbnailCdnUrl } from 'util/thumbnail';
function LoginGraphic(props: any) { function LoginGraphic(props: any) {
const [error, setError] = React.useState(false); const alt = __('%SITE_NAME% login', { SITE_NAME });
const [src, setSrc] = React.useState('---');
const containerRef = React.useRef<any>();
const imgUrl = LOGIN_IMG_URL;
React.useEffect(() => {
if (containerRef.current && containerRef.current.parentElement && containerRef.current.parentElement.offsetWidth) {
const newWidth = containerRef.current.parentElement.offsetWidth;
let newSrc = imgUrl && imgUrl.trim().replace(/^http:\/\//i, 'https://');
// @if TARGET='web'
// Pass image urls through a compression proxy.
newSrc = getThumbnailCdnUrl({ thumbnail: newSrc, width: newWidth, height: newWidth * 2 });
// @endif
setSrc(newSrc);
} else {
setSrc(imgUrl);
}
}, []);
if (error || !imgUrl) {
return null;
}
return ( return (
<div className="signup-image" ref={containerRef}> <div className="signup-image">
<img alt={__('%SITE_NAME% login', { SITE_NAME })} src={src} onError={() => setError(true)} /> <img alt={alt} src={LOGIN_IMG_URL} />
</div> </div>
); );
} }

View file

@ -117,6 +117,7 @@ function Page(props: Props) {
className={classnames('main-wrapper__inner', { className={classnames('main-wrapper__inner', {
'main-wrapper__inner--filepage': isOnFilePage, 'main-wrapper__inner--filepage': isOnFilePage,
'main-wrapper__inner--theater-mode': isOnFilePage && videoTheaterMode, 'main-wrapper__inner--theater-mode': isOnFilePage && videoTheaterMode,
'main-wrapper__inner--auth': authPage,
})} })}
> >
{getSideNavElem()} {getSideNavElem()}

View file

@ -4,7 +4,6 @@ import { selectGetSyncIsPending, selectSyncHash, selectPrefsReady } from 'redux/
import { doClaimRewardType } from 'redux/actions/rewards'; import { doClaimRewardType } from 'redux/actions/rewards';
import { doSetClientSetting } from 'redux/actions/settings'; import { doSetClientSetting } from 'redux/actions/settings';
import { selectClaimedRewards, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards'; import { selectClaimedRewards, makeSelectIsRewardClaimPending } from 'redux/selectors/rewards';
import { doUserFetch } from 'redux/actions/user';
import { import {
selectUserIsPending, selectUserIsPending,
selectYoutubeChannels, selectYoutubeChannels,
@ -45,7 +44,6 @@ const select = (state) => ({
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({
fetchUser: () => dispatch(doUserFetch()),
claimConfirmEmailReward: () => claimConfirmEmailReward: () =>
dispatch( dispatch(
doClaimRewardType(REWARD_TYPES.TYPE_CONFIRM_EMAIL, { doClaimRewardType(REWARD_TYPES.TYPE_CONFIRM_EMAIL, {

View file

@ -34,7 +34,6 @@ type Props = {
claimingReward: boolean, claimingReward: boolean,
claimConfirmEmailReward: () => void, claimConfirmEmailReward: () => void,
claimNewUserReward: () => void, claimNewUserReward: () => void,
fetchUser: () => void,
claimedRewards: Array<Reward>, claimedRewards: Array<Reward>,
youtubeChannels: Array<any>, youtubeChannels: Array<any>,
syncEnabled: boolean, syncEnabled: boolean,
@ -60,7 +59,6 @@ function UserSignUp(props: Props) {
claimConfirmEmailReward, claimConfirmEmailReward,
claimNewUserReward, claimNewUserReward,
balance, balance,
fetchUser,
youtubeChannels, youtubeChannels,
syncEnabled, syncEnabled,
syncingWallet, syncingWallet,
@ -132,10 +130,6 @@ function UserSignUp(props: Props) {
setClientSetting(setting, value, true); setClientSetting(setting, value, true);
} }
React.useEffect(() => {
fetchUser();
}, [fetchUser]);
React.useEffect(() => { React.useEffect(() => {
if (previousHasVerifiedEmail === false && hasVerifiedEmail && prefsReady) { if (previousHasVerifiedEmail === false && hasVerifiedEmail && prefsReady) {
setSettingAndSync(SETTINGS.FIRST_RUN_STARTED, true); setSettingAndSync(SETTINGS.FIRST_RUN_STARTED, true);

View file

@ -42,6 +42,15 @@
padding-top: 0; padding-top: 0;
} }
.main-wrapper__inner--auth {
min-height: unset;
padding: 0;
.main--auth-page {
margin-top: 0;
}
}
.main { .main {
position: relative; position: relative;
width: calc(100% - var(--side-nav-width) - var(--spacing-l)); width: calc(100% - var(--side-nav-width) - var(--spacing-l));
@ -425,27 +434,28 @@
.main__sign-up--graphic { .main__sign-up--graphic {
max-width: 47rem; max-width: 47rem;
.card__first-pane {
width: 50%;
@media (max-width: $breakpoint-small) {
width: 100%;
}
}
.card__second-pane { .card__second-pane {
width: 50%; width: 50%;
@media (max-width: $breakpoint-small) {
width: 100%;
}
border: none; border: none;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: var(--color-login-graphic-background); background: var(--color-login-graphic-background);
@media (max-width: $breakpoint-small) {
width: 100%;
}
.signup-image {
@media (max-width: $breakpoint-small) {
width: 50%;
}
}
} }
.card__title { .card__title {
font-size: var(--font-heading); font-size: var(--font-title);
font-weight: var(--font-weight-bold); font-weight: var(--font-weight-bold);
} }