Notification: further handle "missed_out" + other tweaks (#6052)

* Show full notification text via tooltip

The tooltip fixes the system notifications problem (mentioned below), and also allows one to quickly read the entire comment without actually having to visit the comment.

Currently, we only show about 50 characters in the notification, truncating it to an ellipsis when exceeded.

This is not much of a problem for dynamic text (e.g. comments) since the full text can be seen after clicking on the notification (brings you to the comment). For system notifications, this is problematic since there's no other way to know what the full text was.

Tried to dynamically change the font size to auto fit, but it wasn't fruitful. Even if it did work, it'll probably won't be legible for a 2000-character comment, plus the entire list will look weird with various font sizes.

* Beautify "missed out" notification; bring user to Verify page.

## Issue
6021: Notifications: Missed Out

## Changes
- The notification already brings the user to the `/rewards`. Tweaked it to directly enter the Verify Page.
- Use LBC icon instead of generic bell for this notification.
This commit is contained in:
infinite-persistence 2021-05-13 01:51:55 +08:00 committed by GitHub
parent 5be7d6ab56
commit 02fdb1e6df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -42,6 +42,9 @@ export default function Notification(props: Props) {
case NOTIFICATIONS.DAILY_WATCH_REMIND: case NOTIFICATIONS.DAILY_WATCH_REMIND:
notificationTarget = `/$/${PAGES.CHANNELS_FOLLOWING}`; notificationTarget = `/$/${PAGES.CHANNELS_FOLLOWING}`;
break; break;
case NOTIFICATIONS.MISSED_OUT:
notificationTarget = `/$/${PAGES.REWARDS_VERIFY}?redirect=/$/${PAGES.REWARDS}`;
break;
default: default:
notificationTarget = notification_parameters.device.target; notificationTarget = notification_parameters.device.target;
} }
@ -80,6 +83,7 @@ export default function Notification(props: Props) {
break; break;
case NOTIFICATIONS.DAILY_WATCH_AVAILABLE: case NOTIFICATIONS.DAILY_WATCH_AVAILABLE:
case NOTIFICATIONS.DAILY_WATCH_REMIND: case NOTIFICATIONS.DAILY_WATCH_REMIND:
case NOTIFICATIONS.MISSED_OUT:
icon = <Icon icon={ICONS.LBC} sectionIcon />; icon = <Icon icon={ICONS.LBC} sectionIcon />;
break; break;
default: default:
@ -145,11 +149,16 @@ export default function Notification(props: Props) {
<div className="notification__title"> <div className="notification__title">
<LbcMessage>{notification_parameters.device.title}</LbcMessage> <LbcMessage>{notification_parameters.device.title}</LbcMessage>
</div> </div>
<div className="notification__text mobile-hidden">{commentText}</div> <div title={commentText} className="notification__text mobile-hidden">
{commentText}
</div>
</> </>
) : ( ) : (
<> <>
<div className="notification__text"> <div
title={notification_parameters.device.text.replace(/\sLBC/g, ' Credits')}
className="notification__text"
>
<LbcMessage>{notification_parameters.device.text}</LbcMessage> <LbcMessage>{notification_parameters.device.text}</LbcMessage>
</div> </div>
</> </>

View file

@ -1,6 +1,7 @@
export const NOTIFICATION_CREATOR_SUBSCRIBER = 'creator_subscriber'; export const NOTIFICATION_CREATOR_SUBSCRIBER = 'creator_subscriber';
export const NOTIFICATION_COMMENT = 'comment'; export const NOTIFICATION_COMMENT = 'comment';
export const NOTIFICATION_REPLY = 'comment-reply'; export const NOTIFICATION_REPLY = 'comment-reply';
export const MISSED_OUT = 'missed_out';
export const DAILY_WATCH_AVAILABLE = 'daily_watch_available'; export const DAILY_WATCH_AVAILABLE = 'daily_watch_available';
export const DAILY_WATCH_REMIND = 'daily_watch_remind'; export const DAILY_WATCH_REMIND = 'daily_watch_remind';
export const NEW_CONTENT = 'new_content'; export const NEW_CONTENT = 'new_content';