react-native-monflowts 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +37 -3
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/java/com/monflowts/MonflowtsLottieView.kt +12 -4
  4. package/android/src/main/java/com/monflowts/MonflowtsNavigationModule.kt +43 -0
  5. package/android/src/main/java/com/monflowts/MonflowtsPackage.kt +10 -1
  6. package/android/src/main/java/com/monflowts/MonflowtsStackView.kt +456 -0
  7. package/android/src/main/java/com/monflowts/MonflowtsStackViewManager.kt +70 -0
  8. package/android/src/main/java/com/monflowts/MonflowtsWebView.kt +35 -11
  9. package/android/src/main/java/com/monflowts/MonflowtsWebViewManager.kt +10 -0
  10. package/ios/MonflowtsNavigationBridge.m +10 -0
  11. package/ios/MonflowtsNavigationModule.swift +28 -0
  12. package/ios/MonflowtsStackBridge.m +17 -0
  13. package/ios/MonflowtsStackUIView.swift +409 -0
  14. package/ios/MonflowtsStackViewManager.swift +14 -0
  15. package/ios/MonflowtsWebBridge.m +1 -0
  16. package/ios/MonflowtsWebUIView.swift +21 -0
  17. package/lib/module/HubContent.js +259 -219
  18. package/lib/module/HubContent.js.map +1 -1
  19. package/lib/module/MonflowtsHub.js +42 -3
  20. package/lib/module/MonflowtsHub.js.map +1 -1
  21. package/lib/module/NativeWebView.js.map +1 -1
  22. package/lib/module/api/mutations.js +4 -0
  23. package/lib/module/api/mutations.js.map +1 -1
  24. package/lib/module/api/queries.js +9 -3
  25. package/lib/module/api/queries.js.map +1 -1
  26. package/lib/module/components/AbandonPolicyNotice.js +7 -6
  27. package/lib/module/components/AbandonPolicyNotice.js.map +1 -1
  28. package/lib/module/components/CoinFlyOverlay.js +27 -20
  29. package/lib/module/components/CoinFlyOverlay.js.map +1 -1
  30. package/lib/module/components/GameRulesModal.js +13 -11
  31. package/lib/module/components/GameRulesModal.js.map +1 -1
  32. package/lib/module/components/HypeCallout.js +5 -5
  33. package/lib/module/components/HypeCallout.js.map +1 -1
  34. package/lib/module/components/InsufficientFundsOverlay.js +4 -3
  35. package/lib/module/components/InsufficientFundsOverlay.js.map +1 -1
  36. package/lib/module/components/JackpotNearMiss.js +4 -3
  37. package/lib/module/components/JackpotNearMiss.js.map +1 -1
  38. package/lib/module/components/JackpotTeaser.js +10 -9
  39. package/lib/module/components/JackpotTeaser.js.map +1 -1
  40. package/lib/module/components/MonflowtsButton.js +7 -4
  41. package/lib/module/components/MonflowtsButton.js.map +1 -1
  42. package/lib/module/components/QuitConfirmModal.js +8 -7
  43. package/lib/module/components/QuitConfirmModal.js.map +1 -1
  44. package/lib/module/components/SessionTimer.js +3 -2
  45. package/lib/module/components/SessionTimer.js.map +1 -1
  46. package/lib/module/components/ShopArtView.js +105 -0
  47. package/lib/module/components/ShopArtView.js.map +1 -0
  48. package/lib/module/components/SideDemoTab.js +22 -4
  49. package/lib/module/components/SideDemoTab.js.map +1 -1
  50. package/lib/module/components/StakeInput.js +7 -6
  51. package/lib/module/components/StakeInput.js.map +1 -1
  52. package/lib/module/content.js.map +1 -1
  53. package/lib/module/hooks/useAvailableGames.js +7 -2
  54. package/lib/module/hooks/useAvailableGames.js.map +1 -1
  55. package/lib/module/hooks/useLeaderboard.js.map +1 -1
  56. package/lib/module/hooks/usePlayGame.js +11 -5
  57. package/lib/module/hooks/usePlayGame.js.map +1 -1
  58. package/lib/module/hooks/useRaffleDrawState.js +4 -1
  59. package/lib/module/hooks/useRaffleDrawState.js.map +1 -1
  60. package/lib/module/index.js +15 -0
  61. package/lib/module/index.js.map +1 -1
  62. package/lib/module/navigation/NativeStackView.js +5 -0
  63. package/lib/module/navigation/NativeStackView.js.map +1 -0
  64. package/lib/module/navigation/Navigator.js +250 -0
  65. package/lib/module/navigation/Navigator.js.map +1 -0
  66. package/lib/module/navigation/engine.js +466 -0
  67. package/lib/module/navigation/engine.js.map +1 -0
  68. package/lib/module/navigation/hooks.js +29 -0
  69. package/lib/module/navigation/hooks.js.map +1 -0
  70. package/lib/module/navigation/index.js +7 -0
  71. package/lib/module/navigation/index.js.map +1 -0
  72. package/lib/module/navigation/routes.js +111 -0
  73. package/lib/module/navigation/routes.js.map +1 -0
  74. package/lib/module/theme.js +13 -13
  75. package/lib/module/theme.js.map +1 -1
  76. package/lib/module/utils/scale.js +35 -0
  77. package/lib/module/utils/scale.js.map +1 -0
  78. package/lib/module/views/DepositSelect.js +8 -7
  79. package/lib/module/views/DepositSelect.js.map +1 -1
  80. package/lib/module/views/DiceBattle.js +589 -218
  81. package/lib/module/views/DiceBattle.js.map +1 -1
  82. package/lib/module/views/DiceLobby.js +113 -74
  83. package/lib/module/views/DiceLobby.js.map +1 -1
  84. package/lib/module/views/FortuneWheel.js +417 -271
  85. package/lib/module/views/FortuneWheel.js.map +1 -1
  86. package/lib/module/views/Freefall.js +149 -90
  87. package/lib/module/views/Freefall.js.map +1 -1
  88. package/lib/module/views/History.js +10 -9
  89. package/lib/module/views/History.js.map +1 -1
  90. package/lib/module/views/Home.js +1058 -401
  91. package/lib/module/views/Home.js.map +1 -1
  92. package/lib/module/views/Jetstream.js +47 -23
  93. package/lib/module/views/Jetstream.js.map +1 -1
  94. package/lib/module/views/Leaderboard.js +112 -103
  95. package/lib/module/views/Leaderboard.js.map +1 -1
  96. package/lib/module/views/MillionaireHunter.js +752 -578
  97. package/lib/module/views/MillionaireHunter.js.map +1 -1
  98. package/lib/module/views/Minefield.js +41 -19
  99. package/lib/module/views/Minefield.js.map +1 -1
  100. package/lib/module/views/PaymentWebView.js +7 -6
  101. package/lib/module/views/PaymentWebView.js.map +1 -1
  102. package/lib/module/views/PlayerCard.js +5 -4
  103. package/lib/module/views/PlayerCard.js.map +1 -1
  104. package/lib/module/views/Profile.js +11 -10
  105. package/lib/module/views/Profile.js.map +1 -1
  106. package/lib/module/views/RaffleDraw.js +37 -27
  107. package/lib/module/views/RaffleDraw.js.map +1 -1
  108. package/lib/module/views/RevealWin.js +161 -34
  109. package/lib/module/views/RevealWin.js.map +1 -1
  110. package/lib/module/views/Splash.js +3 -2
  111. package/lib/module/views/Splash.js.map +1 -1
  112. package/lib/module/views/Success.js +6 -3
  113. package/lib/module/views/Success.js.map +1 -1
  114. package/lib/module/views/TicketShop.js +1067 -236
  115. package/lib/module/views/TicketShop.js.map +1 -1
  116. package/lib/module/views/TriviaLobby.js +57 -31
  117. package/lib/module/views/TriviaLobby.js.map +1 -1
  118. package/lib/module/views/TriviaMaster.js +28 -23
  119. package/lib/module/views/TriviaMaster.js.map +1 -1
  120. package/lib/module/views/Wallet.js +18 -17
  121. package/lib/module/views/Wallet.js.map +1 -1
  122. package/lib/module/views/WithdrawFlow.js +6 -5
  123. package/lib/module/views/WithdrawFlow.js.map +1 -1
  124. package/lib/module/views/dice3d/DiceTable3D.js +131 -0
  125. package/lib/module/views/dice3d/DiceTable3D.js.map +1 -0
  126. package/lib/module/views/dice3d/diceScene.js +873 -0
  127. package/lib/module/views/dice3d/diceScene.js.map +1 -0
  128. package/lib/module/views/dice3d/diceSim.js +300 -0
  129. package/lib/module/views/dice3d/diceSim.js.map +1 -0
  130. package/lib/module/views/diceDuel.js +35 -0
  131. package/lib/module/views/diceDuel.js.map +1 -0
  132. package/lib/module/views/freefallDrop.js +66 -0
  133. package/lib/module/views/freefallDrop.js.map +1 -0
  134. package/lib/module/views/homeLayout.js +47 -0
  135. package/lib/module/views/homeLayout.js.map +1 -0
  136. package/lib/module/views/launchFeatured.js +43 -0
  137. package/lib/module/views/launchFeatured.js.map +1 -0
  138. package/lib/module/views/leaderboardPhase.js +52 -0
  139. package/lib/module/views/leaderboardPhase.js.map +1 -0
  140. package/lib/module/views/lobbyKit.js +224 -0
  141. package/lib/module/views/lobbyKit.js.map +1 -0
  142. package/lib/module/views/raffleContent.js +11 -0
  143. package/lib/module/views/raffleContent.js.map +1 -0
  144. package/lib/module/views/rafflePhase.js +15 -0
  145. package/lib/module/views/rafflePhase.js.map +1 -0
  146. package/lib/module/views/revealWinHelpers.js +19 -0
  147. package/lib/module/views/revealWinHelpers.js.map +1 -1
  148. package/lib/module/views/shopArtMotion.js +25 -0
  149. package/lib/module/views/shopArtMotion.js.map +1 -0
  150. package/lib/module/views/ticketBundlePresets.js +15 -12
  151. package/lib/module/views/ticketBundlePresets.js.map +1 -1
  152. package/lib/module/views/ticketShopArt.js +391 -0
  153. package/lib/module/views/ticketShopArt.js.map +1 -0
  154. package/lib/module/views/treasureHunt.js +81 -0
  155. package/lib/module/views/treasureHunt.js.map +1 -0
  156. package/lib/module/views/wheelLayout.js +47 -0
  157. package/lib/module/views/wheelLayout.js.map +1 -0
  158. package/lib/typescript/src/HubContent.d.ts.map +1 -1
  159. package/lib/typescript/src/MonflowtsHub.d.ts.map +1 -1
  160. package/lib/typescript/src/NativeWebView.d.ts +1 -0
  161. package/lib/typescript/src/NativeWebView.d.ts.map +1 -1
  162. package/lib/typescript/src/api/gameTypes.d.ts +18 -2
  163. package/lib/typescript/src/api/gameTypes.d.ts.map +1 -1
  164. package/lib/typescript/src/api/mutations.d.ts.map +1 -1
  165. package/lib/typescript/src/api/queries.d.ts.map +1 -1
  166. package/lib/typescript/src/api/sdkTypes.d.ts +3 -0
  167. package/lib/typescript/src/api/sdkTypes.d.ts.map +1 -1
  168. package/lib/typescript/src/components/AbandonPolicyNotice.d.ts.map +1 -1
  169. package/lib/typescript/src/components/CoinFlyOverlay.d.ts.map +1 -1
  170. package/lib/typescript/src/components/GameRulesModal.d.ts +1 -0
  171. package/lib/typescript/src/components/GameRulesModal.d.ts.map +1 -1
  172. package/lib/typescript/src/components/HypeCallout.d.ts.map +1 -1
  173. package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts.map +1 -1
  174. package/lib/typescript/src/components/JackpotNearMiss.d.ts.map +1 -1
  175. package/lib/typescript/src/components/JackpotTeaser.d.ts.map +1 -1
  176. package/lib/typescript/src/components/MonflowtsButton.d.ts.map +1 -1
  177. package/lib/typescript/src/components/QuitConfirmModal.d.ts.map +1 -1
  178. package/lib/typescript/src/components/SessionTimer.d.ts.map +1 -1
  179. package/lib/typescript/src/components/ShopArtView.d.ts +11 -0
  180. package/lib/typescript/src/components/ShopArtView.d.ts.map +1 -0
  181. package/lib/typescript/src/components/SideDemoTab.d.ts +1 -0
  182. package/lib/typescript/src/components/SideDemoTab.d.ts.map +1 -1
  183. package/lib/typescript/src/components/StakeInput.d.ts.map +1 -1
  184. package/lib/typescript/src/content.d.ts +1 -0
  185. package/lib/typescript/src/content.d.ts.map +1 -1
  186. package/lib/typescript/src/hooks/useAvailableGames.d.ts +3 -0
  187. package/lib/typescript/src/hooks/useAvailableGames.d.ts.map +1 -1
  188. package/lib/typescript/src/hooks/useLeaderboard.d.ts +4 -0
  189. package/lib/typescript/src/hooks/useLeaderboard.d.ts.map +1 -1
  190. package/lib/typescript/src/hooks/usePlayGame.d.ts +1 -1
  191. package/lib/typescript/src/hooks/usePlayGame.d.ts.map +1 -1
  192. package/lib/typescript/src/hooks/useRaffleDrawState.d.ts.map +1 -1
  193. package/lib/typescript/src/index.d.ts +16 -0
  194. package/lib/typescript/src/index.d.ts.map +1 -1
  195. package/lib/typescript/src/navigation/NativeStackView.d.ts +41 -0
  196. package/lib/typescript/src/navigation/NativeStackView.d.ts.map +1 -0
  197. package/lib/typescript/src/navigation/Navigator.d.ts +13 -0
  198. package/lib/typescript/src/navigation/Navigator.d.ts.map +1 -0
  199. package/lib/typescript/src/navigation/engine.d.ts +69 -0
  200. package/lib/typescript/src/navigation/engine.d.ts.map +1 -0
  201. package/lib/typescript/src/navigation/hooks.d.ts +6 -0
  202. package/lib/typescript/src/navigation/hooks.d.ts.map +1 -0
  203. package/lib/typescript/src/navigation/index.d.ts +7 -0
  204. package/lib/typescript/src/navigation/index.d.ts.map +1 -0
  205. package/lib/typescript/src/navigation/routes.d.ts +80 -0
  206. package/lib/typescript/src/navigation/routes.d.ts.map +1 -0
  207. package/lib/typescript/src/theme.d.ts +3 -3
  208. package/lib/typescript/src/types.d.ts +0 -9
  209. package/lib/typescript/src/types.d.ts.map +1 -1
  210. package/lib/typescript/src/utils/scale.d.ts +12 -0
  211. package/lib/typescript/src/utils/scale.d.ts.map +1 -0
  212. package/lib/typescript/src/views/DiceBattle.d.ts.map +1 -1
  213. package/lib/typescript/src/views/DiceLobby.d.ts.map +1 -1
  214. package/lib/typescript/src/views/FortuneWheel.d.ts.map +1 -1
  215. package/lib/typescript/src/views/Freefall.d.ts.map +1 -1
  216. package/lib/typescript/src/views/History.d.ts.map +1 -1
  217. package/lib/typescript/src/views/Home.d.ts +2 -2
  218. package/lib/typescript/src/views/Home.d.ts.map +1 -1
  219. package/lib/typescript/src/views/Jetstream.d.ts.map +1 -1
  220. package/lib/typescript/src/views/Leaderboard.d.ts.map +1 -1
  221. package/lib/typescript/src/views/MillionaireHunter.d.ts.map +1 -1
  222. package/lib/typescript/src/views/Minefield.d.ts.map +1 -1
  223. package/lib/typescript/src/views/PlayerCard.d.ts.map +1 -1
  224. package/lib/typescript/src/views/Profile.d.ts.map +1 -1
  225. package/lib/typescript/src/views/RaffleDraw.d.ts +2 -1
  226. package/lib/typescript/src/views/RaffleDraw.d.ts.map +1 -1
  227. package/lib/typescript/src/views/RevealWin.d.ts.map +1 -1
  228. package/lib/typescript/src/views/Splash.d.ts.map +1 -1
  229. package/lib/typescript/src/views/Success.d.ts.map +1 -1
  230. package/lib/typescript/src/views/TicketShop.d.ts +1 -0
  231. package/lib/typescript/src/views/TicketShop.d.ts.map +1 -1
  232. package/lib/typescript/src/views/TriviaLobby.d.ts.map +1 -1
  233. package/lib/typescript/src/views/TriviaMaster.d.ts.map +1 -1
  234. package/lib/typescript/src/views/Wallet.d.ts.map +1 -1
  235. package/lib/typescript/src/views/dice3d/DiceTable3D.d.ts +41 -0
  236. package/lib/typescript/src/views/dice3d/DiceTable3D.d.ts.map +1 -0
  237. package/lib/typescript/src/views/dice3d/diceScene.d.ts +2 -0
  238. package/lib/typescript/src/views/dice3d/diceScene.d.ts.map +1 -0
  239. package/lib/typescript/src/views/dice3d/diceSim.d.ts +2 -0
  240. package/lib/typescript/src/views/dice3d/diceSim.d.ts.map +1 -0
  241. package/lib/typescript/src/views/diceDuel.d.ts +15 -0
  242. package/lib/typescript/src/views/diceDuel.d.ts.map +1 -0
  243. package/lib/typescript/src/views/freefallDrop.d.ts +19 -0
  244. package/lib/typescript/src/views/freefallDrop.d.ts.map +1 -0
  245. package/lib/typescript/src/views/homeLayout.d.ts +15 -0
  246. package/lib/typescript/src/views/homeLayout.d.ts.map +1 -0
  247. package/lib/typescript/src/views/launchFeatured.d.ts +2 -0
  248. package/lib/typescript/src/views/launchFeatured.d.ts.map +1 -0
  249. package/lib/typescript/src/views/leaderboardPhase.d.ts +6 -0
  250. package/lib/typescript/src/views/leaderboardPhase.d.ts.map +1 -0
  251. package/lib/typescript/src/views/lobbyKit.d.ts +45 -0
  252. package/lib/typescript/src/views/lobbyKit.d.ts.map +1 -0
  253. package/lib/typescript/src/views/raffleContent.d.ts +3 -0
  254. package/lib/typescript/src/views/raffleContent.d.ts.map +1 -0
  255. package/lib/typescript/src/views/rafflePhase.d.ts +9 -0
  256. package/lib/typescript/src/views/rafflePhase.d.ts.map +1 -0
  257. package/lib/typescript/src/views/revealWinHelpers.d.ts +9 -0
  258. package/lib/typescript/src/views/revealWinHelpers.d.ts.map +1 -1
  259. package/lib/typescript/src/views/shopArtMotion.d.ts +13 -0
  260. package/lib/typescript/src/views/shopArtMotion.d.ts.map +1 -0
  261. package/lib/typescript/src/views/ticketBundlePresets.d.ts +3 -17
  262. package/lib/typescript/src/views/ticketBundlePresets.d.ts.map +1 -1
  263. package/lib/typescript/src/views/ticketShopArt.d.ts +27 -0
  264. package/lib/typescript/src/views/ticketShopArt.d.ts.map +1 -0
  265. package/lib/typescript/src/views/treasureHunt.d.ts +29 -0
  266. package/lib/typescript/src/views/treasureHunt.d.ts.map +1 -0
  267. package/lib/typescript/src/views/wheelLayout.d.ts +30 -0
  268. package/lib/typescript/src/views/wheelLayout.d.ts.map +1 -0
  269. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import React, { useState, useEffect, useCallback, useRef } from 'react';
4
- import { View, Text, FlatList, ActivityIndicator, Modal, StyleSheet } from 'react-native';
4
+ import { View, Text, FlatList, ActivityIndicator, Modal } from 'react-native';
5
+ import { scaledStyles } from "../utils/scale.js";
5
6
  import { useQuery } from '@apollo/client/react';
6
7
  import { COLORS } from "../constants.js";
7
8
  import { theme } from "../theme.js";
@@ -13,6 +14,7 @@ import { useCurrency } from "../hooks/useCurrency.js";
13
14
  import { useNotifications } from "../hooks/useNotifications.js";
14
15
  import { GET_LEADERBOARD_RAFFLE_HISTORY } from "../api/queries.js";
15
16
  import { t, formatNumber, formatDate } from "../i18n.js";
17
+ import { countdownText, leaderboardPhase, rafflePeriod } from "./leaderboardPhase.js";
16
18
 
17
19
  // ─── Props ────────────────────────────────────────────────────────────────────
18
20
 
@@ -56,15 +58,6 @@ function getInitials(name) {
56
58
  }
57
59
  return (parts[0]?.[0] ?? '?').toUpperCase();
58
60
  }
59
- function buildCountdown(target) {
60
- if (!target) return '—:—:—';
61
- const diff = target.getTime() - Date.now();
62
- if (diff <= 0) return '00:00:00';
63
- const h = Math.floor(diff / 3_600_000);
64
- const m = Math.floor(diff % 3_600_000 / 60_000);
65
- const s = Math.floor(diff % 60_000 / 1_000);
66
- return [h, m, s].map(n => String(n).padStart(2, '0')).join(':');
67
- }
68
61
 
