Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login mirror bug #870

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/src/components/EmailAlertSignup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ const EmailAlertSignupWithoutI18n = (props: EmailAlertProps) => {
<span className="pill-new">
<Trans>NEW</Trans>
</span>
{!user ? (
{!user?.email ? (
<Trans>Get Data Updates for this building</Trans>
) : (
<Trans>Data Updates</Trans>
)}
</label>
<div className="table-content">
{user && !loginRegisterInProgress ? (
{!!user?.email && !loginRegisterInProgress ? (
<BuildingSubscribe {...props} />
) : (
<Login
Expand Down
32 changes: 30 additions & 2 deletions client/src/components/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ const LoginWithoutI18n = (props: LoginProps) => {
onChange: onChangeUserType,
} = useInput("");

const [placeholderEmail, setPlaceholderEmail] = useState("");

const [invalidAuthError, setInvalidAuthError] = useState(false);
const [existingUserError, setExistingUserError] = useState(false);

Expand Down Expand Up @@ -271,6 +273,8 @@ const LoginWithoutI18n = (props: LoginProps) => {
}
}
}

setPlaceholderEmail(email);
};

const onLoginSubmit = async () => {
Expand Down Expand Up @@ -392,6 +396,31 @@ const LoginWithoutI18n = (props: LoginProps) => {
break;
}

const renderOnPagePlaceholder = () => {
return (
<div className="Login">
<Trans render="div" className="email-description">
Get weekly Data Updates for complaints, violations, and evictions.
</Trans>
<div className="input-group">
<EmailInput
email={placeholderEmail}
onChange={() => {}}
error={false}
setError={() => {}}
showError={false}
labelText={i18n._(t`Email address`)}
/>
<div className="submit-button-group">
<button type="button" className="button is-primary">
<Trans>Get updates</Trans>
</button>
</div>
</div>
</div>
);
};

const renderLoginFlow = () => {
return (
<div className="Login">
Expand Down Expand Up @@ -462,8 +491,7 @@ const LoginWithoutI18n = (props: LoginProps) => {

return (
<>
{(!showRegisterModal || isCheckEmailStep || isLoginStep || isVerifyEmailStep) &&
renderLoginFlow()}
{!showRegisterModal ? renderLoginFlow() : renderOnPagePlaceholder()}
{registerInModal && (
<Modal
key={1}
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/UserSettingField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ const UserSettingFieldWithoutI18n = (props: UserSettingFieldProps) => {
<>
{children}
<div className="user-setting-actions">
<input type="submit" className="button is-primary" value={`Save`} />
<button type="submit" className="button is-primary">
<Trans>Save</Trans>
</button>
<button type="button" className="button is-text" onClick={() => setEditing(false)}>
<Trans>Cancel</Trans>
</button>
Expand Down
3 changes: 1 addition & 2 deletions client/src/styles/Login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
.submit-button-group {
display: flex;

button[type="submit"],
input[type="submit"] {
.button.is-primary {
padding: 1rem 2rem !important;
align-self: center;
margin: 0 auto !important;
Expand Down