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

update landing page issue and clipboard with localizaton fix #716

Merged
merged 4 commits into from
May 22, 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
71 changes: 32 additions & 39 deletions packages/apollo/src/components/CAModal/CAModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import SidePanelWarning from '../SidePanelWarning/SidePanelWarning';
import TranslateLink from '../TranslateLink/TranslateLink';
import Wizard from '../Wizard/Wizard';
import WizardStep from '../WizardStep/WizardStep';
import RenderParamHTML from '../RenderHTML/RenderParamHTML';

const SCOPE = 'caModal';
const Log = new Logger(SCOPE);
Expand Down Expand Up @@ -530,31 +531,25 @@ export class CAModal extends React.Component {
>
<div className="ibp-remove-ca-desc">
<p>
{this.props.ca.location === 'ibm_saas'
? translate('delete_ca_desc', {
name: (
<CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
),
})
: translate('remove_ca_desc', {
name: (
<CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
),
})}
{this.props.ca.location === 'ibm_saas' ? RenderParamHTML(translate, 'delete_ca_desc', {
name: <CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
}) : RenderParamHTML(translate, 'remove_ca_desc', {
name: <CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
})}
</p>
</div>
<div className="ibp-remove-ca-confirm">{translate('remove_ca_confirm')}</div>
Expand All @@ -568,7 +563,7 @@ export class CAModal extends React.Component {
},
]}
/>
</WizardStep>
</WizardStep >
);
}