69
62
  /** Relative time for recent notifications, falling back to a short date. */
70
63
  function formatRelativeDate(iso) {
@@ -95,29 +88,9 @@ function formatRelativeDate(iso) {
95
88
  const PHASE_ANNOUNCEMENT_KEYS = {
96
89
  locked: 'leaderboard.finalistsLockedAnnouncement',
97
90
  drawing: 'leaderboard.drawInProgressAnnouncement',
98
- announced: 'leaderboard.winnerAnnouncedAnnouncement'
91
+ announced: 'leaderboard.winnerAnnouncedAnnouncement',
92
+ cancelled: 'leaderboard.roundCancelled'
99
93
  };
100
- function derivePhase(state) {
101
- switch (state) {
102
- case 'QUALIFICATION_CLOSING':
103
- return 'closing';
104
- case 'QUALIFICATION_CLOSED':
105
- case 'SNAPSHOT_READY':
106
- case 'DRAW_READY':
107
- return 'locked';
108
- case 'DRAW_IN_PROGRESS':
109
- case 'RESULT_COMMITTED':
110
- return 'drawing';
111
- case 'RESULT_PUBLISHED':
112
- case 'PRIZE_PROCESSING':
113
- case 'COMPLETED':
114
- return 'announced';
115
- // QUALIFICATION_OPEN, any state earlier in the lifecycle (DRAFT/SCHEDULED),
116
- // an absent/unknown state, and a null `active` all keep current behavior.
117
- default:
118
- return 'open';
119
- }
120
- }
121
94
 
122
95
  // ─── Component ────────────────────────────────────────────────────────────────
123
96
 
@@ -143,9 +116,12 @@ const Leaderboard = ({
143
116
  markRead
144
117
  } = useNotifications();
145
118
  const [notifModalVisible, setNotifModalVisible] = useState(false);
119
+ const phase = leaderboardPhase(active?.instance?.state);
120
+ const period = rafflePeriod(active?.schedule?.recurrence);
121
+ const liveWinner = phase === 'announced' ? active?.winner ?? null : null;
146
122
 
147
123
  // ── Last-winner fallback — only queried while there's no live winner banner ──
148
- const hasLiveWinner = !!active?.winner;
124
+ const hasLiveWinner = !!liveWinner;
149
125
  const historyQ = useQuery(GET_LEADERBOARD_RAFFLE_HISTORY, {
150
126
  variables: {
151
127
  limit: 1
@@ -159,42 +135,44 @@ const Leaderboard = ({
159
135
  const lastWinnerExtraCount = Math.max((lastHistoryEntry?.winners?.length ?? 0) - 1, 0);
160
136
 
161
137
  // ── Header phase (derived from instance state — drives countdown vs. locked/drawing/announced) ──
162
- const phase = derivePhase(active?.instance?.state);
163
- const showsCountdown = phase === 'open' || phase === 'closing';
138
+ const instance = active?.instance;
139
+ const countdownTargets = {
140
+ upcoming: instance?.qualificationOpensAt,
141
+ open: instance?.qualificationClosesAt,
142
+ locked: instance?.drawScheduledAt
143
+ };
144
+ const countdownTarget = active?.schedule?.publicCountdownVisible === false ? null : countdownTargets[phase] ?? null;
145
+ const showsLive = phase === 'open' || phase === 'locked' || phase === 'drawing' || phase === 'announced';
164
146
 
165
147
  // ── Countdown ──
166
- const closesAtStr = active?.instance?.qualificationClosesAt ?? null;
167
- const [countdown, setCountdown] = useState(() => buildCountdown(closesAtStr ? new Date(closesAtStr) : null));
148
+ const [countdown, setCountdown] = useState(() => countdownText(countdownTarget, Date.now()));
168
149
  const prevMinRef = useRef(null);
169
150
  const [srCountdown, setSrCountdown] = useState('');
170
151
  useEffect(() => {
171
- if (!showsCountdown) {
152
+ prevMinRef.current = null;
153
+ const announcementKey = PHASE_ANNOUNCEMENT_KEYS[phase];
154
+ if (!countdownTarget) {
172
155
  // Qualification is no longer open — stop ticking (no dead timer) and
173
156
  // announce the phase change once instead of leaving stale countdown text.
174
- prevMinRef.current = null;
175
- const announcementKey = PHASE_ANNOUNCEMENT_KEYS[phase];
157
+ setCountdown(null);
176
158
  setSrCountdown(announcementKey ? t(announcementKey) : '');
177
159
  return;
178
160
  }
179
- if (!closesAtStr) {
180
- setCountdown('—:—:—');
181
- return;
182
- }
183
- const target = new Date(closesAtStr);
161
+ const target = Date.parse(countdownTarget);
184
162
  const tick = () => {
185
- const str = buildCountdown(target);
163
+ const str = countdownText(countdownTarget, Date.now());
186
164
  setCountdown(str);
187
- const diff = target.getTime() - Date.now();
165
+ const diff = target - Date.now();
188
166
  const m = diff > 0 ? Math.floor(diff % 3_600_000 / 60_000) : 0;
189
- if (prevMinRef.current !== m) {
167
+ if (str && prevMinRef.current !== m) {
168
+ setSrCountdown(prevMinRef.current === null && announcementKey ? `${t(announcementKey)}, ${str}` : str);
190
169
  prevMinRef.current = m;
191
- setSrCountdown(str);
192
170
  }
193
171
  };
194
172
  tick();
195
173
  const id = setInterval(tick, 1000);
196
174
  return () => clearInterval(id);
197
- }, [closesAtStr, showsCountdown, phase]);
175
+ }, [countdownTarget, phase]);
198
176
 
199
177
  // ── Score formatter ──
200
178
  // EXPANSION R2 — honest formatting driven by scoreUnit ('POINTS' for a weighted
@@ -216,7 +194,8 @@ const Leaderboard = ({
216
194
 
217
195
  // ── Data ──
218
196
  const entries = leaderboard?.entries ?? [];
219
- const qualifyingPositions = leaderboard?.qualifyingPositions ?? 0;
197
+ const qualifyingPositions = leaderboard?.qualifyingPositions ?? active?.leaderboardDisplay?.qualifyingPositions ?? 0;
198
+ const lastFinalistId = entries.reduce((id, e) => e.qualified && !e.isBot ? e.entryId : id, null);
220
199
  const myRank = myPosition?.rank ?? null;
221
200
  const isMyRankVisible = myRank != null && myRank <= entries.length;
222
201
  const isMyRankOutside = myRank != null && myRank > entries.length;
@@ -228,27 +207,27 @@ const Leaderboard = ({
228
207
  // ── Phase row — countdown while qualification is open/closing, otherwise a static status ──
229
208
  const renderPhaseRow = () => {
230
209
  switch (phase) {
231
- case 'open':
210
+ case 'upcoming':
232
211
  return /*#__PURE__*/_jsxs(View, {
233
212
  style: styles.countdownRow,
234
213
  children: [/*#__PURE__*/_jsx(Text, {
235
214
  style: styles.countdownLabel,
236
- children: t('leaderboard.closesIn')
237
- }), /*#__PURE__*/_jsx(Text, {
215
+ children: t(countdown ? 'leaderboard.opensIn' : 'leaderboard.opensSoon')
216
+ }), countdown ? /*#__PURE__*/_jsx(Text, {
238
217
  style: styles.countdownValue,
239
218
  children: countdown
240
- })]
219
+ }) : null]
241
220
  });
242
- case 'closing':
221
+ case 'open':
243
222
  return /*#__PURE__*/_jsxs(View, {
244
223
  style: styles.countdownRow,
245
224
  children: [/*#__PURE__*/_jsx(Text, {
246
225
  style: styles.countdownLabel,
247
- children: t('leaderboard.closingSoon')
248
- }), /*#__PURE__*/_jsx(Text, {
226
+ children: t(countdown ? 'leaderboard.closesIn' : 'leaderboard.qualificationOpen')
227
+ }), countdown ? /*#__PURE__*/_jsx(Text, {
249
228
  style: styles.countdownValue,
250
229
  children: countdown
251
- })]
230
+ }) : null]
252
231
  });
253
232
  case 'locked':
254
233
  return /*#__PURE__*/_jsxs(View, {
@@ -268,10 +247,22 @@ const Leaderboard = ({
268
247
  color: COLORS.gold
269
248
  }), /*#__PURE__*/_jsx(Text, {
270
249
  style: styles.phaseValueGold,
271
- children: t('leaderboard.drawComingSoon')
250
+ children: countdown ? t('leaderboard.drawInTime', {
251
+ time: countdown
252
+ }) : t('leaderboard.drawComingSoon')
272
253
  })]
273
254
  })]
274
255
  });
256
+ case 'cancelled':
257
+ return /*#__PURE__*/_jsx(View, {
258
+ style: styles.countdownRow,
259
+ children: /*#__PURE__*/_jsx(Text, {
260
+ style: [styles.emptyText, {
261
+ flexShrink: 1
262
+ }],
263
+ children: t('leaderboard.roundCancelled')
264
+ })
265
+ });
275
266
  case 'drawing':
276
267
  return /*#__PURE__*/_jsx(View, {
277
268
  style: [styles.countdownRow, styles.phaseRowGold, theme.goldShadow],
@@ -313,23 +304,23 @@ const Leaderboard = ({
313
304
  style: styles.headerTitle,
314
305
  numberOfLines: 1,
315
306
  accessibilityRole: "header",
316
- children: active?.displayName ?? t('leaderboard.weeklyLeaderboard')
317
- }), /*#__PURE__*/_jsx(Text, {
307
+ children: active?.displayName ?? t(`leaderboard.title.${period}`)
308
+ }), active ? /*#__PURE__*/_jsx(Text, {
318
309
  style: styles.headerSubtitle,
319
310
  accessibilityLabel: botCount != null && botCount > 0 ? t('leaderboard.subtitleA11y', {
320
311
  players: leaderboard?.participantCount ?? 0,
321
- finalists: active?.instance?.finalistCount ?? leaderboard?.qualifyingPositions ?? 0,
312
+ finalists: qualifyingPositions,
322
313
  bots: botCount
323
314
  }) : undefined,
324
315
  children: botCount != null && botCount > 0 ? t('leaderboard.subtitleWithBots', {
325
316
  players: leaderboard?.participantCount ?? 0,
326
- finalists: active?.instance?.finalistCount ?? leaderboard?.qualifyingPositions ?? 0,
317
+ finalists: qualifyingPositions,
327
318
  bots: botCount
328
319
  }) : t('leaderboard.subtitle', {
329
320
  players: leaderboard?.participantCount ?? 0,
330
- finalists: active?.instance?.finalistCount ?? leaderboard?.qualifyingPositions ?? 0
321
+ finalists: qualifyingPositions
331
322
  })
332
- })]
323
+ }) : null]
333
324
  }), /*#__PURE__*/_jsxs(View, {
334
325
  style: styles.headerRight,
335
326
  children: [/*#__PURE__*/_jsxs(MonflowtsPressable, {
@@ -350,7 +341,7 @@ const Leaderboard = ({
350
341
  children: unreadCount > 9 ? '9+' : unreadCount
351
342
  })
352
343
  })]
353
- }), /*#__PURE__*/_jsxs(View, {
344
+ }), showsLive ? /*#__PURE__*/_jsxs(View, {
354
345
  style: styles.liveRow,
355
346
  children: [/*#__PURE__*/_jsx(View, {
356
347
  style: [styles.liveDot, connected && styles.liveDotActive]
@@ -358,7 +349,7 @@ const Leaderboard = ({
358
349
  style: [styles.liveText, connected && styles.liveTextActive],
359
350
  children: connected ? t('leaderboard.live') : t('leaderboard.updating')
360
351
  })]
361
- })]
352
+ }) : null]
362
353
  })]
