ソースを参照

Merge branch 'feat/131878-refactoring-of-event-handler' into dev/7.0.x

WNomunomu 2 年 前
コミット
b564be334c
2 ファイル変更14 行追加4 行削除
  1. 1 0
      apps/app/src/interfaces/ui.ts
  2. 13 4
      apps/app/src/stores/modal.tsx

+ 1 - 0
apps/app/src/interfaces/ui.ts

@@ -26,3 +26,4 @@ export type OnRenamedFunction = (path: string) => void;
 export type OnDuplicatedFunction = (fromPath: string, toPath: string) => void;
 export type OnPutBackedFunction = (path: string) => void;
 export type onDeletedBookmarkFolderFunction = (bookmarkFolderId: string) => void;
+export type OnSelectedFunction = () => void;

+ 13 - 4
apps/app/src/stores/modal.tsx

@@ -8,8 +8,8 @@ import { SWRResponse } from 'swr';
 import Linker from '~/client/models/Linker';
 import MarkdownTable from '~/client/models/MarkdownTable';
 import { BookmarkFolderItems } from '~/interfaces/bookmark-info';
-import {
-  OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction, OnPutBackedFunction, onDeletedBookmarkFolderFunction,
+import type {
+  OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction, OnPutBackedFunction, onDeletedBookmarkFolderFunction, OnSelectedFunction,
 } from '~/interfaces/ui';
 import loggerFactory from '~/utils/logger';
 
@@ -743,8 +743,13 @@ export const useLinkEditModal = (): SWRResponse<LinkEditModalStatus, Error> & Li
 /*
 * PageSelectModal
 */
+export type IPageSelectModalOption = {
+  onSelected?: OnSelectedFunction,
+}
+
 type PageSelectModalStatus = {
-  isOpened: boolean;
+  isOpened: boolean
+  opts?: IPageSelectModalOption
 }
 
 type PageSelectModalStatusUtils = {
@@ -760,7 +765,11 @@ export const usePageSelectModal = (
 
   return {
     ...swrResponse,
-    open: () => swrResponse.mutate({ isOpened: true }),
+    open: (
+        opts?: IPageSelectModalOption,
+    ) => swrResponse.mutate({
+      isOpened: true, opts,
+    }),
     close: () => swrResponse.mutate({ isOpened: false }),
   };
 };