Expand All @@ -582,17 +577,15 @@ export class CAModal extends React.Component {
<div>
<div className="ibp-remove-peer-desc">
<p>
{translate('upgrade_node_desc', {
name: (
<CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
),
{RenderParamHTML(translate, 'upgrade_node_desc', {
name: <CodeSnippet
type="inline"
ariaLabel={translate('copy_text', { copyText: this.props.ca.display_name })}
light={false}
onClick={() => Clipboard.copyToClipboard(this.props.ca.display_name)}
>
{this.props.ca.display_name}
</CodeSnippet>
})}
</p>
</div>
Expand Down Expand Up @@ -653,7 +646,7 @@ export class CAModal extends React.Component {
<div>
<div className="ibp-remove-peer-desc">
<p>
{translate('confirm_patch_desc', {
{RenderParamHTML(translate, 'confirm_patch_desc', {
name: (
<CodeSnippet
type="inline"
Expand All @@ -673,7 +666,7 @@ export class CAModal extends React.Component {
>
{this.props.new_version}
</CodeSnippet>
),
)
})}
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Form from '../Form/Form';
import Logger from '../Log/Logger';
import Wizard from '../Wizard/Wizard';
import WizardStep from '../WizardStep/WizardStep';
import RenderParamHTML from '../RenderHTML/RenderParamHTML';

const SCOPE = 'channelConsenterModal';
const Log = new Logger(SCOPE);
Expand All @@ -40,7 +41,7 @@ class ChannelConsenterModal extends React.Component {
});
}

removeConsenter = async() => {
removeConsenter = async () => {
try {
let options = {
channel_id: this.props.channelId,
Expand All @@ -59,7 +60,7 @@ class ChannelConsenterModal extends React.Component {
}
};

updateConsenter = async() => {
updateConsenter = async () => {
try {
let options = {
channel_id: this.props.channelId,
Expand Down Expand Up @@ -101,7 +102,7 @@ class ChannelConsenterModal extends React.Component {
>
<div className="ibp-remove-consenter-desc">
<p>
{translate('remove_consenter_application_channel_desc', {
{RenderParamHTML(translate, 'remove_consenter_application_channel_desc', {
name: (
<CodeSnippet
type="inline"
Expand Down Expand Up @@ -154,7 +155,7 @@ class ChannelConsenterModal extends React.Component {
>
<div>
<p>
{translate('update_consenter_application_channel_desc', {
{RenderParamHTML(translate, 'update_consenter_application_channel_desc', {
name: (
<CodeSnippet
type="inline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Form from '../Form/Form';
import Logger from '../Log/Logger';
import Wizard from '../Wizard/Wizard';
import WizardStep from '../WizardStep/WizardStep';
import RenderParamHTML from '../RenderHTML/RenderParamHTML';

const SCOPE = 'deleteCAModal';
const Log = new Logger(SCOPE);
Expand Down Expand Up @@ -62,7 +63,7 @@ class DeleteCAUserModal extends React.Component {
>
<div className="ibp-remove-ca-user-desc">
<p>
{translate('remove_ca_user_desc', {
{RenderParamHTML(translate, 'remove_ca_user_desc', {
enroll_id: (
<CodeSnippet
type="inline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Logger from '../Log/Logger';
import SidePanel from '../SidePanel/SidePanel';
import SidePanelWarning from '../SidePanelWarning/SidePanelWarning';
import Timeline from '../Timeline/Timeline';
import RenderParamHTML from '../RenderHTML/RenderParamHTML';

const SCOPE = 'generateMSP';
const Log = new Logger(SCOPE);
Expand Down Expand Up @@ -1013,7 +1014,7 @@ class GenerateMSPModal extends Component {
) : (
<>
<p className="ibp-generate-msp-selected-ca-text">
{translate('identities_from_chosen_ca', {
{RenderParamHTML(translate, 'identities_from_chosen_ca', {
name: (
<CodeSnippet
type="inline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import Helper from '../../utils/helper';
import Form from '../Form/Form';
import Logger from '../Log/Logger';
import SidePanel from '../SidePanel/SidePanel';
import RenderParamHTML from '../RenderHTML/RenderParamHTML';

const SCOPE = 'identityModal';
const Log = new Logger(SCOPE);
Expand Down Expand Up @@ -272,7 +273,7 @@ class IdentityModal extends React.Component {
<h1 className="ibm-light">{translate('remove_identity')}</h1>
</div>
<p className="ibp-remove-identity-desc">
{translate('remove_identity_desc', {
{RenderParamHTML(translate, 'remove_identity_desc', {
name: (
<CodeSnippet
type="inline"
Expand Down
163 changes: 89 additions & 74 deletions packages/apollo/src/components/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,94 +157,109 @@ export class Login extends Component {
}

const translate = this.props.t;

const onSubmit = (e) => {
e.preventDefault();
if (disableSubmit) return;
this.props.changePassword ? this.onChangePassword(e) : this.onLogin(e);
}
return (
<Router>
<>
<TitleBar hideButtons />
<div className="ibp-login-main">
<div className="ibp-login-main"
onKeyUp={(event) => {
if (event.which === 13 || event.keyCode === 13) {
event.preventDefault();
onSubmit(event);
}
}}>
<div className={`ibp-login-content ${this.props.changePassword ? 'ibp-change-password' : 'ibp-user-login'} `}>
<p className="ibp-login-content-title ibm-type-light">
{translate(this.props.changePassword ? 'change_your_password' : 'product_label_login')}
</p>
<form
{/* <form
onSubmit={e => {
e.preventDefault();
if (disableSubmit) return;

this.props.changePassword ? this.onChangePassword(e) : this.onLogin(e);
}}
>
<div className="ibp-login-form">
{!this.props.changePassword && (
<Form
scope={SCOPE}
id={SCOPE + '-form'}
fields={[
{
name: 'email',
label: 'login_email',
placeholder: 'login_email_placeholder',
required: true,
specialRules: Helper.SPECIAL_RULES_LOGIN_EMAIL,
},
{
name: 'login_password',
label: 'login_password',
type: 'password',
placeholder: 'login_password_placeholder',
errorMsg: this.props.loginError ? this.props.loginError : '',
required: true,
},
]}
onChange={value => this.onLoginFormChange(value)}
/>
)}
{this.props.changePassword && (
<Form
scope={SCOPE}
id={SCOPE + '-form'}
fields={[
{
name: 'currentPassword',
label: 'current_password',
type: 'password',
placeholder: 'current_password_placeholder',
errorMsg: this.props.currentPasswordError,
required: true,
},
{
name: 'newPassword',
label: 'new_password',
type: 'password',
errorMsg: this.props.newPasswordError,
placeholder: 'new_password_placeholder',
required: true,
},
{
name: 'confirmPassword',
label: 'confirm_password_label',
type: 'password',
errorMsg: this.props.confirmPasswordError,
disabled: !this.props.newPassword,
placeholder: 'confirm_password_placeholder',
required: true,
},
]}
onChange={value => this.onPasswordChangeFormChange(value)}
/>
)}
</div>
<div className="ibp-login-button">
<Button id="login"
kind="primary"
className="login-button"
type="submit"
disabled={disableSubmit}
>
{translate(this.props.changePassword ? 'change_your_password' : 'login')}
</Button>
</div>
</form>
> */}
<div className="ibp-login-form">
{!this.props.changePassword && (
<Form
scope={SCOPE}
id={SCOPE + '-form'}
fields={[
{
name: 'email',
label: 'login_email',
placeholder: 'login_email_placeholder',
required: true,
specialRules: Helper.SPECIAL_RULES_LOGIN_EMAIL,
},
{
name: 'login_password',
label: 'login_password',
type: 'password',
placeholder: 'login_password_placeholder',
errorMsg: this.props.loginError ? this.props.loginError : '',
required: true,
},
]}
onChange={value => this.onLoginFormChange(value)}
/>
)}
{this.props.changePassword && (
<Form
scope={SCOPE}
id={SCOPE + '-form'}
fields={[
{
name: 'currentPassword',
label: 'current_password',
type: 'password',
placeholder: 'current_password_placeholder',
errorMsg: this.props.currentPasswordError,
required: true,
},
{
name: 'newPassword',
label: 'new_password',
type: 'password',
errorMsg: this.props.newPasswordError,
placeholder: 'new_password_placeholder',
required: true,
},
{
name: 'confirmPassword',
label: 'confirm_password_label',
type: 'password',
errorMsg: this.props.confirmPasswordError,
disabled: !this.props.newPassword,
placeholder: 'confirm_password_placeholder',
required: true,
},
]}
onChange={value => this.onPasswordChangeFormChange(value)}
/>
)}
</div>
<div className="ibp-login-button">
<Button id="login"
kind="primary"
className="login-button"
type="button"
disabled={disableSubmit}
onClick={(e) => {
onSubmit(e)
}}
>
{translate(this.props.changePassword ? 'change_your_password' : 'login')}
</Button>
</div>
{/* </form> */}
</div>
</div>
</>
Expand Down
Loading
Loading