Skip to content

feat: show read notifications #889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: mark row as read without removing from state
  • Loading branch information
setchy committed Apr 5, 2024
commit 11a01da758fa305dbe2cf683996599c4449a18cf
18 changes: 16 additions & 2 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@ export const NotificationRow: React.FC<IProps> = ({

if (settings.markAsDoneOnOpen) {
markNotificationDone(notification.id, hostname);
} else {
}

if (!settings.showReadNotifications) {
// no need to mark as read, github does it by default when opening it
removeNotificationFromState(notification.id, hostname);
}
}, [settings]);

const setRowAsRead = useCallback(() => {
if (settings.showReadNotifications && notification.unread) {
const notificationRow = document.getElementById(notification.id);
notificationRow.className += 'opacity-50 dark:opacity-50';
console.log('Notification Row: ', notificationRow.className);
}
}, [settings]);

const openBrowser = useCallback(
() => openInBrowser(notification, accounts),
[notification],
Expand Down Expand Up @@ -73,6 +83,7 @@ export const NotificationRow: React.FC<IProps> = ({

return (
<div
id={notification.id}
className={`flex space-x-3 py-2 px-3 bg-white border-b border-gray-100 dark:border-gray-darker group dark:bg-gray-dark dark:text-white hover:bg-gray-100 dark:hover:bg-gray-darker
${!notification.unread ? 'opacity-50 dark:opacity-50' : ''}`}
>
Expand All @@ -87,7 +98,10 @@ export const NotificationRow: React.FC<IProps> = ({
<div
className="mb-1 text-sm whitespace-nowrap overflow-ellipsis overflow-hidden cursor-pointer"
role="main"
onClick={() => pressTitle()}
onClick={() => {
setRowAsRead();
pressTitle();
}}
title={notification.subject.title}
>
{notification.subject.title}
Expand Down