Mao il y a 4 ans
Parent
commit
195faa7657

+ 1 - 1
packages/app/src/components/Page/PageManagement.jsx

@@ -29,7 +29,7 @@ const LegacyPageManagemenet = (props) => {
   const [isPageTemplateModalShown, setIsPageTempleteModalShown] = useState(false);
   const [isPageTemplateModalShown, setIsPageTempleteModalShown] = useState(false);
   const [isPageDeleteModalShown, setIsPageDeleteModalShown] = useState(false);
   const [isPageDeleteModalShown, setIsPageDeleteModalShown] = useState(false);
   const [isPagePresentationModalShown, setIsPagePresentationModalShown] = useState(false);
   const [isPagePresentationModalShown, setIsPagePresentationModalShown] = useState(false);
-  const presentationHref = new URL(urljoin(window.location.origin, path, '?presentation=1')).href;
+  const presentationHref = urljoin(window.location.origin, path, '?presentation=1');
 
 
   function openPageRenameModalHandler() {
   function openPageRenameModalHandler() {
     setIsPageRenameModalShown(true);
     setIsPageRenameModalShown(true);

+ 4 - 3
packages/app/src/components/SearchPage/SearchResultContentSubNavigation.tsx

@@ -1,4 +1,5 @@
 import React, { FC, useCallback } from 'react';
 import React, { FC, useCallback } from 'react';
+import { pagePathUtils } from '@growi/core';
 import PagePathNav from '../PagePathNav';
 import PagePathNav from '../PagePathNav';
 import { withUnstatedContainers } from '../UnstatedUtils';
 import { withUnstatedContainers } from '../UnstatedUtils';
 import AppContainer from '../../client/services/AppContainer';
 import AppContainer from '../../client/services/AppContainer';
@@ -23,6 +24,8 @@ const SearchResultContentSubNavigation: FC<Props> = (props : Props) => {
     appContainer, pageId, revisionId, path, isCompactMode, isSignleLineMode,
     appContainer, pageId, revisionId, path, isCompactMode, isSignleLineMode,
   } = props;
   } = props;
 
 
+  const { isTrashPage } = pagePathUtils;
+
   const { data: tagInfoData, error: tagInfoError, mutate: mutateTagInfo } = useSWRTagsInfo(pageId);
   const { data: tagInfoData, error: tagInfoError, mutate: mutateTagInfo } = useSWRTagsInfo(pageId);
 
 
   const tagsUpdatedHandler = useCallback(async(newTags) => {
   const tagsUpdatedHandler = useCallback(async(newTags) => {
@@ -40,9 +43,7 @@ const SearchResultContentSubNavigation: FC<Props> = (props : Props) => {
     return <></>;
     return <></>;
   }
   }
   const { isSharedUser } = appContainer;
   const { isSharedUser } = appContainer;
-  // path : /trash/hoge. subStr(0,7) => /trash/
-  const isTrashPage = path.substr(0, 7) === '/trash/';
-  const isAbleToShowPageManagement = !isTrashPage && !isSharedUser;
+  const isAbleToShowPageManagement = !(isTrashPage(path)) && !isSharedUser;
   return (
   return (
     <div className={`grw-subnav container-fluid d-flex align-items-center justify-content-between ${isCompactMode ? 'grw-subnav-compact d-print-none' : ''}`}>
     <div className={`grw-subnav container-fluid d-flex align-items-center justify-content-between ${isCompactMode ? 'grw-subnav-compact d-print-none' : ''}`}>
       {/* Left side */}
       {/* Left side */}

+ 4 - 0
packages/app/src/interfaces/bookmark-info.ts

@@ -0,0 +1,4 @@
+export type IBookmarkInfo = {
+  sumOfBookmarks: number;
+  isBookmarked: boolean,
+};

+ 2 - 1
packages/app/src/stores/bookmark.ts

@@ -1,9 +1,10 @@
 import useSWR, { SWRResponse } from 'swr';
 import useSWR, { SWRResponse } from 'swr';
 import { apiv3Get } from '../client/util/apiv3-client';
 import { apiv3Get } from '../client/util/apiv3-client';
+import { IBookmarkInfo } from '../interfaces/bookmark-info';
 
 
 
 
 // TODO response type
 // TODO response type
-export const useSWRBookmarkInfo = (pageId: string) => {
+export const useSWRBookmarkInfo = (pageId: string): SWRResponse<IBookmarkInfo, Error> => {
   return useSWR(
   return useSWR(
     `/bookmarks/info?pageId=${pageId}`,
     `/bookmarks/info?pageId=${pageId}`,
     endpoint => apiv3Get(endpoint).then((response) => {
     endpoint => apiv3Get(endpoint).then((response) => {