Skip to content

Commit 6360d61

Browse files
authored
♻️ mon-pix: improve error management and design on attestation page
1 parent 478485f commit 6360d61

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

mon-pix/app/components/user-certifications-detail-header.hbs

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
<p class="attestation__error-message">{{this.attestationDownloadErrorMessage}}</p>
5050
{{/if}}
5151
</div>
52-
<hr />
5352
<div class="verification-code">
5453
<h2 class="verification-code__title">
5554
{{t "pages.certificate.verification-code.title"}}

mon-pix/app/components/user-certifications-detail-header.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default class UserCertificationsDetailHeader extends Component {
3434
const token = this.session.data.authenticated.access_token;
3535
try {
3636
await this.fileSaver.save({ url, token });
37-
} catch (error) {
38-
this.attestationDownloadErrorMessage = error.message;
37+
} catch (_) {
38+
this.attestationDownloadErrorMessage = this.intl.t('common.error');
3939
}
4040
}
4141
}

mon-pix/app/styles/components/_user-certifications-detail-header.scss

+13-21
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,31 @@
7272
}
7373

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

80+
@include device-is('desktop') {
81+
max-width: calc(var(--pix-spacing-12x) * 6);
82+
}
83+
7984
.attestation {
80-
margin: auto;
81-
font-size: 0.875rem;
85+
display: flex;
86+
flex-direction: column;
87+
align-items: center;
88+
margin-bottom: var(--pix-spacing-6x);
8289
text-align: center;
8390

84-
button {
85-
max-width: 250px;
86-
padding: 14px 20px;
87-
}
88-
8991
&__error-message {
90-
max-width: 250px;
91-
margin-top: 15px;
92+
@extend %pix-body-s;
93+
94+
margin-top: var(--pix-spacing-4x);
9295
color: var(--pix-error-500);
9396
}
9497
}
9598

96-
hr {
97-
margin: 24px 0;
98-
border: 1px solid var(--pix-neutral-20);
99-
}
100-
10199
.verification-code {
102-
max-width: 250px;
103100
margin: auto;
104101
color: var(--pix-neutral-900);
105102
letter-spacing: 0;
@@ -157,10 +154,5 @@
157154
@include device-is('desktop') {
158155
flex-grow: 0;
159156
margin-left: auto;
160-
161-
.verification-code,
162-
.attestation {
163-
margin: 0;
164-
}
165157
}
166158
}

mon-pix/tests/integration/components/user-certifications-detail-header-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ module('Integration | Component | user certifications detail header', function (
330330
});
331331

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

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

368368
// then
369-
assert.ok(screen.getByText('an error message'));
369+
assert.ok(screen.getByText('Une erreur est survenue. Veuillez recommencer ou contacter le support.'));
370370
});
371371
});
372372
});

0 commit comments

Comments
 (0)