File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11import { faSearch } from "@fortawesome/free-solid-svg-icons" ;
22import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
3- import { useRef , useState } from "react" ;
3+ import { useEffect , useRef , useState } from "react" ;
44import InputField from "../components/general/InputField" ;
55import Toast from "../components/general/Toast" ;
66import IssuesList , { IssuesData } from "../components/issues/IssuesList" ;
@@ -42,6 +42,15 @@ const IssuesPage = () => {
4242 ) ;
4343 useHotKey ( ( ) => setSearching ( false ) , { key : "Escape" } , searching ) ;
4444
45+ useEffect ( ( ) => {
46+ const count = Object . values ( issuesData . data ) . reduce ( ( count , data ) => count + ( data . active ? 1 : 0 ) , 0 ) ;
47+
48+ chrome . action . setBadgeBackgroundColor ( { color : "#1d4ed8" } ) ;
49+ chrome . action . setBadgeText ( {
50+ text : count > 0 ? count . toString ( ) : "" ,
51+ } ) ;
52+ } , [ issuesData . data ] ) ;
53+
4554 return (
4655 < >
4756 { searching && < InputField ref = { searchRef } icon = { < FontAwesomeIcon icon = { faSearch } /> } placeholder = "Search..." className = "select-none mb-3" onChange = { ( e ) => setSearch ( e . target . value ) } autoFocus autoComplete = "off" /> }
You can’t perform that action at this time.
0 commit comments