💬(frontend) change literal occurances of pad to document

- change urls from /pads to /docs
- change part of the litteral occurances of pad to document
This commit is contained in:
Anthony LC
2024-05-27 13:27:49 +02:00
committed by Anthony LC
parent d0d0b44f57
commit 0727fe0273
21 changed files with 132 additions and 116 deletions

View File

@@ -16,6 +16,8 @@ and this project adheres to
## Changed
- Change most of the occurences from pad to document (#76)
- Change site from Impress to Docs (#76)
- Generate PDF from a modal (#68)
- Remove trigger workflow on push tags on CI (#68)

View File

@@ -30,14 +30,16 @@ export const createPad = async (
length: number,
isPublic: boolean = false,
) => {
const panel = page.getByLabel('Pads panel').first();
const buttonCreate = page.getByRole('button', { name: 'Create the pad' });
const panel = page.getByLabel('Documents panel').first();
const buttonCreate = page.getByRole('button', {
name: 'Create the document',
});
const randomPads = randomName(padName, browserName, length);
for (let i = 0; i < randomPads.length; i++) {
await panel.getByRole('button', { name: 'Add a pad' }).click();
await page.getByText('Pad name').fill(randomPads[i]);
await panel.getByRole('button', { name: 'Add a document' }).click();
await page.getByText('Document name').fill(randomPads[i]);
if (isPublic) {
await page.getByText('Is it public ?').click();

View File

@@ -11,7 +11,7 @@ test.describe('Language', () => {
test('checks the language picker', async ({ page }) => {
await expect(
page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
}),
).toBeVisible();
@@ -22,7 +22,7 @@ test.describe('Language', () => {
await expect(
page.getByRole('button', {
name: 'Créer un nouveau pad',
name: 'Créer un nouveau document',
}),
).toBeVisible();
});

View File

@@ -10,20 +10,20 @@ test.beforeEach(async ({ page, browserName }) => {
test.describe('Pad Create', () => {
test('checks all the create pad elements are visible', async ({ page }) => {
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await expect(card.getByLabel('Pad name')).toBeVisible();
await expect(card.getByLabel('Document name')).toBeVisible();
await expect(card.getByLabel('icon group')).toBeVisible();
await expect(
card.getByRole('heading', {
name: 'Name the pad',
name: 'Name the document',
level: 3,
}),
).toBeVisible();
@@ -32,7 +32,7 @@ test.describe('Pad Create', () => {
await expect(
card.getByRole('button', {
name: 'Create the pad',
name: 'Create the document',
}),
).toBeVisible();
@@ -45,12 +45,12 @@ test.describe('Pad Create', () => {
test('checks the cancel button interaction', async ({ page }) => {
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await buttonCreateHomepage.click();
await expect(buttonCreateHomepage).toBeHidden();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await card
.getByRole('button', {
@@ -65,18 +65,18 @@ test.describe('Pad Create', () => {
page,
browserName,
}) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
const padName = `My routing pad ${browserName}-${Math.floor(Math.random() * 1000)}`;
await page.getByText('Pad name').fill(padName);
await page.getByRole('button', { name: 'Create the pad' }).click();
await page.getByText('Document name').fill(padName);
await page.getByRole('button', { name: 'Create the document' }).click();
const elPad = page.locator('h2').getByText(padName);
await expect(elPad).toBeVisible();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
await expect(elPad).toBeHidden();
await panel.locator('li').getByText(padName).click();
@@ -87,18 +87,18 @@ test.describe('Pad Create', () => {
await expect(page).toHaveURL('/');
const buttonCreateHomepage = page.getByRole('button', {
name: 'Create a new pad',
name: 'Create a new document',
});
await expect(buttonCreateHomepage).toBeVisible();
await page.goto('/pads');
await page.goto('/docs');
await expect(buttonCreateHomepage).toBeVisible();
await expect(page).toHaveURL(/\/pads$/);
await expect(page).toHaveURL(/\/docs$/);
});
test('checks 404 on pads/[id] page', async ({ page }) => {
await page.goto('/pads/some-unknown-pad');
test('checks 404 on docs/[id] page', async ({ page }) => {
await page.goto('/docs/some-unknown-pad');
await expect(
page.getByText(
'It seems that the page you are looking for does not exist or cannot be displayed correctly.',
@@ -114,14 +114,14 @@ test.describe('Pad Create', () => {
response.url().includes('/documents/') && response.status() === 201,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByRole('button', { name: 'Add a pad' }).click();
await panel.getByRole('button', { name: 'Add a document' }).click();
const padName = `My routing pad ${browserName}-${Math.floor(Math.random() * 1000)}`;
await page.getByText('Pad name').fill(padName);
await page.getByText('Document name').fill(padName);
await page.getByText('Is it public ?').click();
await page.getByRole('button', { name: 'Create the pad' }).click();
await page.getByRole('button', { name: 'Create the document' }).click();
const responsePad = await responsePromisePad;
const is_public = (await responsePad.json()).is_public;

View File

@@ -86,7 +86,7 @@ test.describe('Pad Editor', () => {
2,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(firstPad).click();
@@ -116,7 +116,7 @@ test.describe('Pad Editor', () => {
}) => {
const [pad] = await createPad(page, 'pad-save-page', browserName, 1);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(pad).click();
@@ -129,14 +129,14 @@ test.describe('Pad Editor', () => {
await panel
.getByRole('button', {
name: 'Add a pad',
name: 'Add a document',
})
.click();
const card = page.getByLabel('Create new pad card').first();
const card = page.getByLabel('Create new document card').first();
await expect(
card.getByRole('heading', {
name: 'Name the pad',
name: 'Name the document',
level: 3,
}),
).toBeVisible();
@@ -151,7 +151,7 @@ test.describe('Pad Editor', () => {
test('it saves the doc when we quit pages', async ({ page, browserName }) => {
const [pad] = await createPad(page, 'pad-save-quit', browserName, 1);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
// Check the first pad
await panel.getByText(pad).click();
@@ -188,7 +188,7 @@ test.describe('Pad Editor', () => {
await keyCloakSignIn(page, newBrowserName);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByText(padName).click();
await expect(

View File

@@ -9,21 +9,21 @@ test.beforeEach(async ({ page, browserName }) => {
await keyCloakSignIn(page, browserName);
});
test.describe('Pads Panel', () => {
test.describe('Documents Panel', () => {
test('checks all the elements are visible', async ({ page }) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(panel.getByText('Documents')).toBeVisible();
await expect(
panel.getByRole('button', {
name: 'Sort the pads',
name: 'Sort the documents',
}),
).toBeVisible();
await expect(
panel.getByRole('button', {
name: 'Add a pad',
name: 'Add a document',
}),
).toBeVisible();
});
@@ -41,11 +41,11 @@ test.describe('Pads Panel', () => {
response.status() === 200,
);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel
.getByRole('button', {
name: 'Sort the pads by creation date ascendent',
name: 'Sort the documents by creation date ascendent',
})
.click();
@@ -54,7 +54,7 @@ test.describe('Pads Panel', () => {
await panel
.getByRole('button', {
name: 'Sort the pads by creation date descendent',
name: 'Sort the documents by creation date descendent',
})
.click();
@@ -64,7 +64,7 @@ test.describe('Pads Panel', () => {
test('checks the infinite scroll', async ({ page, browserName }) => {
test.setTimeout(90000);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
const randomPads = await createPad(page, 'pad-infinite', browserName, 40);
@@ -76,7 +76,7 @@ test.describe('Pads Panel', () => {
});
test('checks the hover and selected state', async ({ page, browserName }) => {
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await createPad(page, 'pad-hover', browserName, 2);
const selectedPad = panel.locator('li').nth(0);

View File

@@ -73,7 +73,7 @@ test.describe('Pad Tools', () => {
page.getByRole('checkbox', { name: 'Is it public ?' }),
).toBeChecked();
await page.getByText('Pad name').fill(`${randomPad}-updated`);
await page.getByText('Document name').fill(`${randomPad}-updated`);
await page.getByText('Is it public ?').click();
await page
@@ -86,7 +86,7 @@ test.describe('Pad Tools', () => {
page.getByText('The document has been updated.'),
).toBeVisible();
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(
panel.locator('li').getByText(`${randomPad}-updated`),
).toBeVisible();
@@ -129,10 +129,10 @@ test.describe('Pad Tools', () => {
).toBeVisible();
await expect(
page.getByRole('button', { name: 'Create a new pad' }),
page.getByRole('button', { name: 'Create a new document' }),
).toBeVisible();
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await expect(panel.locator('li').getByText(randomPad)).toBeHidden();
});
@@ -158,7 +158,7 @@ test.describe('Pad Tools', () => {
await keyCloakSignIn(page, newBrowserName);
const panel = page.getByLabel('Pads panel').first();
const panel = page.getByLabel('Documents panel').first();
await panel.getByText(padName).click();
await page.getByLabel('Open the document options').click();

View File

@@ -8,12 +8,8 @@ server {
try_files $uri index.html $uri/ =404;
}
location /pads/ {
error_page 404 /pads/[id]/;
}
location /templates/ {
error_page 404 /templates/[id]/;
location /docs/ {
error_page 404 /docs/[id]/;
}
error_page 404 /404.html;

View File

@@ -11,7 +11,7 @@ describe('Page', () => {
expect(
screen.getByRole('button', {
name: /Create a new pad/i,
name: /Create a new document/i,
}),
).toBeInTheDocument();
});

View File

@@ -21,7 +21,7 @@ export const CardCreatePad = () => {
error,
} = useCreatePad({
onSuccess: (pad) => {
router.push(`/pads/${pad.id}`);
router.push(`/docs/${pad.id}`);
},
});
const [padName, setPadName] = useState('');
@@ -36,7 +36,7 @@ export const CardCreatePad = () => {
$width="100%"
$maxWidth="24rem"
$minWidth="22rem"
aria-label={t('Create new pad card')}
aria-label={t('Create new document card')}
>
<Box $gap="1rem">
<Box $align="center">
@@ -46,11 +46,11 @@ export const CardCreatePad = () => {
aria-label={t('icon group')}
/>
<Text as="h3" $textAlign="center">
{t('Name the pad')}
{t('Name the document')}
</Text>
</Box>
<InputPadName
label={t('Pad name')}
label={t('Document name')}
{...{ error, isError, isPending, setPadName }}
/>
<Switch
@@ -67,7 +67,7 @@ export const CardCreatePad = () => {
onClick={() => createPad({ title: padName, is_public: padPublic })}
disabled={!padName}
>
{t('Create the pad')}
{t('Create the document')}
</Button>
</Box>
</Card>

View File

@@ -99,7 +99,7 @@ export const ModalUpdatePad = ({ onClose, pad }: ModalUpdatePadProps) => {
<Box $gap="1rem">
<InputPadName
label={t('Pad name')}
label={t('Document name')}
defaultValue={title}
{...{ error, isError, isPending, setPadName: setTitle }}
/>

View File

@@ -34,7 +34,7 @@ describe('PanelPads', () => {
expect(
await screen.findByText(
'Create your first pad by clicking on the "Create a new pad" button.',
'Create your first document by clicking on the "Create a new document" button.',
),
).toBeInTheDocument();
});
@@ -126,7 +126,7 @@ describe('PanelPads', () => {
).toBeInTheDocument();
});
it('renders with pad panel open', async () => {
it('renders with doc panel open', async () => {
fetchMock.mock(`end:/api/documents/?page=1&ordering=-created_at`, {
count: 1,
results: [],
@@ -135,13 +135,13 @@ describe('PanelPads', () => {
render(<Panel />, { wrapper: AppWrapper });
expect(
screen.getByRole('button', { name: 'Close the pads panel' }),
screen.getByRole('button', { name: 'Close the documents panel' }),
).toBeVisible();
expect(await screen.findByText('Documents')).toBeVisible();
});
it('closes and opens the pad panel', async () => {
it('closes and opens the doc panel', async () => {
fetchMock.mock(`end:/api/documents/?page=1&ordering=-created_at`, {
count: 1,
results: [],
@@ -153,7 +153,7 @@ describe('PanelPads', () => {
await userEvent.click(
screen.getByRole('button', {
name: 'Close the pads panel',
name: 'Close the documents panel',
}),
);
@@ -161,7 +161,7 @@ describe('PanelPads', () => {
await userEvent.click(
screen.getByRole('button', {
name: 'Open the pads panel',
name: 'Open the documents panel',
}),
);

View File

@@ -63,7 +63,7 @@ export const PadItem = ({ pad }: PadItemProps) => {
${isActive ? activeStyle : hoverStyle}
`}
>
<StyledLink className="p-s pt-t pb-t" href={`/pads/${pad.id}`}>
<StyledLink className="p-s pt-t pb-t" href={`/docs/${pad.id}`}>
<Box $align="center" $direction="row" $gap="0.5rem">
{hasMembers ? (
<IconGroup

View File

@@ -50,7 +50,7 @@ const PadListState = ({ isLoading, isError, pads }: PanelTeamsStateProps) => {
</Text>
<Text as="p" $theme="greyscale" $variation="500">
{t(
'Create your first pad by clicking on the "Create a new pad" button.',
'Create your first document by clicking on the "Create a new document" button.',
)}
</Text>
</Box>

View File

@@ -32,13 +32,15 @@ export const Panel = () => {
transition: ${transition};
`}
$height="inherit"
aria-label="Pads panel"
aria-label="Documents panel"
{...closedOverridingStyles}
>
<BoxButton
className="material-icons"
aria-label={
isOpen ? t('Close the pads panel') : t('Open the pads panel')
isOpen
? t('Close the documents panel')
: t('Open the documents panel')
}
$background="white"
$color={colorsTokens()['primary-600']}

View File

@@ -33,22 +33,26 @@ export const PanelActions = () => {
<BoxButton
aria-label={
isSortAsc
? t('Sort the pads by creation date descendent')
: t('Sort the pads by creation date ascendent')
? t('Sort the documents by creation date descendent')
: t('Sort the documents by creation date ascendent')
}
onClick={changeOrdering}
$radius="100%"
$background={isSortAsc ? colorsTokens()['primary-200'] : 'transparent'}
$color={colorsTokens()['primary-600']}
>
<IconSort width={30} height={30} aria-label={t('Sort pads icon')} />
<IconSort
width={30}
height={30}
aria-label={t('Sort documents icon')}
/>
</BoxButton>
<StyledLink href="/pads/create">
<StyledLink href="/docs/create">
<BoxButton
aria-label={t('Add a pad')}
aria-label={t('Add a document')}
$color={colorsTokens()['primary-600']}
>
<IconAdd width={30} height={30} aria-label={t('Add pad icon')} />
<IconAdd width={30} height={30} aria-label={t('Add document icon')} />
</BoxButton>
</StyledLink>
</Box>

View File

@@ -3,56 +3,66 @@
"fr": {
"translation": {
"0 group to display.": "0 groupe à afficher.",
"Add a pad": "Ajouter un pad",
"Add a template": "Ajouter un template",
"Add pad icon": "Icône ajout de pad",
"Add template icon": "Icône ajout de template",
"Accessibility": "Accessibilité",
"Add a document": "Ajouter un document",
"Add document icon": "Icône ajouter un document",
"Are you sure you want to delete the document \"{{title}}\"?": "Êtes-vous sûr de vouloir supprimer le document \"{{title}} \" ?",
"Back to home page": "Retour à l'accueil",
"Cancel": "Annuler",
"Close the pads panel": "Fermer le panneau des pads",
"Close the templates panel": "Fermer le panneau des templates",
"Create new pad card": "Créer une nouvelle carte pad",
"Create new template card": "Carte créer un nouveau template",
"Create a new pad": "Créer un nouveau pad",
"Create the pad": "Créer le pad",
"Create the template": "Créer le template",
"Create your first pad by clicking on the \"Create a new pad\" button.": "Créez votre premier pad en cliquant sur le bouton \"Créer un nouveau pad\".",
"Create your first template by clicking on the \"Create a new template\" button.": "Créez votre premier template en cliquant sur le bouton \"Créer un nouveau template\".",
"Close the docs panel": "Fermer le panneau des docs",
"Close the modal": "Fermer la modale",
"Coming soon ...": "Coming soon ...",
"Confirm deletion": "Confirmer la suppression",
"Content modal to delete document": "Contenu modal pour supprimer le document",
"Content modal to generate a PDF": "Contenu modal pour générer un PDF",
"Content modal to update the document": "Contenu modal pour mettre à jour le groupe",
"Create a new document": "Créer un nouveau document",
"Create new document card": "Carte créer un nouveau groupe",
"Create the document": "Créer le document",
"Create your first document by clicking on the \"Create a new document\" button.": "Créez votre premier document en cliquant sur le bouton \"Créer un nouveau document\".",
"Delete document": "Supprimer le document",
"Deleting the document \"{{title}}\"": "Suppression du document \"{{title}}\"",
"Docs": "Docs",
"Docs Description": "Description de Docs",
"Docs Logo": "Logo Docs",
"Document icon": "Icône du document",
"Document name": "Nom du document",
"Documents": "Documents",
"Download": "Télécharger",
"Empty pads icon": "Icône des pads vides",
"Empty templates icon": "Icône de template vide",
"Enter the new name of the selected document.": "Entrez le nouveau nom du document sélectionné.",
"Freedom Equality Fraternity Logo": "Logo Liberté Égalité Fraternité",
"Generate PDF": "Générer PDF",
"Impress": "Impress",
"Impress Logo": "Impress logo",
"Generate a PDF from your document, it will be inserted in the selected template.": "Générez un PDF à partir de votre document, il sera inséré dans le modèle sélectionné.",
"Is it public ?": "Est-ce public?",
"It seems that the page you are looking for does not exist or cannot be displayed correctly.": "Il semble que la page que vous cherchez n'existe pas ou ne puisse pas être affichée correctement.",
"Language": "Langue",
"Language Icon": "Icône de langue",
"Legal Notice": "Mentions Legales",
"Legal notice": "Mention légale",
"Logout": "Se déconnecter",
"Marianne Logo": "Logo Marianne",
"Name the pad": "Nommer le pad",
"Name the template": "Nommer le template",
"My account": "Mon compte",
"Name the document": "Nommer le document",
"No editor found": "Pas d'éditeur trouvé",
"Open the pads panel": "Ouvrir le panneau des pads",
"Open the templates panel": "Ouvrir le panneau des templates",
"Pad": "Pad",
"Pad name": "Nom du pad",
"Open the docs panel": "Ouvrir le panneau des docs",
"Open the document options": "Ouvrir les options du document",
"Ouch !": "Aïe !",
"Pads icon": "Icône de pads",
"Profile picture": "Photo du profil",
"Recents": "Récents",
"Personal data and cookies": "Données personnelles et cookies",
"Something bad happens, please refresh the page.": "Une erreur inattendue s'est produite, rechargez la page.",
"Something bad happens, please retry.": "Une erreur inattendue s'est produite, veuillez réessayer.",
"Sort pads icon": "Icône trier les pads",
"Sort templates icon": "Icône trier les templates",
"Sort the pads by creation date ascendent": "Trier les pads par date de création ascendante",
"Sort the pads by creation date descendent": "Trier les pads par date de création décroissante",
"Sort the templates by creation date ascendent": "Trier les templates par date de création ascendante",
"Sort the templates by creation date descendent": "Trier les templates par date de création décroissante",
"Sort documents icon": "Icône trier les documents",
"Sort the documents by creation date ascendent": "Trier les documents par date de création ascendante",
"Sort the documents by creation date descendent": "Trier les documents par date de création descendante",
"Template": "Template",
"Template name": "Nom du template",
"Template save successfully": "Template sauvegardé avec succès",
"Templates icon": "Icône des templates",
"The document has been deleted.": "Le document a bien été supprimé.",
"The document has been updated.": "Le document a été mis à jour.",
"Update document": "Mettre à jour le document",
"Update document \"{{documentTitle}}\"": "Mettre à jour le document \"{{documentTitle}}\"",
"Validate the modification": "Valider les modifications",
"Your pdf was downloaded succesfully": "Votre pdf a été téléchargé avec succès",
"icon group": "icône groupe",
"{{label}} button": "Bouton {{label}}",
"{{label}} icon": "Icône {{label}}"
"icon group": "icône groupe"
}
}
}

View File

@@ -16,8 +16,8 @@ const Page: NextPageWithLayout = () => {
return (
<Box $align="center" $justify="center" $height="inherit">
<StyledLink href="/pads/create">
<StyledButton>{t('Create a new pad')}</StyledButton>
<StyledLink href="/docs/create">
<StyledButton>{t('Create a new document')}</StyledButton>
</StyledLink>
</Box>
);

View File

@@ -3,7 +3,7 @@ import type { ReactElement } from 'react';
import { PadLayout } from '@/layouts';
import { NextPageWithLayout } from '@/types/next';
import Pads from './pads/';
import Pads from './docs';
const Page: NextPageWithLayout = () => {
return <Pads />;