mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
refactor: optimize the use of notification center (#3621)
This commit is contained in:
@@ -9,7 +9,6 @@ import {
|
||||
ExportToPdfIcon,
|
||||
ExportToPngIcon,
|
||||
} from '@blocksuite/icons';
|
||||
import { uuidv4 } from '@blocksuite/store';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@@ -41,7 +40,6 @@ export const ExportToPdfMenuItem = ({
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'pdf' });
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.success.title'](),
|
||||
message: t['com.affine.export.success.message'](),
|
||||
type: 'success',
|
||||
@@ -50,7 +48,6 @@ export const ExportToPdfMenuItem = ({
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.error.title'](),
|
||||
message: t['com.affine.export.error.message'](),
|
||||
type: 'error',
|
||||
@@ -64,7 +61,6 @@ export const ExportToPdfMenuItem = ({
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'pdf' });
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.success.title'](),
|
||||
message: t['com.affine.export.success.message'](),
|
||||
type: 'success',
|
||||
@@ -73,7 +69,6 @@ export const ExportToPdfMenuItem = ({
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.error.title'](),
|
||||
message: t['com.affine.export.error.message'](),
|
||||
type: 'error',
|
||||
@@ -110,7 +105,6 @@ export const ExportToHtmlMenuItem = ({
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'html' });
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.success.title'](),
|
||||
message: t['com.affine.export.success.message'](),
|
||||
type: 'success',
|
||||
@@ -119,7 +113,6 @@ export const ExportToHtmlMenuItem = ({
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.error.title'](),
|
||||
message: t['com.affine.export.error.message'](),
|
||||
type: 'error',
|
||||
@@ -159,7 +152,6 @@ export const ExportToPngMenuItem = ({
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'png' });
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.success.title'](),
|
||||
message: t['com.affine.export.success.message'](),
|
||||
type: 'success',
|
||||
@@ -168,7 +160,6 @@ export const ExportToPngMenuItem = ({
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.error.title'](),
|
||||
message: t['com.affine.export.error.message'](),
|
||||
type: 'error',
|
||||
@@ -206,7 +197,6 @@ export const ExportToMarkdownMenuItem = ({
|
||||
.then(() => {
|
||||
onSelect?.({ type: 'markdown' });
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.success.title'](),
|
||||
message: t['com.affine.export.success.message'](),
|
||||
type: 'success',
|
||||
@@ -215,7 +205,6 @@ export const ExportToMarkdownMenuItem = ({
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
setPushNotification({
|
||||
key: uuidv4(),
|
||||
title: t['com.affine.export.error.title'](),
|
||||
message: t['com.affine.export.error.message'](),
|
||||
type: 'error',
|
||||
|
||||
Reference in New Issue
Block a user