🔥(frontend) remove saving modal

The saving toast are removed.
Users were complaining about the toast
that was shown when saving a document.
This commit is contained in:
Anthony LC
2024-08-30 15:06:49 +02:00
committed by Anthony LC
parent 00b223f648
commit 3d19893091
3 changed files with 10 additions and 21 deletions

View File

@@ -9,10 +9,18 @@ and this project adheres to
## [Unreleased] ## [Unreleased]
# Added ## Added
- ✨Add image attachments with access control - ✨Add image attachments with access control
- ✨(frontend) Upload image to a document - ✨(frontend) Upload image to a document #211
## Changed
- 🔥(frontend) hide markdown button if not text #213
## Removed
- 🔥(frontend) remove saving modal #213
## [1.2.1] - 2024-08-23 ## [1.2.1] - 2024-08-23

View File

@@ -106,10 +106,6 @@ test.describe('Doc Editor', () => {
nthRow: 2, nthRow: 2,
}); });
await expect(
page.getByText(`Your document "${doc}" has been saved.`),
).toBeVisible();
await expect(page.locator('h2').getByText(secondDoc)).toBeVisible(); await expect(page.locator('h2').getByText(secondDoc)).toBeVisible();
await goToGridDoc(page, { await goToGridDoc(page, {

View File

@@ -1,7 +1,5 @@
import { VariantType, useToastProvider } from '@openfun/cunningham-react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useCallback, useEffect, useRef, useState } from 'react'; import { useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import * as Y from 'yjs'; import * as Y from 'yjs';
import { useUpdateDoc } from '@/features/docs/doc-management/'; import { useUpdateDoc } from '@/features/docs/doc-management/';
@@ -11,22 +9,9 @@ import { useDocStore } from '../stores';
import { toBase64 } from '../utils'; import { toBase64 } from '../utils';
const useSaveDoc = (docId: string, doc: Y.Doc, canSave: boolean) => { const useSaveDoc = (docId: string, doc: Y.Doc, canSave: boolean) => {
const { toast } = useToastProvider();
const { t } = useTranslation();
const { forceSave, setForceSave } = useDocStore(); const { forceSave, setForceSave } = useDocStore();
const { mutate: updateDoc } = useUpdateDoc({ const { mutate: updateDoc } = useUpdateDoc({
onSuccess: (data) => {
toast(
t('Your document "{{docTitle}}" has been saved.', {
docTitle: data.title,
}),
VariantType.SUCCESS,
{
duration: 1500,
},
);
},
listInvalideQueries: [KEY_LIST_DOC_VERSIONS], listInvalideQueries: [KEY_LIST_DOC_VERSIONS],
}); });
const [initialDoc, setInitialDoc] = useState<string>( const [initialDoc, setInitialDoc] = useState<string>(