ModelNotification.tsx 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React, { FC } from 'react';
  2. import type { HasObjectId } from '@growi/core';
  3. import { PagePathLabel } from '@growi/ui/dist/components';
  4. import type { IInAppNotification } from '~/interfaces/in-app-notification';
  5. import FormattedDistanceDate from '../../FormattedDistanceDate';
  6. type Props = {
  7. notification: IInAppNotification & HasObjectId
  8. actionMsg: string
  9. actionIcon: string
  10. actionUsers: string
  11. };
  12. export const ModelNotification: FC<Props> = (props) => {
  13. const {
  14. notification, actionMsg, actionIcon, actionUsers,
  15. } = props;
  16. return (
  17. <div className="p-2 overflow-hidden">
  18. <div className="text-truncate">
  19. <b>{actionUsers}</b>
  20. {actionMsg}
  21. <PagePathLabel path={notification.parsedSnapshot?.path ?? ''} />
  22. </div>
  23. <i className={`${actionIcon} me-2`} />
  24. <FormattedDistanceDate
  25. id={notification._id}
  26. date={notification.createdAt}
  27. isShowTooltip={false}
  28. differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
  29. />
  30. </div>
  31. );
  32. };