11import './style.css'
22import React from 'react'
33import { createRoot } from 'react-dom/client'
4- import { SpotTable } from '@/components/SpotTable'
5- import type { CommentState } from '@/entrypoints/background'
4+ import type { CommentTableRow } from '@/entrypoints/background'
65import { logger } from '@/lib/logger'
7- import type { GetOpenSpotsMessage , GetOpenSpotsResponse , SwitchToTabMessage } from '@/lib/messages'
8- import { EnhancerRegistry } from '@/lib/registries'
6+ import type { GetOpenSpotsMessage , GetTableRowsResponse } from '@/lib/messages'
97
10- async function getOpenSpots ( ) : Promise < CommentState [ ] > {
8+ async function getOpenSpots ( ) : Promise < CommentTableRow [ ] > {
119 logger . debug ( 'Sending message to background script...' )
1210 try {
1311 const message : GetOpenSpotsMessage = { type : 'GET_OPEN_SPOTS' }
14- const response = ( await browser . runtime . sendMessage ( message ) ) as GetOpenSpotsResponse
12+ const response = ( await browser . runtime . sendMessage ( message ) ) as GetTableRowsResponse
1513 logger . debug ( 'Received response:' , response )
16- return response . spots || [ ]
14+ return response . rows || [ ]
1715 } catch ( error ) {
1816 logger . error ( 'Error sending message to background:' , error )
1917 return [ ]
2018 }
2119}
2220
23- function switchToTab ( tabId : number , windowId : number ) : void {
24- const message : SwitchToTabMessage = {
25- tabId,
26- type : 'SWITCH_TO_TAB' ,
27- windowId,
28- }
29- browser . runtime . sendMessage ( message )
30- window . close ( )
31- }
32-
33- const enhancers = new EnhancerRegistry ( )
21+ // function switchToTab(tabId: number, windowId: number): void {
22+ // const message: SwitchToTabMessage = {
23+ // tabId,
24+ // type: 'SWITCH_TO_TAB',
25+ // windowId,
26+ // }
27+ // browser.runtime.sendMessage(message)
28+ // window.close()
29+ // }
3430
3531export interface FilterState {
3632 sentFilter : 'both' | 'sent' | 'unsent'
@@ -39,7 +35,7 @@ export interface FilterState {
3935}
4036
4137function PopupApp ( ) {
42- const [ spots , setSpots ] = React . useState < CommentState [ ] > ( [ ] )
38+ const [ _spots , setSpots ] = React . useState < CommentTableRow [ ] > ( [ ] )
4339 const [ isLoading , setIsLoading ] = React . useState ( true )
4440
4541 React . useEffect ( ( ) => {
@@ -61,26 +57,16 @@ function PopupApp() {
6157 return < div className = 'p-4 text-center text-muted-foreground' > Loading...</ div >
6258 }
6359
64- const handleSpotClick = ( spot : CommentState ) => {
65- switchToTab ( spot . tab . tabId , spot . tab . windowId )
66- }
60+ // const handleSpotClick = (spot: CommentTableRow) => {
61+ // console.log('TODO: switchToTab')
62+ // //switchToTab(spot.tab.tabId, spot.tab.windowId)
63+ // }
6764
6865 return (
6966 < div className = 'w-full' >
7067 < h2 className = 'mb-4 text-lg font-semibold text-foreground' > Open Comment Spots</ h2 >
7168
72- < div className = 'border rounded-md' >
73- < SpotTable
74- spots = { spots }
75- enhancerRegistry = { enhancers }
76- onSpotClick = { handleSpotClick }
77- headerClassName = 'p-3 font-medium text-muted-foreground'
78- rowClassName = 'transition-colors hover:bg-muted/50 border-b border-border/40'
79- cellClassName = 'p-3'
80- emptyStateMessage = 'No open comment spots'
81- showHeader = { true }
82- />
83- </ div >
69+ < div className = 'border rounded-md' > </ div >
8470 </ div >
8571 )
8672}
0 commit comments