|
|
@@ -1,42 +1,30 @@
|
|
|
-import React, { FC, memo } from 'react';
|
|
|
+import React, { memo } from 'react';
|
|
|
|
|
|
-import { Nullable, Ref } from '@growi/core';
|
|
|
import dynamic from 'next/dynamic';
|
|
|
|
|
|
-import { MySkelton } from '~/components/MySkelton';
|
|
|
+import {
|
|
|
+ useCurrentCreatedAt, useCurrentUpdatedAt, useCreator, useRevisionAuthor,
|
|
|
+} from '../stores/context';
|
|
|
|
|
|
-import { IUser } from '../interfaces/user';
|
|
|
+import { Skelton } from './Skelton';
|
|
|
|
|
|
+export const PageContentFooter = memo((): JSX.Element => {
|
|
|
|
|
|
-const AuthorInfo = dynamic(() => import('./Navbar/AuthorInfo'), { ssr: false });
|
|
|
+ const AuthorInfo = dynamic(() => import('./Navbar/AuthorInfo'), { ssr: false, loading: () => <p><Skelton width={300} height={20} /></p> });
|
|
|
|
|
|
-type Props = {
|
|
|
- createdAt: Nullable<Date> | undefined, // TODO: check createdAt type
|
|
|
- updatedAt: Nullable<Date> | undefined, // TODO: check updatedAt type
|
|
|
- creator: any,
|
|
|
- revisionAuthor: Ref<IUser>,
|
|
|
-}
|
|
|
-
|
|
|
-export const PageContentFooter:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
- const {
|
|
|
- createdAt, updatedAt, creator, revisionAuthor,
|
|
|
- } = props;
|
|
|
+ const { data: createdAt } = useCurrentCreatedAt();
|
|
|
+ const { data: updatedAt } = useCurrentUpdatedAt();
|
|
|
+ const { data: creator } = useCreator();
|
|
|
+ const { data: revisionAuthor } = useRevisionAuthor();
|
|
|
|
|
|
return (
|
|
|
<div className="page-content-footer py-4 d-edit-none d-print-none">
|
|
|
<div className="grw-container-convertible">
|
|
|
<div className="page-meta">
|
|
|
- {createdAt === null || updatedAt === null ? (
|
|
|
- <>
|
|
|
- <MySkelton />
|
|
|
- <MySkelton />
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <>
|
|
|
- <AuthorInfo user={creator as IUser} date={createdAt} mode="create" locate="footer" />
|
|
|
- <AuthorInfo user={revisionAuthor as IUser} date={updatedAt} mode="update" locate="footer" />
|
|
|
- </>
|
|
|
- )}
|
|
|
+ <>
|
|
|
+ <AuthorInfo user={creator} date={createdAt} mode="create" locate="footer" />
|
|
|
+ <AuthorInfo user={revisionAuthor} date={updatedAt} mode="update" locate="footer" />
|
|
|
+ </>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|