363
354
  }), renderPhaseRow(), active?.scoringDescription && /*#__PURE__*/_jsx(Text, {
364
355
  style: styles.scoringDescription,
@@ -378,8 +369,11 @@ const Leaderboard = ({
378
369
  // EXPANSION R7c — position-1 stays exactly as before; when the committed draw has
379
370
  // additional positions, a compact gold-accent second line lists them.
380
371
  const renderWinnerBanner = () => {
381
- const w = active?.winner;
372
+ const w = liveWinner;
382
373
  if (!w) return null;
374
+ const wonText = t(`leaderboard.won.${period}`, {
375
+ name: w.displayName
376
+ });
383
377
  const rankLabel = w.rank === 1 ? '#1' : t('leaderboard.rank', {
384
378
  rank: w.rank
385
379
  });
@@ -398,10 +392,7 @@ const Leaderboard = ({
398
392
  style: [styles.winnerBanner, theme.glassCard, theme.goldShadow],
399
393
  accessible: true,
400
394
  accessibilityLiveRegion: "polite",
401
- accessibilityLabel: `${t('leaderboard.wonThisWeekA11y', {
402
- name: w.displayName,
403
- rank: rankLabel
404
- })}${othersAccessibilityText}`,
395
+ accessibilityLabel: `${wonText} ${rankLabel}.${othersAccessibilityText}`,
405
396
  children: [/*#__PURE__*/_jsxs(View, {
406
397
  style: styles.winnerBannerTop,
407
398
  children: [/*#__PURE__*/_jsx(SvgIcon, {
@@ -412,9 +403,7 @@ const Leaderboard = ({
412
403
  }), /*#__PURE__*/_jsx(Text, {
413
404
  style: styles.winnerName,
414
405
  numberOfLines: 2,
415
- children: t('leaderboard.wonThisWeek', {
416
- name: w.displayName
417
- })
406
+ children: wonText
418
407
  }), w.isDemo && /*#__PURE__*/_jsx(View, {
419
408
  style: styles.demoTag,
420
409
  children: /*#__PURE__*/_jsx(Text, {
@@ -546,14 +535,16 @@ const Leaderboard = ({
546
535
  item
547
536
  }) => {
548
537
  const isMe = item.isCurrentPlayer;
549
- const rankColor = item.rank <= 3 ? COLORS.gold : item.qualified ? COLORS.gold : COLORS.slateLight;
538
+ const qualified = item.qualified && !item.isBot;
539
+ const reserve = item.reserve && !item.isBot;
540
+ const rankColor = item.isBot ? COLORS.slateLight : item.rank <= 3 || qualified ? COLORS.gold : COLORS.slateLight;
550
541
  return /*#__PURE__*/_jsxs(_Fragment, {
551
542
  children: [/*#__PURE__*/_jsxs(View, {
552
- style: [styles.entryRow, theme.glassCard, item.reserve ? styles.reserveRow : null, isMe ? styles.myRow : null],
543
+ style: [styles.entryRow, theme.glassCard, reserve ? styles.reserveRow : null, isMe ? styles.myRow : null],
553
544
  accessible: true,
554
545
  accessibilityLabel: [t('leaderboard.rank', {
555
546
  rank: item.rank
556
- }), item.displayName, isMe ? t('leaderboard.you') : null, item.qualified ? t('leaderboard.finalist') : item.reserve ? t('leaderboard.reserve') : null, formatScore(item.score)].filter(Boolean).join(', '),
547
+ }), item.displayName, isMe ? t('leaderboard.you') : null, item.isBot ? t('leaderboard.bot') : null, qualified ? t('leaderboard.finalist') : reserve ? t('leaderboard.reserve') : null, formatScore(item.score)].filter(Boolean).join(', '),
557
548
  children: [/*#__PURE__*/_jsx(View, {
558
549
  style: [styles.rankBadge, {
559
550
  borderColor: rankColor
@@ -585,11 +576,18 @@ const Leaderboard = ({
585
576
  allowFontScaling: false,
586
577
  children: t('leaderboard.youTag')
587
578
  })
579
+ }), item.isBot && /*#__PURE__*/_jsx(View, {
580
+ style: styles.demoTag,
581
+ children: /*#__PURE__*/_jsx(Text, {
582
+ style: styles.demoTagText,
583
+ allowFontScaling: false,
584
+ children: t('leaderboard.botTag')
585
+ })
588
586
  })]
589
- }), item.qualified && /*#__PURE__*/_jsx(Text, {
587
+ }), qualified && /*#__PURE__*/_jsx(Text, {
590
588
  style: styles.finalistLabel,
591
589
  children: t('leaderboard.finalistTag')
592
- }), !item.qualified && item.reserve && /*#__PURE__*/_jsx(Text, {
590
+ }), !qualified && reserve && /*#__PURE__*/_jsx(Text, {
593
591
  style: styles.reserveLabel,
594
592
  children: t('leaderboard.reserveTag')
595
593
  })]
@@ -597,7 +595,7 @@ const Leaderboard = ({
597
595
  style: styles.scoreText,
598
596
  children: formatScore(item.score)
599
597
  })]
600
- }), qualifyingPositions > 0 && item.rank === qualifyingPositions && /*#__PURE__*/_jsxs(View, {
598
+ }), item.entryId === lastFinalistId && /*#__PURE__*/_jsxs(View, {
601
599
  style: styles.qualLine,
602
600
  children: [/*#__PURE__*/_jsx(View, {
603
601
  style: styles.qualLineDash
@@ -610,7 +608,7 @@ const Leaderboard = ({
610
608
  })]
611
609
  })]
612
610
  });
613
- }, [qualifyingPositions, formatScore]);
611
+ }, [lastFinalistId, formatScore]);
614
612
 
615
613
  // ── Error state (no cached data) ──
616
614
  if (error && !leaderboard) {
@@ -652,10 +650,13 @@ const Leaderboard = ({
652
650
  }) : !active ? /*#__PURE__*/_jsx(Text, {
653
651
  style: styles.emptyText,
654
652
  children: t('leaderboard.noActiveRaffle')
655
- }) : /*#__PURE__*/_jsx(Text, {
653
+ }) : phase === 'upcoming' ? /*#__PURE__*/_jsx(Text, {
654
+ style: styles.emptyText,
655
+ children: t('leaderboard.notOpenYet')
656
+ }) : phase === 'open' ? /*#__PURE__*/_jsx(Text, {
656
657
  style: styles.emptyText,
657
658
  children: t('leaderboard.beTheFirst')
658
- })
659
+ }) : null
659
660
  })
660
661
  }), isMyRankOutside ? /*#__PURE__*/_jsxs(View, {
661
662
  style: styles.myPositionCard,
@@ -664,7 +665,7 @@ const Leaderboard = ({
664
665
  children: t('leaderboard.yourPosition')
665
666
  }), /*#__PURE__*/_jsx(Text, {
666
667
  style: styles.myPositionText,
667
- children: t('leaderboard.youreRanked', {
668
+ children: t(phase === 'open' ? 'leaderboard.youreRanked' : 'leaderboard.youreRankedLocked', {
668
669
  rank: myRank,
669
670
  score: formatScore(myPosition?.score)
670
671
  })
@@ -677,25 +678,27 @@ const Leaderboard = ({
677
678
  rank: myRank
678
679
  })
679
680
  })
680
- }) : /*#__PURE__*/_jsx(View, {
681
+ }) : phase === 'open' && myPosition && myPosition.rank == null ? /*#__PURE__*/_jsx(View, {
681
682
  style: styles.myPositionCardSubtle,
682
683
  children: /*#__PURE__*/_jsx(Text, {
683
684
  style: styles.myPositionSubtleText,
684
685
  children: t('leaderboard.playToEnter')
685
686
  })
687
+ }) : /*#__PURE__*/_jsx(View, {
688
+ style: styles.bottomReserve
686
689
  }), renderNotificationsModal()]
687
690
  });
688
691
  };
689
692
 
690
693
  // ─── Styles ───────────────────────────────────────────────────────────────────
691
694
 
692
- const styles = StyleSheet.create({
695
+ const styles = scaledStyles({
693
696
  // Header
694
697
  header: {
695
698
  paddingHorizontal: 16,
696
699
  paddingTop: 52,
697
700
  paddingBottom: 14,
698
- backgroundColor: 'rgba(5,11,24,0.92)',
701
+ backgroundColor: 'rgba(12, 11, 18, 0.92)',
699
702
  borderBottomWidth: 1,
700
703
  borderBottomColor: COLORS.white10
701
704
  },
@@ -801,7 +804,9 @@ const styles = StyleSheet.create({
801
804
  flexDirection: 'row',
802
805
  alignItems: 'center',
803
806
  justifyContent: 'center',
807
+ flexWrap: 'wrap',
804
808
  gap: 10,
809
+ rowGap: 2,
805
810
  paddingVertical: 7,
806
811
  backgroundColor: COLORS.white05,
807
812
  borderRadius: 10,
@@ -822,8 +827,8 @@ const styles = StyleSheet.create({
822
827
  },
823
828
  // Phase row — locked / drawing / announced (post-qualification, gold accent)
824
829
  phaseRowGold: {
825
- backgroundColor: 'rgba(255,215,0,0.08)',
826
- borderColor: 'rgba(255,215,0,0.35)'
830
+ backgroundColor: 'rgba(255, 199, 48, 0.08)',
831
+ borderColor: 'rgba(255, 199, 48, 0.35)'
827
832
  },
828
833
  phaseLabelGold: {
829
834
  fontSize: 9,
@@ -864,7 +869,7 @@ const styles = StyleSheet.create({
864
869
  },
865
870
  myRow: {
866
871
  borderColor: COLORS.primary,
867
- backgroundColor: 'rgba(127,19,236,0.12)',
872
+ backgroundColor: 'rgba(255, 199, 48, 0.12)',
868
873
  shadowColor: COLORS.primary,
869
874
  shadowOffset: {
870
875
  width: 0,
@@ -891,14 +896,14 @@ const styles = StyleSheet.create({
891
896
  width: 36,
892
897
  height: 36,
893
898
  borderRadius: 18,
894
- backgroundColor: 'rgba(127,19,236,0.15)',
899
+ backgroundColor: 'rgba(255, 199, 48, 0.15)',
895
900
  borderWidth: 1,
896
- borderColor: 'rgba(127,19,236,0.3)',
901
+ borderColor: 'rgba(255, 199, 48, 0.3)',
897
902
  alignItems: 'center',
898
903
  justifyContent: 'center'
899
904
  },
900
905
  myAvatar: {
901
- backgroundColor: 'rgba(127,19,236,0.35)',
906
+ backgroundColor: 'rgba(255, 199, 48, 0.35)',
902
907
  borderColor: COLORS.primary
903
908
  },
904
909
  avatarText: {
@@ -930,7 +935,7 @@ const styles = StyleSheet.create({
930
935
  youTagText: {
931
936
  fontSize: 8,
932
937
  fontWeight: '900',
933
- color: '#fff',
938
+ color: '#331B00',
934
939
  letterSpacing: 1
935
940
  },
936
941
  finalistLabel: {
@@ -1043,7 +1048,7 @@ const styles = StyleSheet.create({
1043
1048
  marginTop: 2
1044
1049
  },
1045
1050
  demoTag: {
1046
- backgroundColor: COLORS.slateDark,
1051
+ backgroundColor: COLORS.slateDarker,
1047
1052
  borderRadius: 4,
1048
1053
  paddingHorizontal: 5,
1049
1054
  paddingVertical: 2
@@ -1061,7 +1066,7 @@ const styles = StyleSheet.create({
1061
1066
  marginBottom: 2,
1062
1067
  paddingVertical: 9,
1063
1068
  paddingHorizontal: 14,
1064
- borderColor: 'rgba(255,215,0,0.35)',
1069
+ borderColor: 'rgba(255, 199, 48, 0.35)',
1065
1070
  borderWidth: 1
1066
1071
  },
1067
1072
  lastWinnerText: {
@@ -1077,9 +1082,10 @@ const styles = StyleSheet.create({
1077
1082
  // MY POSITION banner — prominent (outside top)
1078
1083
  myPositionCard: {
1079
1084
  margin: 12,
1080
- backgroundColor: 'rgba(127,19,236,0.15)',
1085
+ marginBottom: 28,
1086
+ backgroundColor: 'rgba(255, 199, 48, 0.15)',
1081
1087
  borderWidth: 1,
1082
- borderColor: 'rgba(127,19,236,0.45)',
1088
+ borderColor: 'rgba(255, 199, 48, 0.45)',
1083
1089
  borderRadius: 14,
1084
1090
  padding: 14,
1085
1091
  alignItems: 'center',
@@ -1100,7 +1106,7 @@ const styles = StyleSheet.create({
1100
1106
  // MY POSITION banner — subtle (in-list or not-yet-ranked)
1101
1107
  myPositionCardSubtle: {
1102
1108
  marginHorizontal: 12,
1103
- marginBottom: 12,
1109
+ marginBottom: 28,
1104
1110
  backgroundColor: COLORS.white05,
1105
1111
  borderWidth: 1,
1106
1112
  borderColor: COLORS.white10,
@@ -1112,6 +1118,9 @@ const styles = StyleSheet.create({
1112
1118
  fontSize: 12,
1113
1119
  color: COLORS.slateLight
1114
1120
  },
1121
+ bottomReserve: {
1122
+ height: 28
1123
+ },
1115
1124
  // SR-only (screen reader announce text, visually hidden)
1116
1125
  srOnly: {
1117
1126
  position: 'absolute',
@@ -1129,7 +1138,7 @@ const styles = StyleSheet.create({
1129
1138
  notifSheet: {
1130
1139
  maxHeight: '75%',
1131
1140
  borderRadius: 18,
1132
- backgroundColor: '#0d1226',
1141
+ backgroundColor: '#17161F',
1133
1142
  borderWidth: 1,
1134
1143
  borderColor: COLORS.white10,
1135
1144
  overflow: 'hidden'
@@ -1176,7 +1185,7 @@ const styles = StyleSheet.create({
1176
1185
  },
1177
1186
  notifRowUnread: {
1178
1187
  borderLeftColor: COLORS.gold,
1179
- backgroundColor: 'rgba(255,215,0,0.06)'
1188
+ backgroundColor: 'rgba(255, 199, 48, 0.06)'
1180
1189
  },
1181
1190
  notifItemTitle: {
1182
1191
  fontSize: 13,