Skip to content

Commit

Permalink
♻️ mon-pix: improve error management and design on attestation page
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiaPena authored Dec 6, 2024
1 parent 478485f commit 6360d61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<p class="attestation__error-message">{{this.attestationDownloadErrorMessage}}</p>
{{/if}}
</div>
<hr />
<div class="verification-code">
<h2 class="verification-code__title">
{{t "pages.certificate.verification-code.title"}}
Expand Down
4 changes: 2 additions & 2 deletions mon-pix/app/components/user-certifications-detail-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default class UserCertificationsDetailHeader extends Component {
const token = this.session.data.authenticated.access_token;
try {
await this.fileSaver.save({ url, token });
} catch (error) {
this.attestationDownloadErrorMessage = error.message;
} catch (_) {
this.attestationDownloadErrorMessage = this.intl.t('common.error');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,34 +72,31 @@
}

.attestation-and-verification-code {
padding: 16px 20px;
max-width: 100%;
padding: var(--pix-spacing-4x) var(--pix-spacing-6x);
background-color: var(--pix-neutral-20);
border-radius: 8px;

@include device-is('desktop') {
max-width: calc(var(--pix-spacing-12x) * 6);
}

.attestation {
margin: auto;
font-size: 0.875rem;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: var(--pix-spacing-6x);
text-align: center;

button {
max-width: 250px;
padding: 14px 20px;
}

&__error-message {
max-width: 250px;
margin-top: 15px;
@extend %pix-body-s;

margin-top: var(--pix-spacing-4x);
color: var(--pix-error-500);
}
}

hr {
margin: 24px 0;
border: 1px solid var(--pix-neutral-20);
}

.verification-code {
max-width: 250px;
margin: auto;
color: var(--pix-neutral-900);
letter-spacing: 0;
Expand Down Expand Up @@ -157,10 +154,5 @@
@include device-is('desktop') {
flex-grow: 0;
margin-left: auto;

.verification-code,
.attestation {
margin: 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ module('Integration | Component | user certifications detail header', function (
});

module('when there is an error during the download of the attestation', function () {
test('should show the error message', async function (assert) {
test('should show the common error message', async function (assert) {
// given
const fileSaverSaveStub = sinon.stub();

Expand Down Expand Up @@ -366,7 +366,7 @@ module('Integration | Component | user certifications detail header', function (
await click(screen.getByRole('button', { name: 'Télécharger mon attestation' }));

// then
assert.ok(screen.getByText('an error message'));
assert.ok(screen.getByText('Une erreur est survenue. Veuillez recommencer ou contacter le support.'));
});
});
});

0 comments on commit 6360d61

Please sign in to comment.