Notification menu patch (#1701)
* Add href links to notification menu entries * Add href link to notification page * 2nd try
This commit is contained in:
parent
4d849a4821
commit
70dad5e057
1 changed files with 15 additions and 5 deletions
|
@ -21,6 +21,7 @@ import UriIndicator from 'component/uriIndicator';
|
||||||
import { generateNotificationTitle } from '../notification/helpers/title';
|
import { generateNotificationTitle } from '../notification/helpers/title';
|
||||||
import { generateNotificationText } from '../notification/helpers/text';
|
import { generateNotificationText } from '../notification/helpers/text';
|
||||||
import { parseURI } from 'util/lbryURI';
|
import { parseURI } from 'util/lbryURI';
|
||||||
|
import { NavLink } from 'react-router-dom';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
notifications: Array<Notification>,
|
notifications: Array<Notification>,
|
||||||
|
@ -109,12 +110,21 @@ export default function NotificationHeaderButton(props: Props) {
|
||||||
readNotification([id]);
|
readNotification([id]);
|
||||||
}
|
}
|
||||||
let notificationLink = formatLbryUrlForWeb(notification_parameters.device.target);
|
let notificationLink = formatLbryUrlForWeb(notification_parameters.device.target);
|
||||||
if (notification_parameters.dynamic.hash) {
|
if (notification_parameters.dynamic?.hash) {
|
||||||
notificationLink += '?lc=' + notification_parameters.dynamic.hash + '&view=discussion';
|
notificationLink += '?lc=' + notification_parameters.dynamic.hash + '&view=discussion';
|
||||||
}
|
}
|
||||||
push(notificationLink);
|
push(notificationLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getWebUri(notification) {
|
||||||
|
const { notification_parameters } = notification;
|
||||||
|
let notificationLink = formatLbryUrlForWeb(notification_parameters.device.target);
|
||||||
|
if (notification_parameters.dynamic?.hash) {
|
||||||
|
notificationLink += '?lc=' + notification_parameters.dynamic.hash + '&view=discussion';
|
||||||
|
}
|
||||||
|
return notificationLink;
|
||||||
|
}
|
||||||
|
|
||||||
function menuEntry(notification) {
|
function menuEntry(notification) {
|
||||||
const { id, active_at, notification_rule, notification_parameters, is_read, type } = notification;
|
const { id, active_at, notification_rule, notification_parameters, is_read, type } = notification;
|
||||||
|
|
||||||
|
@ -163,7 +173,7 @@ export default function NotificationHeaderButton(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a onClick={() => handleNotificationClick(notification)} key={id}>
|
<NavLink onClick={() => handleNotificationClick(notification)} key={id} to={getWebUri(notification)}>
|
||||||
<div
|
<div
|
||||||
className={is_read ? 'menu__list--notification' : 'menu__list--notification menu__list--notification-unread'}
|
className={is_read ? 'menu__list--notification' : 'menu__list--notification menu__list--notification-unread'}
|
||||||
key={id}
|
key={id}
|
||||||
|
@ -187,7 +197,7 @@ export default function NotificationHeaderButton(props: Props) {
|
||||||
<Icon icon={ICONS.DELETE} sectionIcon />
|
<Icon icon={ICONS.DELETE} sectionIcon />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</NavLink>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,9 +228,9 @@ export default function NotificationHeaderButton(props: Props) {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a onClick={handleMenuClick}>
|
<NavLink onClick={handleMenuClick} to={`/$/${PAGES.NOTIFICATIONS}`}>
|
||||||
<div className="menu__list--notifications-more">{__('View all')}</div>
|
<div className="menu__list--notifications-more">{__('View all')}</div>
|
||||||
</a>
|
</NavLink>
|
||||||
</MuiMenu>
|
</MuiMenu>
|
||||||
</ClickAwayListener>
|
</ClickAwayListener>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue