|
|
@@ -3,9 +3,7 @@ import React from 'react';
|
|
|
|
|
|
import type { HasObjectId } from '@growi/core';
|
|
|
import { PagePathLabel } from '@growi/ui/dist/components';
|
|
|
-import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
-import { SupportedAction, SupportedTargetModel } from '~/interfaces/activity';
|
|
|
import type { IInAppNotification } from '~/interfaces/in-app-notification';
|
|
|
|
|
|
import FormattedDistanceDate from '../../FormattedDistanceDate';
|
|
|
@@ -15,24 +13,27 @@ type Props = {
|
|
|
actionMsg: string
|
|
|
actionIcon: string
|
|
|
actionUsers: string
|
|
|
+ hideActionUsers?: boolean
|
|
|
+ subMsg?: JSX.Element
|
|
|
};
|
|
|
|
|
|
-export const ModelNotification: FC<Props> = (props) => {
|
|
|
- const {
|
|
|
- notification, actionMsg, actionIcon, actionUsers,
|
|
|
- } = props;
|
|
|
-
|
|
|
- const { t } = useTranslation();
|
|
|
+export const ModelNotification: FC<Props> = ({
|
|
|
+ notification,
|
|
|
+ actionMsg,
|
|
|
+ actionIcon,
|
|
|
+ actionUsers,
|
|
|
+ hideActionUsers = false,
|
|
|
+ subMsg,
|
|
|
+}: Props) => {
|
|
|
|
|
|
return (
|
|
|
<div className="p-2 overflow-hidden">
|
|
|
<div className="text-truncate">
|
|
|
- {notification.targetModel !== SupportedTargetModel.MODEL_PAGE_BULK_EXPORT_JOB ? <b>{actionUsers}</b> : <></>}
|
|
|
+ {hideActionUsers ? <></> : <b>{actionUsers}</b>}
|
|
|
{` ${actionMsg}`}
|
|
|
<PagePathLabel path={notification.parsedSnapshot?.path ?? ''} />
|
|
|
</div>
|
|
|
- { (notification.action === SupportedAction.ACTION_PAGE_BULK_EXPORT_COMPLETED && notification.target == null)
|
|
|
- ? <div className="text-danger"><small>{t('page_export.bulk_export_download_expired')}</small></div> : <></> }
|
|
|
+ { subMsg }
|
|
|
<span className="material-symbols-outlined me-2">{actionIcon}</span>
|
|
|
<FormattedDistanceDate
|
|
|
id={notification._id}
|