Skip to content

Commit 13c57df

Browse files
committed
fix: regression in delay notification state after tailwind animations
1 parent b4b622f commit 13c57df

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

src/components/NotificationRow.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ import {
88
ReadIcon,
99
TagIcon,
1010
} from '@primer/octicons-react';
11-
import {
12-
type FC,
13-
type MouseEvent,
14-
useCallback,
15-
useContext,
16-
useState,
17-
} from 'react';
11+
import { type FC, type MouseEvent, useCallback, useContext } from 'react';
1812
import { AppContext } from '../context/App';
1913
import { IconColor } from '../types';
2014
import type { Notification } from '../typesGitHub';
@@ -44,10 +38,8 @@ export const NotificationRow: FC<IProps> = ({ notification }) => {
4438
markNotificationDone,
4539
unsubscribeNotification,
4640
} = useContext(AppContext);
47-
const [animateExit, setAnimateExit] = useState(false);
4841

4942
const handleNotification = useCallback(() => {
50-
setAnimateExit(true);
5143
openNotification(notification);
5244

5345
if (settings.markAsDoneOnOpen) {
@@ -98,11 +90,9 @@ export const NotificationRow: FC<IProps> = ({ notification }) => {
9890
return (
9991
<div
10092
id={notification.id}
101-
className={cn(
102-
'group flex border-b border-gray-100 bg-white px-3 py-2 hover:bg-gray-100 dark:border-gray-darker dark:bg-gray-dark dark:text-white dark:hover:bg-gray-darker',
103-
animateExit &&
104-
'translate-x-full opacity-0 transition duration-[350ms] ease-in-out',
105-
)}
93+
className={
94+
'group flex border-b border-gray-100 bg-white px-3 py-2 hover:bg-gray-100 dark:border-gray-darker dark:bg-gray-dark dark:text-white dark:hover:bg-gray-darker'
95+
}
10696
>
10797
<div
10898
className={cn('mr-3 flex w-5 items-center justify-center', iconColor)}
@@ -218,7 +208,6 @@ export const NotificationRow: FC<IProps> = ({ notification }) => {
218208
className="h-full hover:text-green-500 focus:outline-none"
219209
title="Mark as Done"
220210
onClick={() => {
221-
setAnimateExit(true);
222211
markNotificationDone(notification);
223212
}}
224213
>
@@ -239,7 +228,6 @@ export const NotificationRow: FC<IProps> = ({ notification }) => {
239228
className="h-full hover:text-green-500 focus:outline-none"
240229
title="Mark as Read"
241230
onClick={() => {
242-
setAnimateExit(true);
243231
markNotificationRead(notification);
244232
}}
245233
>

src/context/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
122122
settings.participating,
123123
settings.showBots,
124124
settings.detailedNotifications,
125+
settings.delayNotificationState,
125126
auth.accounts.length,
126127
]);
127128

src/styles/gitify.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ export const BUTTON_SIDEBAR_CLASS_NAME =
55
'flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none disabled:text-gray-500 disabled:cursor-default';
66

77
export const READ_NOTIFICATION_CLASS_NAME = 'opacity-50 dark:opacity-50';
8+
9+
export const ANIMATE_NOTIFICATION_CLASS_NAME =
10+
'translate-x-full opacity-0 transition duration-[350ms] ease-in-out';

src/utils/remove-notification.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { READ_NOTIFICATION_CLASS_NAME } from '../styles/gitify';
1+
import {
2+
ANIMATE_NOTIFICATION_CLASS_NAME,
3+
READ_NOTIFICATION_CLASS_NAME,
4+
} from '../styles/gitify';
25
import type { AccountNotifications, SettingsState } from '../types';
36
import type { Notification } from '../typesGitHub';
47
import { getAccountUUID } from './auth/utils';
@@ -14,6 +17,9 @@ export const removeNotification = (
1417
return notifications;
1518
}
1619

20+
const notificationRow = document.getElementById(notification.id);
21+
notificationRow.className += ` ${ANIMATE_NOTIFICATION_CLASS_NAME}`;
22+
1723
const notificationId = notification.id;
1824

1925
const accountIndex = notifications.findIndex(

0 commit comments

Comments
 (0)