From fa653591afa120adc84e75af5455b78230238298 Mon Sep 17 00:00:00 2001 From: Arthur Dufour Date: Sun, 18 Feb 2024 13:13:23 +0100 Subject: [PATCH 1/3] feat: mark repository as done --- src/components/Repository.tsx | 22 +++++++++++++--- src/context/App.tsx | 9 +++++++ src/hooks/useNotifications.ts | 47 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/components/Repository.tsx b/src/components/Repository.tsx index 3cdb5820a..7cf0ed8ca 100644 --- a/src/components/Repository.tsx +++ b/src/components/Repository.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useContext } from 'react'; -import { ReadIcon } from '@primer/octicons-react'; +import { ReadIcon, CheckIcon } from '@primer/octicons-react'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; import { AppContext } from '../context/App'; @@ -18,7 +18,8 @@ export const RepositoryNotifications: React.FC = ({ repoNotifications, hostname, }) => { - const { markRepoNotifications } = useContext(AppContext); + const { markRepoNotifications, markRepoNotificationsDone } = + useContext(AppContext); const openBrowser = useCallback(() => { const url = repoNotifications[0].repository.html_url; @@ -30,6 +31,11 @@ export const RepositoryNotifications: React.FC = ({ markRepoNotifications(repoSlug, hostname); }, [repoNotifications, hostname]); + const markRepoAsDone = useCallback(() => { + const repoSlug = repoNotifications[0].repository.full_name; + markRepoNotificationsDone(repoSlug, hostname); + }, [repoNotifications, hostname]); + const avatarUrl = repoNotifications[0].repository.owner.avatar_url; return ( @@ -40,7 +46,17 @@ export const RepositoryNotifications: React.FC = ({ {repoName} -
+
+ + +
+
+ +