-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): show basic metadata for notes and tags on their page
- owner, createdAt, updatedAt
- Loading branch information
1 parent
39a7a23
commit 3c53b79
Showing
10 changed files
with
131 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Button, Tooltip } from '@mui/material'; | ||
import { FC, PropsWithChildren } from 'react'; | ||
|
||
const ButtonLike: FC< | ||
PropsWithChildren<{ startIcon: JSX.Element; tooltip?: string }> | ||
> = ({ children, tooltip, startIcon }) => { | ||
const buttonLike = ( | ||
<Button disabled startIcon={startIcon}> | ||
{children} | ||
</Button> | ||
); | ||
if (!tooltip) { | ||
return buttonLike; | ||
} | ||
return ( | ||
<Tooltip title={tooltip} placement="top"> | ||
<div>{buttonLike}</div> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default ButtonLike; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { AccountCircle, Add, Edit } from '@mui/icons-material'; | ||
import { | ||
DateOrTimestamp, | ||
dateToCustomizedLongISO8061, | ||
dateToShortISO8601, | ||
} from '../utils/textHelpers'; | ||
import ButtonLike from './ButtonLike'; | ||
|
||
const EntityMetadata = ({ | ||
entity, | ||
}: { | ||
entity: { | ||
createdAt: DateOrTimestamp; | ||
updatedAt: DateOrTimestamp; | ||
user: { | ||
name: string; | ||
}; | ||
}; | ||
}) => ( | ||
<> | ||
<ButtonLike | ||
startIcon={<AccountCircle />} | ||
tooltip={`Owned by ${entity.user.name}`} | ||
> | ||
{entity.user.name} | ||
</ButtonLike> | ||
<ButtonLike | ||
startIcon={<Add />} | ||
tooltip={`Created at ${dateToCustomizedLongISO8061(entity.createdAt)}`} | ||
> | ||
Created {dateToShortISO8601(entity.createdAt)} | ||
</ButtonLike> | ||
<ButtonLike | ||
startIcon={<Edit />} | ||
tooltip={`Updated at ${dateToCustomizedLongISO8061(entity.updatedAt)}`} | ||
> | ||
Updated {dateToShortISO8601(entity.updatedAt)} | ||
</ButtonLike> | ||
</> | ||
); | ||
|
||
export default EntityMetadata; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters