@@ -12,6 +12,7 @@ import {
1212 Switch ,
1313 Text ,
1414 TextInput ,
15+ useWindowDimensions ,
1516 View ,
1617} from "react-native" ;
1718import MapView , { Marker , Polygon , Polyline } from "react-native-maps" ;
@@ -215,6 +216,7 @@ export default function TimerScreen({
215216 onOpenPreview,
216217} : TimerScreenProps ) {
217218 const insets = useSafeAreaInsets ( ) ;
219+ const { height : windowHeight } = useWindowDimensions ( ) ;
218220 const [ isEclipsePickerOpen , setIsEclipsePickerOpen ] = useState ( false ) ;
219221 const [ isAddFavoriteModalOpen , setIsAddFavoriteModalOpen ] = useState ( false ) ;
220222 const [ favoriteModalName , setFavoriteModalName ] = useState ( "" ) ;
@@ -226,6 +228,10 @@ export default function TimerScreen({
226228 ( ) => eclipseOptions . find ( ( option ) => option . id === activeEclipseId ) ?? null ,
227229 [ activeEclipseId , eclipseOptions ] ,
228230 ) ;
231+ const mapHeight = useMemo (
232+ ( ) => clamp ( ( windowHeight - insets . top - insets . bottom ) * 0.4 , 260 , 420 ) ,
233+ [ insets . bottom , insets . top , windowHeight ] ,
234+ ) ;
229235 const activeEclipseCenter = useMemo ( ( ) => eclipseCenterForRecord ( activeEclipse ) , [ activeEclipse ] ) ;
230236 const activeKindCode = useMemo (
231237 ( ) => ( activeEclipse ? kindCodeForRecord ( activeEclipse ) : "P" ) ,
@@ -408,24 +414,19 @@ export default function TimerScreen({
408414 accessibilityLabel = "Switch active eclipse"
409415 accessibilityState = { { disabled : ! eclipseOptions . length || isActiveEclipseLoading } }
410416 >
411- < View style = { styles . eclipseSwitcherTopRow } >
417+ < View style = { styles . eclipseSwitcherRow } >
412418 < Text style = { styles . eclipseSwitcherLabel } > Active Eclipse</ Text >
419+ < Text style = { styles . eclipseSwitcherValue } >
420+ { activeEclipseOption
421+ ? `${ activeEclipseOption . dateYmd } - ${ activeEclipseOption . kindLabel } `
422+ : "No eclipse selected" }
423+ </ Text >
413424 < Text style = { styles . eclipseSwitcherHint } > Switch</ Text >
414425 </ View >
415- < Text style = { styles . eclipseSwitcherValue } >
416- { activeEclipseOption
417- ? `${ activeEclipseOption . dateYmd } - ${ activeEclipseOption . kindLabel } `
418- : "No eclipse selected" }
419- </ Text >
420- < Text style = { styles . eclipseSwitcherMeta } >
421- { activeEclipseOption
422- ? `${ activeEclipseOption . id } - ${ activeEclipseOption . isPast ? "Past" : "Upcoming" } `
423- : "Pick an eclipse to compute on this screen" }
424- </ Text >
425426 </ Pressable >
426427 </ View >
427428
428- < View style = { styles . mapWrap } >
429+ < View style = { [ styles . mapWrap , { height : mapHeight } ] } >
429430 < MapView
430431 key = { `map-${ timer . mapType } ` }
431432 ref = { timer . mapRef }
@@ -610,9 +611,9 @@ export default function TimerScreen({
610611 </ View >
611612
612613 < View style = { styles . controls } >
613- < View style = { styles . btnRow } >
614+ < View style = { styles . btnRowCompact } >
614615 < Pressable
615- style = { [ styles . btn , isActiveEclipseLoading ? styles . btnDisabled : null ] }
616+ style = { [ styles . btnCompact , isActiveEclipseLoading ? styles . btnDisabled : null ] }
616617 onPress = { ( ) => {
617618 if ( ! activeEclipseCenter ) {
618619 timer . setStatusMessage ( "No center coordinates available for this eclipse" ) ;
@@ -622,16 +623,16 @@ export default function TimerScreen({
622623 } }
623624 disabled = { isActiveEclipseLoading }
624625 >
625- < Text style = { styles . btnText } > Greatest Eclipse</ Text >
626+ < Text style = { styles . btnCompactText } > Greatest Eclipse</ Text >
626627 </ Pressable >
627628
628629 < Pressable
629- style = { [ styles . btn , ! canAddCurrentPinToFavorites ? styles . btnDisabled : null ] }
630+ style = { [ styles . btnCompact , ! canAddCurrentPinToFavorites ? styles . btnDisabled : null ] }
630631 onPress = { openAddFavoriteModal }
631632 disabled = { ! canAddCurrentPinToFavorites }
632633 >
633- < Text style = { styles . btnText } >
634- { canAddCurrentPinToFavorites ? "Add to Favorites " : "Already in Favorites " }
634+ < Text style = { styles . btnCompactText } >
635+ { canAddCurrentPinToFavorites ? "Add Favorite " : "Saved " }
635636 </ Text >
636637 </ Pressable >
637638 </ View >
@@ -974,17 +975,16 @@ const styles = StyleSheet.create({
974975 borderWidth : 1 ,
975976 borderColor : "#2e3566" ,
976977 backgroundColor : "#151a43" ,
977- paddingVertical : 10 ,
978+ paddingVertical : 8 ,
978979 paddingHorizontal : 10 ,
979- gap : 4 ,
980980 } ,
981981 eclipseSwitcherBtnDisabled : {
982982 opacity : 0.68 ,
983983 } ,
984- eclipseSwitcherTopRow : {
984+ eclipseSwitcherRow : {
985985 flexDirection : "row" ,
986- justifyContent : "space-between" ,
987986 alignItems : "center" ,
987+ gap : 8 ,
988988 } ,
989989 eclipseSwitcherLabel : {
990990 color : "#b7beff" ,
@@ -995,28 +995,41 @@ const styles = StyleSheet.create({
995995 } ,
996996 eclipseSwitcherHint : {
997997 color : "#d9dcff" ,
998- fontSize : 11 ,
998+ fontSize : 10 ,
999999 fontWeight : "700" ,
10001000 } ,
10011001 eclipseSwitcherValue : {
10021002 color : "white" ,
1003- fontSize : 13 ,
1003+ flex : 1 ,
1004+ fontSize : 12 ,
10041005 fontWeight : "700" ,
10051006 } ,
1006- eclipseSwitcherMeta : {
1007- color : "#bcc2f4" ,
1008- fontSize : 11 ,
1009- } ,
1010- mapWrap : { height : 300 , marginHorizontal : 12 , borderRadius : 12 , overflow : "hidden" } ,
1007+ mapWrap : { marginHorizontal : 12 , borderRadius : 12 , overflow : "hidden" } ,
10111008 map : { flex : 1 } ,
10121009 controls : {
10131010 paddingHorizontal : 12 ,
1014- paddingTop : 10 ,
1015- gap : 10 ,
1011+ paddingTop : 6 ,
1012+ } ,
1013+ btnRowCompact : {
1014+ flexDirection : "row" ,
1015+ gap : 8 ,
1016+ } ,
1017+ btnCompact : {
1018+ borderRadius : 999 ,
1019+ borderWidth : 1 ,
1020+ borderColor : "#2f376f" ,
1021+ backgroundColor : "#11163d" ,
1022+ paddingVertical : 7 ,
1023+ paddingHorizontal : 11 ,
1024+ } ,
1025+ btnCompactText : {
1026+ color : "#eef0ff" ,
1027+ fontSize : 11 ,
1028+ fontWeight : "700" ,
10161029 } ,
10171030 favoriteWrap : {
10181031 paddingHorizontal : 12 ,
1019- paddingTop : 8 ,
1032+ paddingTop : 6 ,
10201033 gap : 6 ,
10211034 } ,
10221035 favoriteList : {
@@ -1040,11 +1053,6 @@ const styles = StyleSheet.create({
10401053 color : "#8f8f8f" ,
10411054 fontSize : 12 ,
10421055 } ,
1043- btnRow : {
1044- flexDirection : "row" ,
1045- flexWrap : "wrap" ,
1046- gap : 8 ,
1047- } ,
10481056 mapOverlayBtn : {
10491057 position : "absolute" ,
10501058 top : 10 ,
@@ -1195,16 +1203,9 @@ const styles = StyleSheet.create({
11951203 fontWeight : "800" ,
11961204 letterSpacing : 0.4 ,
11971205 } ,
1198- btn : {
1199- paddingVertical : 10 ,
1200- paddingHorizontal : 12 ,
1201- borderRadius : 10 ,
1202- backgroundColor : "#1f1f1f" ,
1203- } ,
12041206 btnDisabled : {
12051207 opacity : 0.7 ,
12061208 } ,
1207- btnText : { color : "white" , fontWeight : "600" } ,
12081209 statusBar : { paddingHorizontal : 12 , paddingTop : 8 } ,
12091210 statusText : { color : "#bdbdbd" , fontSize : 12 } ,
12101211 results : { flex : 1 , paddingHorizontal : 12 , paddingTop : 10 } ,
0 commit comments