Skip to content

Commit

Permalink
Merge pull request #1272 from bancorprotocol/issue-#1206
Browse files Browse the repository at this point in the history
Add onclick close notification to "view activity" link
  • Loading branch information
tiagofilipenunes authored Jun 27, 2024
2 parents 6e2cb3a + 55dc730 commit 66e4248
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/screenshots/strategy/overlapping/Overlapping/withdraw/form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/components/activity/ActivityNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ import style from './ActivityNotification.module.css';
interface Props {
notification: NotificationActivity;
close: () => void;
onClick?: () => void;
}

export const ActivityNotification: FC<Props> = ({ notification, close }) => {
export const ActivityNotification: FC<Props> = ({
notification,
close,
onClick,
}) => {
const titleId = useId();
const { activity } = notification;

Expand All @@ -31,6 +36,7 @@ export const ActivityNotification: FC<Props> = ({ notification, close }) => {
</hgroup>
<Link
to="/strategy/$id"
onClick={onClick}
params={{ id: activity.strategy.id }}
className="font-weight-500 flex items-center"
>
Expand Down
3 changes: 3 additions & 0 deletions src/libs/modals/modals/ModalNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { ModalFC } from 'libs/modals/modals.types';
import { ModalSlideOver } from 'libs/modals/ModalSlideOver';
import { NotificationLine } from 'libs/notifications/NotificationLine';
import { useNotifications } from 'hooks/useNotifications';
import { useModal } from 'hooks/useModal';

export const ModalNotifications: ModalFC<undefined> = ({ id }) => {
const { notifications, clearNotifications, removeNotification } =
useNotifications();
const reversedNotifications = notifications.slice().reverse();
const { closeModal } = useModal();

return (
<ModalSlideOver
Expand All @@ -30,6 +32,7 @@ export const ModalNotifications: ModalFC<undefined> = ({ id }) => {
<NotificationLine
notification={n}
close={() => removeNotification(n.id)}
onClick={() => closeModal(id)}
/>
</li>
))}
Expand Down
11 changes: 9 additions & 2 deletions src/libs/notifications/NotificationLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ import { Notification } from './types';

interface NotificationLineProps {
close: () => void;
onClick?: () => void;
notification: Notification;
}
export const NotificationLine: FC<NotificationLineProps> = (props) => {
const { notification, close } = props;
const { notification, close, onClick } = props;

switch (notification.type) {
case 'activity':
return <ActivityNotification notification={notification} close={close} />;
return (
<ActivityNotification
notification={notification}
onClick={onClick}
close={close}
/>
);
case 'tx':
return <TxNotification notification={notification} close={close} />;
default:
Expand Down
1 change: 1 addition & 0 deletions src/libs/notifications/NotificationsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const NotificationItem: FC<{ notification: Notification }> = (props) => {
<NotificationLine
notification={notification}
close={() => dismissAlert(id)}
onClick={() => dismissAlert(id)}
/>
</motion.li>
);
Expand Down

0 comments on commit 66e4248

Please sign in to comment.