mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 21:06:22 +08:00
init: the first public commit for AFFiNE
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import type { FC } from 'react';
|
||||
import format from 'date-fns/format';
|
||||
import { Typography, styled } from '@toeverything/components/ui';
|
||||
import { useUserAndSpaces } from '@toeverything/datasource/state';
|
||||
import { usePageLastUpdated, useWorkspaceAndPageId } from '../util';
|
||||
|
||||
export const LastModified: FC = () => {
|
||||
const { user } = useUserAndSpaces();
|
||||
const username = user ? user.nickname : 'Anonymous';
|
||||
const { workspaceId, pageId } = useWorkspaceAndPageId();
|
||||
const lastModified = usePageLastUpdated({ workspaceId, pageId });
|
||||
const formatLastModified = format(lastModified, 'MM/dd/yyyy hh:mm');
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<ContentText type="xs">
|
||||
<span>Last edited by </span>
|
||||
<span>{username}</span>
|
||||
</ContentText>
|
||||
</div>
|
||||
<div>
|
||||
<ContentText type="xs">{formatLastModified}</ContentText>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const ContentText = styled(Typography)(({ theme }) => {
|
||||
return {
|
||||
color: theme.affine.palette.icons,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user