|
@@ -5,17 +5,16 @@ import Clamp from 'react-multiline-clamp';
|
|
|
import { UserPicture, PageListMeta, PagePathLabel } from '@growi/ui';
|
|
import { UserPicture, PageListMeta, PagePathLabel } from '@growi/ui';
|
|
|
import { DevidedPagePath } from '@growi/core';
|
|
import { DevidedPagePath } from '@growi/core';
|
|
|
import { useIsDeviceSmallerThanLg } from '~/stores/ui';
|
|
import { useIsDeviceSmallerThanLg } from '~/stores/ui';
|
|
|
-import { IPageWithMeta } from '~/interfaces/page';
|
|
|
|
|
|
|
+import { IPageInfoForList, IPageWithMeta, isIPageInfoForList } from '~/interfaces/page';
|
|
|
import { IPageSearchMeta, isIPageSearchMeta } from '~/interfaces/search';
|
|
import { IPageSearchMeta, isIPageSearchMeta } from '~/interfaces/search';
|
|
|
|
|
|
|
|
import { AsyncPageItemControl } from '../Common/Dropdown/PageItemControl';
|
|
import { AsyncPageItemControl } from '../Common/Dropdown/PageItemControl';
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
- page: IPageWithMeta | IPageWithMeta<IPageSearchMeta>,
|
|
|
|
|
|
|
+ page: IPageWithMeta | IPageWithMeta<IPageSearchMeta> | IPageWithMeta<IPageInfoForList>,
|
|
|
isSelected?: boolean, // is item selected(focused)
|
|
isSelected?: boolean, // is item selected(focused)
|
|
|
isChecked?: boolean, // is checkbox of item checked
|
|
isChecked?: boolean, // is checkbox of item checked
|
|
|
isEnableActions?: boolean,
|
|
isEnableActions?: boolean,
|
|
|
- shortBody?: string
|
|
|
|
|
showPageUpdatedTime?: boolean, // whether to show page's updated time at the top-right corner of item
|
|
showPageUpdatedTime?: boolean, // whether to show page's updated time at the top-right corner of item
|
|
|
onClickCheckbox?: (pageId: string) => void,
|
|
onClickCheckbox?: (pageId: string) => void,
|
|
|
onClickItem?: (pageId: string) => void,
|
|
onClickItem?: (pageId: string) => void,
|
|
@@ -25,7 +24,7 @@ type Props = {
|
|
|
export const PageListItemL: FC<Props> = memo((props:Props) => {
|
|
export const PageListItemL: FC<Props> = memo((props:Props) => {
|
|
|
const {
|
|
const {
|
|
|
// todo: refactoring variable name to clear what changed
|
|
// todo: refactoring variable name to clear what changed
|
|
|
- page: { pageData, pageMeta }, isSelected, onClickItem, onClickCheckbox, isChecked, isEnableActions, shortBody,
|
|
|
|
|
|
|
+ page: { pageData, pageMeta }, isSelected, onClickItem, onClickCheckbox, isChecked, isEnableActions,
|
|
|
showPageUpdatedTime,
|
|
showPageUpdatedTime,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
@@ -34,6 +33,7 @@ export const PageListItemL: FC<Props> = memo((props:Props) => {
|
|
|
const pagePath: DevidedPagePath = new DevidedPagePath(pageData.path, true);
|
|
const pagePath: DevidedPagePath = new DevidedPagePath(pageData.path, true);
|
|
|
|
|
|
|
|
const elasticSearchResult = isIPageSearchMeta(pageMeta) ? pageMeta.elasticSearchResult : null;
|
|
const elasticSearchResult = isIPageSearchMeta(pageMeta) ? pageMeta.elasticSearchResult : null;
|
|
|
|
|
+ const revisionShortBody = isIPageInfoForList(pageMeta) ? pageMeta.revisionShortBody : null;
|
|
|
|
|
|
|
|
const pageTitle = (
|
|
const pageTitle = (
|
|
|
<PagePathLabel
|
|
<PagePathLabel
|
|
@@ -103,7 +103,7 @@ export const PageListItemL: FC<Props> = memo((props:Props) => {
|
|
|
<div className="d-flex align-items-center mb-2">
|
|
<div className="d-flex align-items-center mb-2">
|
|
|
{/* Picture */}
|
|
{/* Picture */}
|
|
|
<span className="mr-2 d-none d-md-block">
|
|
<span className="mr-2 d-none d-md-block">
|
|
|
- <UserPicture user={pageData.lastUpdateUser} size="md" />
|
|
|
|
|
|
|
+ {/* <UserPicture user={pageData.lastUpdateUser} size="md" /> */}
|
|
|
</span>
|
|
</span>
|
|
|
{/* page title */}
|
|
{/* page title */}
|
|
|
<Clamp lines={1}>
|
|
<Clamp lines={1}>
|
|
@@ -128,14 +128,13 @@ export const PageListItemL: FC<Props> = memo((props:Props) => {
|
|
|
</div>
|
|
</div>
|
|
|
<div className="page-list-snippet py-1">
|
|
<div className="page-list-snippet py-1">
|
|
|
<Clamp lines={2}>
|
|
<Clamp lines={2}>
|
|
|
- {
|
|
|
|
|
- elasticSearchResult != null && elasticSearchResult?.snippet.length !== 0 ? (
|
|
|
|
|
- // eslint-disable-next-line react/no-danger
|
|
|
|
|
- <div dangerouslySetInnerHTML={{ __html: elasticSearchResult.snippet }}></div>
|
|
|
|
|
- ) : (
|
|
|
|
|
- <div>{ shortBody != null ? shortBody : 'Loading ...' }</div> // TODO: improve indicator
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ { elasticSearchResult != null && elasticSearchResult?.snippet.length > 0 && (
|
|
|
|
|
+ // eslint-disable-next-line react/no-danger
|
|
|
|
|
+ <div dangerouslySetInnerHTML={{ __html: elasticSearchResult.snippet }}></div>
|
|
|
|
|
+ ) }
|
|
|
|
|
+ { revisionShortBody != null && (
|
|
|
|
|
+ <div>{revisionShortBody}</div>
|
|
|
|
|
+ ) }
|
|
|
</Clamp>
|
|
</Clamp>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|