@@ -139,49 +139,47 @@ const getPriceAndRequestsTextAndTooltip = ({
139139 const creditsText = (
140140 < Trans > { Math . max ( 0 , availableCredits ) } GDevelop credits available</ Trans >
141141 ) ;
142- const priceInCredits = price . priceInCredits ;
143- const maximumPriceInCredits =
144- ( price . variablePrice &&
145- price . variablePrice [ aiRequestMode ] &&
146- price . variablePrice [ aiRequestMode ] [ 'default' ] &&
147- price . variablePrice [ aiRequestMode ] [ 'default' ] . maximumPriceInCredits ) ||
148- null ;
149- const minimumPriceInCredits =
150- ( price . variablePrice &&
151- price . variablePrice [ aiRequestMode ] &&
152- price . variablePrice [ aiRequestMode ] [ 'default' ] &&
153- price . variablePrice [ aiRequestMode ] [ 'default' ] . minimumPriceInCredits ) ||
154- null ;
155142
156- const remainingDaysBeforeReset = quota . resetsAt
157- ? Math . ceil ( ( quota . resetsAt - Date . now ( ) ) / ( 1000 * 60 * 60 * 24 ) )
158- : null ;
159- const remainingDaysBeforeResetText = remainingDaysBeforeReset ? (
160- < Trans >
161- They reset in
162- { remainingDaysBeforeReset } day(s).
163- </ Trans >
164- ) : null ;
143+ const timeForReset = quota . resetsAt ? new Date ( quota . resetsAt ) : null ;
144+ const now = new Date ( ) ;
145+ let summarySentence = undefined ;
146+ if ( timeForReset ) {
147+ const timeDiff = timeForReset . getTime ( ) - now . getTime ( ) ;
148+ // Date to look like 'Nov 30th'
149+ const dateString = timeForReset . toLocaleDateString ( undefined , {
150+ month : 'short' ,
151+ day : 'numeric' ,
152+ } ) ;
153+ // Time to look like '14:05'
154+ const timeString = timeForReset . toLocaleTimeString ( undefined , {
155+ hour : '2-digit' ,
156+ minute : '2-digit' ,
157+ hour12 : false ,
158+ } ) ;
159+ if ( timeDiff <= 0 ) {
160+ summarySentence = < Trans > Your credits will reset soon.</ Trans > ;
161+ } else {
162+ summarySentence = (
163+ < Trans >
164+ You need to wait until { dateString } at { timeString } to reset to
165+ { quota . max } AI credits.
166+ </ Trans >
167+ ) ;
168+ }
169+ }
165170
166171 const tooltipText = (
167172 < ColumnStackLayout noMargin >
168- < Line noMargin >
169- < Trans >
170- { currentQuotaText } (out of { quota . max } ).
171- </ Trans >
172- { remainingDaysBeforeResetText }
173- </ Line >
174- < Line noMargin >
175- < Trans >
176- A request costs { minimumPriceInCredits } -{ maximumPriceInCredits } AI
177- credits, or { priceInCredits } GDevelop credits.
178- </ Trans >
179- </ Line >
173+ { summarySentence && < Line noMargin > { summarySentence } </ Line > }
180174 < Line noMargin >
181175 < Link
182- href = { getHelpLink ( '/interface/ai' ) }
176+ href = { getHelpLink ( '/interface/ai/' , 'cost-of-ai-requests ') }
183177 color = "secondary"
184- onClick = { ( ) => Window . openExternalURL ( getHelpLink ( '/interface/ai' ) ) }
178+ onClick = { ( ) =>
179+ Window . openExternalURL (
180+ getHelpLink ( '/interface/ai/' , 'cost-of-ai-requests' )
181+ )
182+ }
185183 >
186184 Learn more
187185 </ Link >
@@ -196,11 +194,7 @@ const getPriceAndRequestsTextAndTooltip = ({
196194 < LineStackLayout alignItems = "center" noMargin >
197195 { shouldShowCredits && < Coin fontSize = "small" /> }
198196 < Text size = "body-small" color = "secondary" noMargin >
199- { shouldShowCredits ? (
200- creditsText
201- ) : (
202- < Trans > { aiCreditsAvailable } AI credits available</ Trans >
203- ) }
197+ { shouldShowCredits ? creditsText : currentQuotaText }
204198 < span
205199 style = { {
206200 verticalAlign : 'middle' ,
0 commit comments