@@ -68,47 +68,52 @@ export default function Paywall() {
6868 }
6969 } ;
7070
71- // --- Render Logic ---
71+ // --- Render Logic ---
7272
73- // Loading state
74- if ( loading ) {
75- return (
76- < View style = { styles . centeredContainer } >
77- < ActivityIndicator size = "large" />
78- < Text style = { styles . statusText } > Loading Subscription...</ Text >
79- </ View >
80- ) ;
73+ // Determine button text and state
74+ const isLoadingOrError = loading || ! ! error || ! monthly ;
75+ let buttonText = "Upgrade to Pro" ;
76+ if ( monthly ?. product ?. priceString ) {
77+ buttonText = `upgrade · ${ monthly . product . priceString } ` ;
8178 }
8279
83- // Error state
84- if ( error ) {
85- return (
86- < View style = { styles . centeredContainer } >
87- < Text style = { styles . errorText } > Error</ Text >
88- < Text style = { styles . statusText } > { error } </ Text >
89- { /* Optionally add a retry button here */ }
90- </ View >
91- ) ;
92- }
93-
94- // No monthly package found (but no specific error occurred)
95- // This path might be hit if Offerings structure is valid but has no 'monthly' package
96- if ( ! monthly ) {
97- return (
98- < View style = { styles . centeredContainer } >
99- < Text style = { styles . errorText } > Unavailable</ Text >
100- < Text style = { styles . statusText } > No subscription plans are currently configured.</ Text >
101- </ View >
102- ) ;
103- }
104-
105- // Success state: Render the paywall content
10680 return (
10781 < View style = { styles . paywallContainer } >
82+ { /* Title and Subtitle always shown */ }
10883 < Text style = { styles . titleText } > note companion pro</ Text >
10984 < Text style = { styles . subtitleText } > unlimited tokens • priority ocr • gpt‑4 vision</ Text >
110- < TouchableOpacity onPress = { buy } style = { styles . buyButton } >
111- < Text style = { styles . buyButtonText } > upgrade · { monthly . product . price_string } </ Text >
85+
86+ { /* Loading Indicator */ }
87+ { loading && (
88+ < View style = { styles . statusContainer } >
89+ < ActivityIndicator size = "large" />
90+ < Text style = { styles . statusText } > Loading Subscription...</ Text >
91+ </ View >
92+ ) }
93+
94+ { /* Error Message - Display inline */ }
95+ { error && ! loading && (
96+ < View style = { styles . statusContainer } >
97+ < Text style = { styles . errorText } > Error</ Text >
98+ < Text style = { [ styles . statusText , { color : styles . errorText . color } ] } > { error } </ Text >
99+ </ View >
100+ ) }
101+
102+ { /* Offer Unavailable Message - Display inline */ }
103+ { ! monthly && ! loading && ! error && (
104+ < View style = { styles . statusContainer } >
105+ < Text style = { styles . errorText } > Unavailable</ Text >
106+ < Text style = { styles . statusText } > No subscription plans are currently configured.</ Text >
107+ </ View >
108+ ) }
109+
110+ { /* Buy Button - Always shown, disabled if needed */ }
111+ < TouchableOpacity
112+ onPress = { buy }
113+ style = { [ styles . buyButton , isLoadingOrError && styles . disabledButton ] } // Apply disabled style
114+ disabled = { isLoadingOrError } // Disable touch interaction
115+ >
116+ < Text style = { styles . buyButtonText } > { buttonText } </ Text >
112117 </ TouchableOpacity >
113118 </ View >
114119 ) ;
@@ -121,6 +126,7 @@ const styles = StyleSheet.create({
121126 justifyContent : "center" ,
122127 alignItems : "center" ,
123128 padding : 20 ,
129+ backgroundColor : 'white' ,
124130 } ,
125131 paywallContainer : {
126132 flex : 1 ,
@@ -129,6 +135,11 @@ const styles = StyleSheet.create({
129135 padding : 24 ,
130136 backgroundColor : 'white' , // Example background
131137 } ,
138+ statusContainer : { // Added container for status/error messages
139+ alignItems : 'center' ,
140+ marginBottom : 20 , // Space before the button
141+ paddingHorizontal : 10 , // Prevent text overflowing edges
142+ } ,
132143 statusText : {
133144 marginTop : 10 ,
134145 color : "#666" ,
@@ -139,6 +150,7 @@ const styles = StyleSheet.create({
139150 fontWeight : 'bold' ,
140151 color : '#E53E3E' , // Red color for errors
141152 marginBottom : 5 ,
153+ textAlign : 'center' ,
142154 } ,
143155 titleText : {
144156 fontSize : 24 ,
@@ -160,4 +172,8 @@ const styles = StyleSheet.create({
160172 color : "#fff" ,
161173 fontWeight : "600" ,
162174 } ,
175+ disabledButton : { // Style for disabled button
176+ backgroundColor : '#cccccc' , // Greyed out
177+ opacity : 0.7 ,
178+ } ,
163179} ) ;
0 commit comments