ModelNotification.tsx 1.1 KB

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