11import useClientStore from '@/services/clientStore' ;
2+ import CustomDropdown from './CustomDropdown' ;
23
34const CurrentlyViewing : React . FC = ( ) => {
45 const { selectedGroup, satellites, selectedSatellite, setSelectedGroup, setSelectedSatellite } = useClientStore ( ) ;
56
67 const groups = [
7- { name : 'Space Stations ' , value : 'stations ' } ,
8- { name : 'Globalstar ' , value : 'globalstar ' } ,
9- { name : 'Intelsat ' , value : 'intelsat ' }
8+ { value : 'stations ' , label : 'Space Stations ' } ,
9+ { value : 'globalstar ' , label : 'Globalstar ' } ,
10+ { value : 'intelsat ' , label : 'Intelsat ' }
1011 ] ;
1112
1213 // Only show if a group is selected
@@ -16,77 +17,45 @@ const CurrentlyViewing: React.FC = () => {
1617 setSelectedSatellite ( satellites . find ( satellite => satellite . noradId === noradId ) || null ) ;
1718 } ;
1819
19- const selectStyle = {
20- background : 'rgba(0, 0, 0, 0.2)' ,
21- border : '1px solid rgba(255, 255, 255, 0.1)' ,
22- color : '#FFFFFF' ,
23- padding : '4px 8px' ,
24- borderRadius : '4px' ,
25- fontSize : '16px' ,
26- fontFamily : 'Shentox, sans-serif' ,
27- cursor : 'pointer' ,
28- width : '200px'
29- } ;
30-
31- const labelStyle = {
32- color : '#969696' ,
33- paddingRight : '16px' ,
34- whiteSpace : 'nowrap'
35- } ;
36-
37- const cellStyle = {
38- padding : '8px 8px'
39- } ;
20+ const satelliteOptions = satellites . map ( sat => ( {
21+ value : sat . noradId . toString ( ) ,
22+ label : sat . name
23+ } ) ) ;
4024
4125 return (
42- < div >
43- < div
44- style = { {
45- background : 'rgba(0, 0, 0, 0.3)' ,
46- backdropFilter : 'blur(10px)' ,
47- fontSize : '16px' ,
48- fontFamily : 'Shentox, sans-serif' ,
49- color : '#FFFFFF' ,
50- } }
51- >
52- < table >
53- < tbody >
54- < tr >
55- < td style = { { ...labelStyle , ...cellStyle } } > Current Group:</ td >
56- < td style = { cellStyle } >
57- < select
58- value = { selectedGroup }
59- onChange = { ( e ) => setSelectedGroup ( e . target . value ) }
60- style = { selectStyle }
61- >
62- { groups . map ( ( group ) => (
63- < option key = { group . value } value = { group . value } >
64- { group . name }
65- </ option >
66- ) ) }
67- </ select >
68- </ td >
69- </ tr >
70- < tr >
71- < td style = { { ...labelStyle , ...cellStyle } } > Selected Satellite:</ td >
72- < td style = { cellStyle } >
73- < select
74- value = { selectedSatellite ?. noradId }
75- onChange = { ( e ) => onSatelliteSelect ( Number ( e . target . value ) ) }
76- style = { selectStyle }
77- >
78- < option value = "" > </ option >
79- { satellites . map ( ( satellite ) => (
80- < option key = { satellite . noradId } value = { satellite . noradId } >
81- { satellite . name }
82- </ option >
83- ) ) }
84- </ select >
85- </ td >
86- </ tr >
87- </ tbody >
88- </ table >
89- </ div >
26+ < div className = "currently-viewing" >
27+ < h3 className = "title" > Find Satellite</ h3 >
28+
29+ < CustomDropdown
30+ options = { groups }
31+ value = { selectedGroup }
32+ onChange = { setSelectedGroup }
33+ placeholder = "Groups"
34+ />
35+
36+ < CustomDropdown
37+ options = { satelliteOptions }
38+ value = { selectedSatellite ?. noradId . toString ( ) || '' }
39+ onChange = { ( value ) => onSatelliteSelect ( Number ( value ) ) }
40+ placeholder = "Satellites"
41+ />
42+
43+ < style jsx > { `
44+ .currently-viewing {
45+ display: flex;
46+ flex-direction: column;
47+ gap: 8px;
48+ padding: 16px 8px;
49+ }
50+
51+ .title {
52+ font-family: 'Inter', sans-serif;
53+ font-size: 14px;
54+ font-weight: 400;
55+ color: rgba(183, 183, 183, 0.7);
56+ margin: 0 0 8px 0;
57+ }
58+ ` } </ style >
9059 </ div >
9160 ) ;
9261} ;
0 commit comments