Skip to content

Commit

Permalink
feat(mon-pix): remove has-seen-level-seven-information banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeyffrey committed Oct 4, 2024
1 parent 5175afc commit 1fefb1f
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 177 deletions.
5 changes: 0 additions & 5 deletions mon-pix/app/adapters/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ export default class User extends ApplicationAdapter {
return url + '/remember-user-has-seen-assessment-instructions';
}

if (adapterOptions && adapterOptions.rememberUserHasSeenLevelSevenBanner) {
delete adapterOptions.rememberUserHasSeenLevelSevenBanner;
return url + '/user-has-seen-level-seven-info';
}

if (adapterOptions && adapterOptions.rememberUserHasSeenNewDashboardInfo) {
delete adapterOptions.rememberUserHasSeenNewDashboardInfo;
return url + '/has-seen-new-dashboard-info';
Expand Down
13 changes: 0 additions & 13 deletions mon-pix/app/components/profile-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
<div class="background-banner"></div>

<div class="rounded-panel rounded-panel--strong rounded-panel--over-background-banner profile__panel">
{{#if this.displayLevelSevenBanner}}
<section>
<div>
<NewInformation
@information={{this.lvlSevenInformation}}
@image="/images/illustrations/tutorial-campaign/icn-tutos.svg"
@variantClass="new-information--yellow-gradient-background"
@textColorClass="new-information--black-text"
@closeAction={{this.closeLevelSevenBanner}}
/>
</div>
</section>
{{/if}}
<h1 class="sr-only">{{t "pages.profile.accessibility.title"}}</h1>

<div class="rounded-panel-header-with-components">
Expand Down
32 changes: 0 additions & 32 deletions mon-pix/app/components/profile-content.js

This file was deleted.

1 change: 0 additions & 1 deletion mon-pix/app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default class User extends Model {
@attr('boolean') hasSeenNewDashboardInfo;
@attr('boolean') hasSeenFocusedChallengeTooltip;
@attr('boolean') hasSeenOtherChallengesTooltip;
@attr('boolean') hasSeenLevelSevenInfo;
@attr('boolean') hasAssessmentParticipations;
@attr('boolean') hasRecommendedTrainings;
@attr('string') codeForLastProfileToShare;
Expand Down
9 changes: 0 additions & 9 deletions mon-pix/app/services/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ export default class Url extends Service {
}
}

get levelSevenNewsUrl() {
const currentLanguage = this.intl.primaryLocale;

if (currentLanguage === ENGLISH_INTERNATIONAL_LOCALE) {
return 'https://pix.org/en/news/discover-level-7-on-pix';
}
return 'https://pix.fr/actualites/decouvrez-le-niveau-7-des-maintenant-sur-pix';
}

get serverStatusUrl() {
const currentLanguage = this.intl.primaryLocale;
return `https://status.pix.org/?locale=${currentLanguage}`;
Expand Down
12 changes: 0 additions & 12 deletions mon-pix/mirage/factories/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ export default Factory.extend({
isAnonymous() {
return false;
},
hasSeenLevelSevenInfo() {
return false;
},
shouldChangePassword: trait({
shouldChangePassword: true,
}),
Expand All @@ -298,15 +295,6 @@ export default Factory.extend({
hasSeenNewDashboardInfo: trait({
hasSeenNewDashboardInfo: true,
}),
withMaxReachableLevelSeven: trait({
afterCreate(user, server) {
user.update({
profile: server.create('profile', {
maxReachableLevel: 7,
}),
});
},
}),
withMaxReachableLevelSix: trait({
afterCreate(user, server) {
user.update({
Expand Down
6 changes: 0 additions & 6 deletions mon-pix/mirage/routes/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ export default function index(config) {
return user;
});

config.patch('/users/:id/user-has-seen-level-seven-info', (schema, request) => {
const user = schema.users.find(request.params.id);
user.update({ hasSeenLevelSevenInfo: true });
return user;
});

config.patch('/users/:id/has-seen-challenge-tooltip/:challengeType', (schema, request) => {
const user = schema.users.find(request.params.id);
user.update({ tooltipChallengeType: request.params.challengeType });
Expand Down
1 change: 0 additions & 1 deletion mon-pix/mirage/serializers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default ApplicationSerializer.extend({
'pixCertifTermsOfServiceAccepted',
'hasSeenAssessmentInstructions',
'hasSeenNewDashboardInfo',
'hasSeenLevelSevenInfo',
'isAnonymous',
'hasRecommendedTrainings',
],
Expand Down
58 changes: 0 additions & 58 deletions mon-pix/tests/acceptance/profile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,64 +66,6 @@ module('Acceptance | Profile', function (hooks) {
});
});

module('Authenticated cases as a user with specific max reachable level', function () {
module('max reachable level is set to seven', function (hooks) {
hooks.beforeEach(async function () {
const userWithMaxReachableLevelSeven = server.create('user', 'withMaxReachableLevelSeven');
await authenticate(userWithMaxReachableLevelSeven);
});
module('user has never closed the banner', function () {
test('should display the level seven information banner', async function (assert) {
// when
await visit('/competences');

// then
assert.ok(
getByTextWithHtml(
t('common.new-information-banner.lvl-seven', { lvlSevenUrl: this.url.levelSevenNewsUrl }),
),
);
});
});

module('user has closed the banner', function () {
test('should not display the level seven information banner', async function (assert) {
// given
const screen = await visit('/competences');

// when
await click(screen.getByRole('button', { name: t('common.new-information-banner.close-label') }));

// then
assert.strictEqual(
queryByTextWithHtml(
t('common.new-information-banner.lvl-seven', { lvlSevenUrl: this.url.levelSevenNewsUrl }),
),
null,
);
});
});
});

module('max reachable level is not set to seven', function (hooks) {
hooks.beforeEach(async function () {
const userWithMaxReachableLevelSix = server.create('user', 'withMaxReachableLevelSix');
await authenticate(userWithMaxReachableLevelSix);
});
test('should not display the level seven information banner', async function (assert) {
// when
await visit('/competences');

assert.strictEqual(
queryByTextWithHtml(
t('common.new-information-banner.lvl-seven', { lvlSevenUrl: this.url.levelSevenNewsUrl }),
),
null,
);
});
});
});

module('Not authenticated cases', function () {
test('should redirect to home, when user is not authenticated', async function (assert) {
// when
Expand Down
32 changes: 0 additions & 32 deletions mon-pix/tests/unit/services/url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,38 +424,6 @@ module('Unit | Service | url', function (hooks) {
});
});

module('#levelSevenNewsUrl', function () {
test('returns the French URL page', function (assert) {
// given
const service = this.owner.lookup('service:url');
service.currentDomain = { isFranceDomain: true };
service.intl = { primaryLocale: FRENCH_INTERNATIONAL_LOCALE };
const expectedLevelSevenNewsUrl = 'https://pix.fr/actualites/decouvrez-le-niveau-7-des-maintenant-sur-pix';

// when
const levelSevenNewsUrl = service.levelSevenNewsUrl;

// then
assert.strictEqual(levelSevenNewsUrl, expectedLevelSevenNewsUrl);
});

module('when current language is "en"', function () {
test('returns the English URL page', function (assert) {
// given
const service = this.owner.lookup('service:url');
service.currentDomain = { isFranceDomain: false };
service.intl = { primaryLocale: ENGLISH_INTERNATIONAL_LOCALE };
const expectedLevelSevenNewsUrl = 'https://pix.org/en/news/discover-level-7-on-pix';

// when
const levelSevenNewsUrl = service.levelSevenNewsUrl;

// then
assert.strictEqual(levelSevenNewsUrl, expectedLevelSevenNewsUrl);
});
});
});

module('#supportHomeUrl', function () {
module('when website is pix.fr', function () {
test('returns the French page URL', function (assert) {
Expand Down
3 changes: 1 addition & 2 deletions mon-pix/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@
"test": "Your test is loading"
},
"new-information-banner": {
"close-label": "Close banner",
"lvl-seven": "Level 7 is now available! Learn more '<'a href=\"{lvlSevenUrl}\" class=\"link\" target=\"_blank\" rel=\"noopener noreferrer\"'>'here'</a>'."
"close-label": "Close banner"
},
"or": "or",
"pagination": {
Expand Down
3 changes: 1 addition & 2 deletions mon-pix/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
"test": "Tu prueba se está cargando"
},
"new-information-banner": {
"close-label": "Cerrar el banner",
"lvl-seven": "¡Por fin está disponible el nivel 7! Puedes obtener más información en '<'a href=\"{lvlSevenUrl}\" class=\"link\" target=\"_blank\" rel=\"noopener noreferrer\"'>'esta noticia'</a>'."
"close-label": "Cerrar el banner"
},
"or": "o",
"pagination": {
Expand Down
3 changes: 1 addition & 2 deletions mon-pix/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@
"test": "Votre test est en cours de chargement"
},
"new-information-banner": {
"close-label": "Fermer la bannière",
"lvl-seven": "Le niveau 7 est enfin disponible ! Vous pouvez en apprendre plus via '<'a href=\"{lvlSevenUrl}\" class=\"link\" target=\"_blank\" rel=\"noopener noreferrer\"'>'cette actualité'</a>'."
"close-label": "Fermer la bannière"
},
"or": "ou",
"pagination": {
Expand Down
3 changes: 1 addition & 2 deletions mon-pix/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
"test": "Je test wordt geladen"
},
"new-information-banner": {
"close-label": "Sluit de banner",
"lvl-seven": "Pix wordt geleidelijk aan vertaald naar het Nederlands! De vertaling van al onze vaardigheden zal binnenkort beschikbaar zijn. '<'a href=\"https://pix.org/nl-be/de-planning-voor-de-uitrol-van-pix-in-het-nederlan\" class=\"link\" target=\"_blank\" rel=\"noopener noreferrer\"'>'Meer informatie'</a>'"
"close-label": "Sluit de banner"
},
"or": "of",
"pagination": {
Expand Down

0 comments on commit 1fefb1f

Please sign in to comment.