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

fix(modaltos): fix Modal Terms of Service translation presentation and title #23

Merged
merged 2 commits into from
Dec 16, 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
11 changes: 11 additions & 0 deletions src/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,14 @@ $footer-links-navigation-color: $footer-text;
}
}
}

.modal-terms-of-service {
.pgn__form-label{
.standalone-link {
&:before {
// Add a white space before MODAL TOS checkbox links
content: "\00a0";
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SiteFooter extends React.Component {
</section>
<AdditionalLogosSection />
{
config.MODAL_UPDATE_TERMS_OF_SERVICE && <ModalToS />
config.MODAL_UPDATE_TERMS_OF_SERVICE && <ModalToS intl={intl} />
}
</footer>
);
Expand Down
19 changes: 13 additions & 6 deletions src/components/modal-tos/ModalToS.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { useEffect, useState } from 'react';

import { convertKeyNames, getConfig } from '@edx/frontend-platform';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { FormattedMessage, getLocale, injectIntl } from '@edx/frontend-platform/i18n';
import {
FormattedMessage, getLocale, injectIntl, intlShape,
} from '@edx/frontend-platform/i18n';
import {
Button, Form, Hyperlink, ModalDialog, useToggle, useCheckboxSetValues,
ActionRow,
Expand All @@ -21,7 +23,7 @@ const createTOSLink = (chunks, url) => (
</Hyperlink>
);

const ModalToS = () => {
const ModalToS = ({ intl }) => {
const [tosPreference, setTosPreference] = useState(undefined);
const [isOpen, open, close] = useToggle(false);
const { width } = useWindowSize();
Expand Down Expand Up @@ -86,12 +88,13 @@ const ModalToS = () => {

return (
<ModalDialog
title="Modal Terms of Service"
title={intl.formatMessage({ id: 'modalToS.modalDialog.title', description: 'The Modal Terms of Service Title', defaultMessage: 'Modal accept Terms of Service' })}
isBlocking
isOpen={isOpen}
onClose={close}
hasCloseButton={false}
size="lg"
className="modal-terms-of-service"
>
{title[lang] && (
<ModalDialog.Header>
Expand All @@ -114,7 +117,7 @@ const ModalToS = () => {
<FormattedMessage
id="modalToS.dataAuthorization.checkbox.label"
description="The label for the data authorization checkbox inside the TOS modal."
defaultMessage="I have read and understood the&nbsp;<a>Privacy Policy</a>"
defaultMessage="I have read and understood the <a>Privacy Policy</a>"
values={{
a: chunks => createTOSLink(chunks, PRIVACY_POLICY_URL),
}}
Expand All @@ -127,7 +130,7 @@ const ModalToS = () => {
<FormattedMessage
id="modalToS.termsOfService.checkbox.label"
description="The label for the terms of service checkbox inside the TOS modal."
defaultMessage="I have read, understood and accept the&nbsp;<a>Terms and Conditions</a>"
defaultMessage="I have read, understood and accept the <a>Terms and Conditions</a>"
values={{
a: chunks => createTOSLink(chunks, TERMS_OF_SERVICE_URL),
}}
Expand All @@ -140,7 +143,7 @@ const ModalToS = () => {
<FormattedMessage
id="modalToS.honorCode.checkbox.label"
description="The label for the honor code checkbox inside the TOS modal."
defaultMessage="I have read and understood the&nbsp;<a>Honor Code</a>"
defaultMessage="I have read and understood the <a>Honor Code</a>"
values={{
a: chunks => createTOSLink(chunks, TOS_AND_HONOR_CODE),
}}
Expand Down Expand Up @@ -168,4 +171,8 @@ const ModalToS = () => {
);
};

ModalToS.propTypes = {
intl: intlShape.isRequired,
};

export default injectIntl(ModalToS);
9 changes: 5 additions & 4 deletions src/i18n/messages/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"footer.languageForm.select.label": "Escolha a língua",
"footer.languageForm.submit.label": "Aplicar",
"footer.copyright.message": "Todos os direitos reservados.",
"modalToS.dataAuthorization.checkbox.label": "Li e compreendi a&nbsp;<a>Política de Privacidade</a>",
"modalToS.termsOfService.checkbox.label": "Li, compreendi e aceito os&nbsp;<a>Termos e Condições</a>",
"modalToS.honorCode.checkbox.label": "Li e compreendi o&nbsp;<a>Código de Honra</a>",
"modalToS.modalDialog.title": "Modal aceitar Termos de Serviço",
"modalToS.dataAuthorization.checkbox.label": "Li e compreendi a <a>Política de Privacidade</a>",
"modalToS.termsOfService.checkbox.label": "Li, compreendi e aceito os <a>Termos e Condições</a>",
"modalToS.honorCode.checkbox.label": "Li e compreendi o <a>Código de Honra</a>",
"modalToS.acceptance.button": "Aceito os novos termos de serviço"
}
}
Loading