| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import { memo } from 'react';
- import { pagePathUtils } from '@growi/core/dist/utils';
- import { useCurrentPathname } from '~/stores-universal/context';
- import { useSWRxCurrentPage } from '~/stores/page';
- import { useIsAbleToShowPageAuthors } from '~/stores/ui';
- import { AuthorInfo } from '../AuthorInfo';
- import styles from './PageAuthorInfo.module.scss';
- export const PageAuthorInfo = memo((): JSX.Element => {
- const { data: currentPage } = useSWRxCurrentPage();
- const { data: currentPathname } = useCurrentPathname();
- const { data: isAbleToShowPageAuthors } = useIsAbleToShowPageAuthors();
- if (!isAbleToShowPageAuthors) {
- return <></>;
- }
- const path = currentPage?.path ?? currentPathname;
- if (pagePathUtils.isUsersHomepage(path ?? '')) {
- return <></>;
- }
- return (
- <ul className={`grw-page-author-info ${styles['grw-page-author-info']} text-nowrap border-start d-none d-lg-block d-edit-none py-2 ps-4 mb-0 ms-3`}>
- <li className="pb-1">
- {currentPage != null && (
- <AuthorInfo user={currentPage.creator} date={currentPage.createdAt} mode="create" locate="subnav" />
- )}
- </li>
- <li className="mt-1 pt-1 border-top">
- {currentPage != null && (
- <AuthorInfo user={currentPage.lastUpdateUser} date={currentPage.updatedAt} mode="update" locate="subnav" />
- )}
- </li>
- </ul>
- );
- });
|