SULLEY\ryo-h před 4 roky
rodič
revize
bd38a506b9

+ 7 - 8
packages/app/src/components/SearchPage/FilterOptionModal.tsx

@@ -10,11 +10,10 @@ type Props = {
   isOpen: boolean,
   excludeUnderUserPage: boolean,
   excludeUnderTrashPage: boolean,
-  keyword: string,
   onClose?: () => void,
   switchExcludingUnderUserPage?: () => void,
   switchExcludingUnderTrashPage?: () => void,
-  onClickFilteringSearchResultButton?: (data: {keyword: string}) => void,
+  onClickFilteringSearchResultButton?: () => void,
 }
 
 const FilterOptionModal: FC<Props> = (props: Props) => {
@@ -22,7 +21,8 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
   const { t } = useTranslation('');
 
   const {
-    isOpen, keyword, onClose, switchExcludingUnderUserPage, switchExcludingUnderTrashPage,
+    isOpen, onClose, switchExcludingUnderUserPage, switchExcludingUnderTrashPage,
+    excludeUnderUserPage, excludeUnderTrashPage,
   } = props;
 
   const onCloseModal = () => {
@@ -33,7 +33,8 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
 
   const onClickFilteringSearchResultButton = () => {
     if (props.onClickFilteringSearchResultButton != null) {
-      props.onClickFilteringSearchResultButton({ keyword });
+      props.onClickFilteringSearchResultButton();
+      onCloseModal();
     }
   };
 
@@ -50,7 +51,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 onClick={switchExcludingUnderUserPage}
-                checked={}
+                checked={!excludeUnderUserPage}
               />
               {t('Include Subordinated Target Page', { target: '/user' })}
             </label>
@@ -61,7 +62,7 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
                 className="mr-2"
                 type="checkbox"
                 onClick={switchExcludingUnderTrashPage}
-                checked={}
+                checked={!excludeUnderTrashPage}
               />
               {t('Include Subordinated Target Page', { target: '/trash' })}
             </label>
@@ -72,8 +73,6 @@ const FilterOptionModal: FC<Props> = (props: Props) => {
         <button
           type="button"
           className="btn btn-secondary"
-          // todo: implement this method
-          // refs: https://redmine.weseek.co.jp/issues/81845
           onClick={onClickFilteringSearchResultButton}
         >{t('search_result.narrow_donw')}
         </button>

+ 8 - 3
packages/app/src/components/SearchPage/SearchControl.tsx

@@ -11,7 +11,7 @@ type Props = {
   appContainer: AppContainer,
   excludeUnderUserPage: boolean,
   excludeUnderTrashPage: boolean,
-  onSearchInvoked: (data : any[]) => boolean,
+  onSearchInvoked: (data: {keyword: string}) => boolean,
   switchExcludingUnderUserPage?: () => void,
   switchExcludingUnderTrashPage?: () => void,
 }
@@ -59,12 +59,17 @@ const SearchControl: FC <Props> = (props: Props) => {
     setIsFileterOptionModalShown(false);
   };
 
+  const onClickFilteringSearchResultButton = () => {
+    if (props.onSearchInvoked != null) {
+      props.onSearchInvoked({ keyword: props.searchingKeyword });
+    }
+  };
+
   const rednerFilterOptionModal = () => {
     return (
       <FilterOptionModal
-        keyword={props.searchingKeyword}
         isOpen={isFileterOptionModalShown || false}
-        onClickFilteringSearchResultButton={props.onSearchInvoked}
+        onClickFilteringSearchResultButton={onClickFilteringSearchResultButton}
         onClose={closeFilterOptionModalHandler}
         switchExcludingUnderUserPage={switchExcludingUnderUserPage}
         switchExcludingUnderTrashPage={switchExcludingUnderTrashPage}