kosei-n пре 2 година
родитељ
комит
38625ca305

+ 1 - 4
apps/app/src/components/Common/ClosableTextInput.tsx

@@ -40,10 +40,7 @@ const ClosableTextInput: FC<ClosableTextInputProps> = memo((props: ClosableTextI
     setInputText(inputText);
     setIsAbleToShowAlert(true);
 
-    if (props.handleInputChange != null) {
-      props.handleInputChange(inputText);
-    }
-
+    props.handleInputChange?.(inputText);
   };
 
   const onFocusHandler = async(e: React.ChangeEvent<HTMLInputElement>) => {

+ 4 - 1
apps/app/src/components/PageHeader/PagePathHeader.tsx

@@ -3,6 +3,7 @@ import {
 } from 'react';
 
 import type { IPagePopulatedToShowRevision } from '@growi/core';
+import { useTranslation } from 'next-i18next';
 
 import { usePageSelectModal } from '~/stores/modal';
 import { EditorMode, useEditorMode } from '~/stores/ui';
@@ -26,6 +27,8 @@ export const PagePathHeader: FC<Props> = (props) => {
   const [inputText, setInputText] = useState('');
   const [isEditing, setIsEditing] = useState(true);
 
+  const { t } = useTranslation();
+
   const { data: editorMode } = useEditorMode();
   const { data: PageSelectModalData, open: openPageSelectModal } = usePageSelectModal();
   const pagePathSubmitHandler = usePagePathSubmitHandler(currentPage, currentPagePath, setRenameInputShown);
@@ -86,7 +89,7 @@ export const PagePathHeader: FC<Props> = (props) => {
               <>
                 <div className="col-4">
                   <button type="button" onClick={handleEditButtonClick}>
-                    {isEditing ? '完了ボタン' : '編集ボタン'}
+                    {isEditing ? t('Done') : t('Edit')}
                   </button>
                 </div>
                 <div className="col-4">

+ 1 - 1
apps/app/src/components/PageHeader/TextInputForPageTitleAndPath.tsx

@@ -49,7 +49,7 @@ export const TextInputForPageTitleAndPath: FC<Props> = (props) => {
           />
         </div>
       ) : (
-        { CustomComponent }
+        <>{ CustomComponent }</>
       )}
     </>
   );

+ 1 - 3
apps/app/src/components/PageHeader/page-header-utils.ts

@@ -47,9 +47,7 @@ export const usePagePathSubmitHandler = (
         newPagePath,
       });
 
-      if (onRenamed != null) {
-        onRenamed(currentPage.path, newPagePath);
-      }
+      onRenamed(currentPage.path, newPagePath);
 
       toastSuccess(t('renamed_pages', { path: currentPage.path }));
     }

+ 4 - 3
apps/app/src/components/PageSelectModal/PageSelectModal.tsx

@@ -1,5 +1,6 @@
 import React, { FC } from 'react';
 
+import { useTranslation } from 'next-i18next';
 import {
   Modal, ModalHeader, ModalBody, ModalFooter, Button,
 } from 'reactstrap';
@@ -21,6 +22,8 @@ export const PageSelectModal: FC = () => {
 
   const isOpened = PageSelectModalData?.isOpened ?? false;
 
+  const { t } = useTranslation();
+
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isReadOnlyUser } = useIsReadOnlyUser();
   const { data: currentPath } = useCurrentPagePath();
@@ -54,9 +57,7 @@ export const PageSelectModal: FC = () => {
         />
       </ModalBody>
       <ModalFooter>
-        <Button color="primary" onClick={closeModal}>
-          完了
-        </Button>{' '}
+        <Button color="primary" onClick={closeModal}>{t('Done')}</Button>{' '}
       </ModalFooter>
     </Modal>
   );