(frontend) implement document favorites feature

- Added functionality to mark documents as favorites, including new
hooks `useMakeFavoriteDoc` and `useRemoveFavoriteDoc` for managing
favorite status.
- Enhanced the document management API to support favorite filtering
with the `is_favorite` parameter.
- Created a new e2e test for the favorite workflow to ensure proper
functionality.
- Updated the UI components to reflect favorite status, including
changes in `DocsGridActions`, `DocsGridItem`, and the new
`LeftPanelFavorites` component for displaying pinned documents.
- Adjusted SVG assets for better visual representation of pinned
documents.
This commit is contained in:
Nathan Panchout
2024-12-17 22:11:40 +01:00
committed by Anthony LC
parent 4f4c8905ff
commit 63885117e1
15 changed files with 315 additions and 21 deletions

View File

@@ -96,7 +96,7 @@ test.describe('Document grid item options', () => {
let docs: SmallDoc[] = [];
const response = await page.waitForResponse(
(response) =>
response.url().includes('documents/?page=1') &&
response.url().endsWith('documents/?page=1') &&
response.status() === 200,
);
const result = await response.json();
@@ -124,7 +124,7 @@ test.describe('Document grid item options', () => {
const refetchResponse = await page.waitForResponse(
(response) =>
response.url().includes('documents/?page=1') &&
response.url().endsWith('documents/?page=1') &&
response.status() === 200,
);
@@ -189,7 +189,7 @@ test.describe('Documents filters', () => {
await expect(page.getByTestId('docs-grid-loader')).toBeVisible();
const response = await page.waitForResponse(
(response) =>
response.url().includes('documents/?page=1') &&
response.url().endsWith('documents/?page=1') &&
response.status() === 200,
);
const result = await response.json();
@@ -230,7 +230,7 @@ test.describe('Documents filters', () => {
await expect(page.getByTestId('docs-grid-loader')).toBeVisible();
const responseMyDocs = await page.waitForResponse(
(response) =>
response.url().includes('documents/?page=1&is_creator_me=true') &&
response.url().endsWith('documents/?page=1&is_creator_me=true') &&
response.status() === 200,
);
const resultMyDocs = await responseMyDocs.json();
@@ -268,7 +268,7 @@ test.describe('Documents Grid', () => {
const response = await page.waitForResponse(
(response) =>
response.url().includes('documents/?page=1') &&
response.url().endsWith('documents/?page=1') &&
response.status() === 200,
);
const result = await response.json();
@@ -294,13 +294,13 @@ test.describe('Documents Grid', () => {
let docs: SmallDoc[] = [];
const responsePromisePage1 = page.waitForResponse(
(response) =>
response.url().includes(`/documents/?page=1`) &&
response.url().endsWith(`/documents/?page=1`) &&
response.status() === 200,
);
const responsePromisePage2 = page.waitForResponse(
(response) =>
response.url().includes(`/documents/?page=2`) &&
response.url().endsWith(`/documents/?page=2`) &&
response.status() === 200,
);