diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx index 4d6992f7..a2399c72 100644 --- a/web/src/components/MemoEditor.tsx +++ b/web/src/components/MemoEditor.tsx @@ -1,7 +1,7 @@ import { IEmojiData } from "emoji-picker-react"; import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; -import { deleteMemoResource, getMemoResourceList, upsertMemoResource } from "../helpers/api"; +import { deleteMemoResource, upsertMemoResource } from "../helpers/api"; import { UNKNOWN_ID } from "../helpers/consts"; import { editorStateService, locationService, memoService, resourceService } from "../services"; import { useAppSelector } from "../store"; @@ -64,11 +64,9 @@ const MemoEditor: React.FC = () => { ) { const memo = memoService.getMemoById(editorState.editMemoId ?? UNKNOWN_ID); if (memo) { - getMemoResourceList(memo.id).then(({ data: { data } }) => { - setState({ - ...state, - resourceList: data, - }); + setState({ + ...state, + resourceList: memo.resourceList, }); editorRef.current?.setContent(memo.content ?? ""); editorRef.current?.focus(); @@ -341,7 +339,8 @@ const MemoEditor: React.FC = () => {
diff --git a/web/src/components/ResourcesDialog.tsx b/web/src/components/ResourcesDialog.tsx index b90935bc..33148758 100644 --- a/web/src/components/ResourcesDialog.tsx +++ b/web/src/components/ResourcesDialog.tsx @@ -104,9 +104,14 @@ const ResourcesDialog: React.FC = (props: Props) => { }; const handleDeleteResourceBtnClick = (resource: Resource) => { + let warningText = "Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE.❗️"; + if (resource.linkedMemoAmount > 0) { + warningText = warningText + `\nLinked memo amount: ${resource.linkedMemoAmount}`; + } + showCommonDialog({ title: `Delete Resource`, - content: `Are you sure to delete this resource? THIS ACTION IS IRREVERSIABLE.❗️`, + content: warningText, style: "warning", onConfirm: async () => { await resourceService.deleteResourceById(resource.id); diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 7632007c..7ab76f35 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -76,25 +76,28 @@ const UserBanner = () => { {!userService.isVisitorMode() && ( <> )} - {!userService.isVisitorMode() && (