// @flow
import React from 'react';
import LbcMessage from 'component/common/lbc-message';
import I18nMessage from 'component/i18nMessage';
import UriIndicator from 'component/uriIndicator';
import { RULE } from 'constants/notifications';
function getChannelNameLink(channelUrl: string, channelName: ?string) {
return ;
}
export function generateNotificationTitle(rule: string, notificationParams: any, channelName: ?string) {
switch (rule) {
case RULE.COMMENT: {
const channelUrl = notificationParams?.dynamic?.comment_author;
if (notificationParams?.dynamic?.amount > 0) {
const amountStr = `${parseFloat(notificationParams.dynamic.amount)} ${
notificationParams.dynamic.currency || 'LBC'
}`;
return channelUrl ? (
{amountStr},
title: {notificationParams.dynamic?.claim_title},
}}
>
%commenter% sent a %amount% hyperchat on %title%
) : (
notificationParams.device.title
);
} else {
return channelUrl ? (
{notificationParams.dynamic?.claim_title},
}}
>
%commenter% commented on %title%
) : (
notificationParams.device.title
);
}
}
case RULE.CREATOR_COMMENT: {
const channelUrl = notificationParams?.dynamic?.comment_author;
return channelUrl ? (
{notificationParams.dynamic?.claim_title},
}}
>
%commenter% commented on %title%
) : (
notificationParams.device.title
);
}
case RULE.COMMENT_REPLY: {
const channelUrl = notificationParams?.dynamic?.reply_author;
return channelUrl ? (
{notificationParams.dynamic?.claim_title},
}}
>
%commenter% replied to you on %title%
) : (
notificationParams.device.title
);
}
case RULE.NEW_CONTENT: {
const channelUrl = notificationParams?.dynamic?.channel_url;
return channelUrl ? (
New content from %creator%
) : (
notificationParams.device.title
);
}
case RULE.NEW_LIVESTREAM: {
const channelUrl = notificationParams?.dynamic?.channel_url;
return channelUrl ? (
%streamer% is live streaming!
) : (
notificationParams.device.title
);
}
case RULE.CREATOR_SUBSCRIBER:
case RULE.DAILY_WATCH_AVAILABLE:
case RULE.DAILY_WATCH_REMIND:
case RULE.WEEKLY_WATCH_REMINDER:
case RULE.MISSED_OUT:
case RULE.REWARDS_APPROVAL_PROMPT:
case RULE.FIAT_TIP:
// Use Commentron default
return __(notificationParams.device.title);
default:
console.log(`TITLE: Unhandled notification_rule:%c ${rule}`, 'color:yellow'); // eslint-disable-line
return __(notificationParams.device.title);
}
}