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 commit message for "show username on AccountDropDown" commit #425

Closed
wants to merge 1 commit into from
Closed
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
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ and this project adheres to
- ✨(domains) add endpoint to list and retrieve domain accesses #404
- 🍱(dev) embark dimail-api as container #366
- ✨(dimail) allow la regie to request a token for another user #416
- ⚗️(frontend) show username on AccountDropDown #412

### Changed

Expand Down
33 changes: 15 additions & 18 deletions src/frontend/apps/desk/src/features/header/AccountDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,32 @@ import { useAuthStore } from '@/core/auth';

export const AccountDropdown = () => {
const { t } = useTranslation();
const { userData, logout } = useAuthStore();
const { logout } = useAuthStore();

const userName = userData?.name || t('No Username');
return (
<DropButton
aria-label={t('My account')}
button={
<Box $flex $direction="row" $align="center">
<Text $theme="primary">{userName}</Text>
<Text $theme="primary">{t('My account')}</Text>
<Text className="material-icons" $theme="primary" aria-hidden="true">
arrow_drop_down
</Text>
</Box>
}
>
<Box $css="display: flex; direction: column; gap: 0.5rem">
<Button
onClick={logout}
key="logout"
color="primary-text"
icon={
<span className="material-icons" aria-hidden="true">
logout
</span>
}
aria-label={t('Logout')}
>
<Text $weight="normal">{t('Logout')}</Text>
</Button>
</Box>
<Button
onClick={logout}
color="primary-text"
icon={
<span className="material-icons" aria-hidden="true">
logout
</span>
}
aria-label={t('Logout')}
>
<Text $weight="normal">{t('Logout')}</Text>
</Button>
</DropButton>
);
};

This file was deleted.

2 changes: 1 addition & 1 deletion src/frontend/apps/desk/src/i18n/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@
"Member icon": "Icône de membre",
"Member {{name}} added to the team": "Membre {{name}} ajouté au groupe",
"More info?": "Plus d'infos ?",
"My account": "Mon compte",
"Names": "Noms",
"New name...": "Nouveau nom...",
"No Username": "Aucun nom d'utilisateur",
"No domains exist.": "Aucun domaine existant.",
"No mail box was created with this mail domain.": "Aucune boîte mail n'a été créée avec ce nom de domaine.",
"Nothing exceptional, no special privileges related to a .gouv.fr.": "Rien d'exceptionnel, pas de privilèges spéciaux liés à un .gouv.fr.",
Expand Down
10 changes: 4 additions & 6 deletions src/frontend/apps/e2e/__tests__/app-desk/header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test.beforeEach(async ({ page, browserName }) => {
});

test.describe('Header', () => {
test('checks all the elements are visible', async ({ page, browserName }) => {
test('checks all the elements are visible', async ({ page }) => {
const header = page.locator('header').first();

await expect(header.getByAltText('Marianne Logo')).toBeVisible();
Expand Down Expand Up @@ -37,15 +37,13 @@ test.describe('Header', () => {
).toBeVisible();

await expect(header.getByRole('combobox').getByText('EN')).toBeVisible();
await expect(
header.getByText(new RegExp(`E2E ${browserName}`, 'i')),
).toBeVisible();
await expect(header.getByText('My account')).toBeVisible();
});

test('checks logout button', async ({ page, browserName }) => {
test('checks logout button', async ({ page }) => {
await page
.getByRole('button', {
name: new RegExp(`E2E ${browserName}`, 'i'),
name: 'My account',
})
.click();

Expand Down
Loading