@jeremyckahn/farmhand 1.23.2 → 1.23.4

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 (169) hide show
  1. package/README.md +5 -0
  2. package/dist/assets/index-4ynbl-GC.js +392 -0
  3. package/dist/assets/index-4ynbl-GC.js.map +1 -0
  4. package/dist/assets/index-CaYdR-lC.css +1 -0
  5. package/dist/assets/jersey-10-latin-400-normal-DrL73VYW.woff2 +0 -0
  6. package/dist/assets/jersey-10-latin-ext-400-normal-uIKqQSaG.woff2 +0 -0
  7. package/dist/assets/jersey-20-latin-400-normal-bNi78tgO.woff2 +0 -0
  8. package/dist/assets/jersey-20-latin-ext-400-normal-BO3lmWef.woff2 +0 -0
  9. package/dist/assets/jersey-25-latin-400-normal-BuYJnnt7.woff2 +0 -0
  10. package/dist/assets/jersey-25-latin-ext-400-normal-CP5Jl3WN.woff2 +0 -0
  11. package/dist/index.html +2 -2
  12. package/dist/service-worker.js +1 -1
  13. package/dist/service-worker.js.map +1 -1
  14. package/package.json +7 -12
  15. package/src/common/services/randomNumber.test.ts +61 -1
  16. package/src/common/services/randomNumber.ts +36 -1
  17. package/src/common/utils.ts +22 -13
  18. package/src/components/AccountingView/AccountingView.tsx +7 -13
  19. package/src/components/Achievement/Achievement.tsx +2 -15
  20. package/src/components/AchievementsView/AchievementsView.tsx +2 -7
  21. package/src/components/AnimatedNumber/AnimatedNumber.tsx +0 -6
  22. package/src/components/AppBar/AppBar.tsx +21 -17
  23. package/src/components/Cellar/Cellar.tsx +0 -2
  24. package/src/components/Cellar/CellarInventoryTabPanel.tsx +0 -6
  25. package/src/components/Cellar/FermentationTabPanel.tsx +0 -6
  26. package/src/components/Cellar/Keg.tsx +0 -5
  27. package/src/components/Cellar/TabPanel/index.tsx +0 -7
  28. package/src/components/Cellar/WinemakingTabPanel.tsx +0 -6
  29. package/src/components/ContextPane/ContextPane.tsx +0 -6
  30. package/src/components/CowCard/Bloodline/Bloodline.tsx +0 -6
  31. package/src/components/CowCard/CowCard.tsx +7 -39
  32. package/src/components/CowCard/Subheader/Subheader.tsx +21 -44
  33. package/src/components/CowPen/Cow.tsx +5 -11
  34. package/src/components/CowPen/CowPen.test.tsx +4 -4
  35. package/src/components/CowPen/CowPen.tsx +5 -16
  36. package/src/components/CowPenContextMenu/CowPenContextMenu.tsx +2 -18
  37. package/src/components/CowPenContextMenu/TabPanel/index.tsx +0 -7
  38. package/src/components/Farmhand/Farmhand.context.tsx +4 -3
  39. package/src/components/Farmhand/Farmhand.tsx +11 -15
  40. package/src/components/Farmhand/FarmhandReducers.tsx +1 -2
  41. package/src/components/Farmhand/FarmhandService.test.ts +6 -9
  42. package/src/components/Farmhand/hooks/useFarmhandDayAdvancement.ts +2 -6
  43. package/src/components/Farmhand/hooks/useFarmhandNetwork.test.ts +2 -2
  44. package/src/components/Farmhand/hooks/useFarmhandNetwork.ts +15 -31
  45. package/src/components/Farmhand/useFarmhand.test.ts +7 -5
  46. package/src/components/Farmhand/useFarmhand.ts +24 -15
  47. package/src/components/FermentationRecipeList/FermentationRecipe.tsx +0 -5
  48. package/src/components/FermentationRecipeList/FermentationRecipeList.test.tsx +10 -11
  49. package/src/components/FermentationRecipeList/FermentationRecipeList.tsx +2 -3
  50. package/src/components/Field/Field.tsx +15 -50
  51. package/src/components/Forest/Forest.tsx +10 -7
  52. package/src/components/ForestPlot/ForestPlot.tsx +5 -5
  53. package/src/components/ForestQuickSelect/ForestQuickSelect.tsx +0 -12
  54. package/src/components/Home/Home.tsx +2 -7
  55. package/src/components/Home/SnowBackground.tsx +1 -1
  56. package/src/components/IngredientsList/IngredientsList.tsx +0 -7
  57. package/src/components/Inventory/Inventory.test.tsx +4 -4
  58. package/src/components/Inventory/Inventory.tsx +5 -12
  59. package/src/components/Item/Item.tsx +11 -29
  60. package/src/components/ItemList/ItemList.tsx +4 -11
  61. package/src/components/KeybindingsView/KeybindingsView.tsx +0 -2
  62. package/src/components/LogView/LogView.tsx +6 -28
  63. package/src/components/Navigation/DayAndProgressContainer.tsx +0 -8
  64. package/src/components/Navigation/Navigation.tsx +12 -33
  65. package/src/components/NotificationSystem/NotificationSystem.test.tsx +45 -3
  66. package/src/components/NotificationSystem/NotificationSystem.tsx +45 -32
  67. package/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.test.tsx +2 -2
  68. package/src/components/OnlinePeersView/OnlinePeer/OnlinePeer.tsx +0 -11
  69. package/src/components/OnlinePeersView/OnlinePeersView.tsx +0 -10
  70. package/src/components/PixelIcon/createPixelIcon.test.tsx +59 -0
  71. package/src/components/PixelIcon/createPixelIcon.tsx +97 -0
  72. package/src/components/PixelIcon/icons.ts +445 -0
  73. package/src/components/PixelIcon/index.ts +3 -0
  74. package/src/components/Plot/Plot.tsx +3 -3
  75. package/src/components/PriceEventView/PriceEventView.tsx +0 -6
  76. package/src/components/ProgressBar/ProgressBar.tsx +9 -8
  77. package/src/components/QuantityInput/QuantityInput.tsx +6 -11
  78. package/src/components/QuickSelect/QuickSelect.tsx +0 -10
  79. package/src/components/Recipe/Recipe.tsx +0 -9
  80. package/src/components/RecipeList/RecipeList.tsx +0 -6
  81. package/src/components/SearchBar/SearchBar.tsx +4 -10
  82. package/src/components/SettingsView/RandomSeedInput.test.tsx +2 -4
  83. package/src/components/SettingsView/RandomSeedInput.tsx +5 -8
  84. package/src/components/SettingsView/SettingsView.test.tsx +21 -0
  85. package/src/components/SettingsView/SettingsView.tsx +24 -18
  86. package/src/components/Shop/Shop.tsx +0 -20
  87. package/src/components/Shop/TabPanel/index.tsx +0 -7
  88. package/src/components/Stage/Stage.tsx +11 -20
  89. package/src/components/StatsView/StatsView.tsx +0 -18
  90. package/src/components/TierPurchase/TierPurchase.tsx +0 -12
  91. package/src/components/Toolbelt/Toolbelt.tsx +5 -10
  92. package/src/components/UpdateNotifier/UpdateNotifier.tsx +33 -5
  93. package/src/components/UpgradePurchase/UpgradePurchase.tsx +0 -10
  94. package/src/components/WineRecipeList/WineRecipe.test.tsx +2 -2
  95. package/src/components/WineRecipeList/WineRecipe.tsx +0 -5
  96. package/src/components/WineRecipeList/WineRecipeList.tsx +2 -3
  97. package/src/components/Workshop/ForgeTabPanel.tsx +0 -8
  98. package/src/components/Workshop/KitchenTabPanel.tsx +0 -7
  99. package/src/components/Workshop/RecyclingTabPanel.tsx +0 -7
  100. package/src/components/Workshop/TabPanel/index.tsx +0 -7
  101. package/src/components/Workshop/WoodChipperTabPanel.tsx +0 -7
  102. package/src/components/Workshop/Workshop.tsx +0 -9
  103. package/src/components/Workshop/getUpgradesAvailable.ts +1 -1
  104. package/src/constants.ts +18 -13
  105. package/src/data/crops/grape.ts +13 -15
  106. package/src/data/maps.test.ts +3 -4
  107. package/src/data/maps.ts +27 -29
  108. package/src/enums.ts +47 -19
  109. package/src/factories/OreFactory.ts +2 -1
  110. package/src/farmhand.d.ts +6 -3
  111. package/src/game-logic/reducers/applyPrecipitation.ts +4 -4
  112. package/src/game-logic/reducers/generatePriceEvents.ts +6 -3
  113. package/src/game-logic/reducers/harvestForestPlot.ts +1 -2
  114. package/src/game-logic/reducers/makeFermentationRecipe.ts +2 -3
  115. package/src/game-logic/reducers/minePlot.test.ts +2 -2
  116. package/src/game-logic/reducers/minePlot.ts +1 -1
  117. package/src/game-logic/reducers/processCowFertilizerProduction.test.ts +16 -14
  118. package/src/game-logic/reducers/processFeedingCows.test.ts +2 -5
  119. package/src/game-logic/reducers/purchaseCow.ts +2 -7
  120. package/src/game-logic/reducers/showNotification.test.ts +20 -0
  121. package/src/game-logic/reducers/showNotification.ts +4 -2
  122. package/src/game-logic/reducers/updateAchievements.ts +1 -1
  123. package/src/game-logic/reducers/updateFinancialRecords.test.ts +21 -25
  124. package/src/game-logic/reducers/updateFinancialRecords.ts +2 -5
  125. package/src/game-logic/reducers/updateInventoryRecordsForNextDay.test.ts +12 -14
  126. package/src/handlers/ui-events.test.ts +44 -42
  127. package/src/handlers/ui-events.tsx +18 -3
  128. package/src/hooks/usePrefersReducedMotion.ts +10 -6
  129. package/src/index.tsx +0 -2
  130. package/src/mui-theme.ts +258 -37
  131. package/src/scripts/generate-crop-table.ts +3 -2
  132. package/src/setupTests.ts +18 -12
  133. package/src/strings.ts +1 -1
  134. package/src/styles/fonts.ts +73 -0
  135. package/src/styles/pixel.ts +151 -0
  136. package/src/styles/sx.ts +46 -33
  137. package/src/styles/tokens.ts +11 -0
  138. package/src/test-utils/index.ts +1 -0
  139. package/src/utils/chooseRandom.ts +4 -1
  140. package/src/utils/chooseRandomIndex.ts +6 -2
  141. package/src/utils/getCowImage.ts +22 -27
  142. package/src/utils/getMaxYieldOfFermentationRecipe.ts +2 -2
  143. package/src/utils/getPeerMetadata.ts +1 -1
  144. package/src/utils/getPlotImage.test.ts +14 -14
  145. package/src/utils/getPlotImage.ts +10 -10
  146. package/src/utils/getRandomUnlockedCrop.ts +5 -3
  147. package/src/utils/getRandomizedLifespan.test.ts +2 -8
  148. package/src/utils/getValueAdjustmentStream.test.ts +9 -0
  149. package/src/utils/getValueAdjustmentStream.ts +5 -0
  150. package/src/utils/isItemAFarmProduct.ts +2 -2
  151. package/src/utils/shouldPrecipitateToday.ts +3 -1
  152. package/src/utils/shouldStormToday.ts +2 -1
  153. package/src/utils/transformStateDataForImport.ts +3 -5
  154. package/dist/assets/francois-one-latin-400-normal-DD1rFI7H.woff2 +0 -0
  155. package/dist/assets/francois-one-latin-400-normal-DNXs7uOx.woff +0 -0
  156. package/dist/assets/francois-one-latin-ext-400-normal-CwRdWRZD.woff2 +0 -0
  157. package/dist/assets/francois-one-latin-ext-400-normal-JvkpT0Av.woff +0 -0
  158. package/dist/assets/francois-one-vietnamese-400-normal-BLIKeG5Y.woff2 +0 -0
  159. package/dist/assets/francois-one-vietnamese-400-normal-CuWeHlXs.woff +0 -0
  160. package/dist/assets/index-CNcrTYN-.css +0 -1
  161. package/dist/assets/index-DNPchtK9.js +0 -844
  162. package/dist/assets/index-DNPchtK9.js.map +0 -1
  163. package/dist/assets/public-sans-latin-400-normal-8Rpg0ruU.woff2 +0 -0
  164. package/dist/assets/public-sans-latin-400-normal-SBbinRkI.woff +0 -0
  165. package/dist/assets/public-sans-latin-ext-400-normal-B02wwOdZ.woff +0 -0
  166. package/dist/assets/public-sans-latin-ext-400-normal-mk90oQqJ.woff2 +0 -0
  167. package/dist/assets/public-sans-vietnamese-400-normal-BO1meqcx.woff +0 -0
  168. package/dist/assets/public-sans-vietnamese-400-normal-TxZB8OSn.woff2 +0 -0
  169. package/src/fontsource.d.ts +0 -3
@@ -10,7 +10,8 @@ export const showNotification = (
10
10
  state: farmhand.state,
11
11
  message: string,
12
12
  severity: notificationSeverity = 'info',
13
- onClick: import('@mui/material/Alert').AlertProps['onClick'] = undefined
13
+ onClick: farmhand.notification['onClick'] = undefined,
14
+ actionLabel: farmhand.notification['actionLabel'] = undefined
14
15
  ): farmhand.state => {
15
16
  const { showNotifications, todaysNotifications } = state
16
17
 
@@ -20,6 +21,7 @@ export const showNotification = (
20
21
  latestNotification: {
21
22
  message,
22
23
  onClick,
24
+ actionLabel,
23
25
  severity,
24
26
  },
25
27
  }),
@@ -28,6 +30,6 @@ export const showNotification = (
28
30
  notification => notification.message === message
29
31
  )
30
32
  ? todaysNotifications
31
- : todaysNotifications.concat({ message, onClick, severity }),
33
+ : todaysNotifications.concat({ message, onClick, actionLabel, severity }),
32
34
  }
33
35
  }
@@ -10,7 +10,7 @@ export const updateAchievements = (
10
10
  achievements.reduce(
11
11
  (
12
12
  reducerState: farmhand.state,
13
- achievement: Omit<typeof achievements[number], 'condition'> & {
13
+ achievement: Omit<(typeof achievements)[number], 'condition'> & {
14
14
  condition: (s: farmhand.state, ps: farmhand.state) => boolean
15
15
  }
16
16
  ) => {
@@ -37,17 +37,15 @@ describe('updateFinancialRecords', () => {
37
37
  })
38
38
 
39
39
  test('truncates logs', () => {
40
- const {
41
- historicalDailyLosses,
42
- historicalDailyRevenue,
43
- } = updateFinancialRecords(
44
- testState({
45
- historicalDailyLosses: [-1, -2, -3, -4, -5, -6, -7],
46
- historicalDailyRevenue: [1, 2, 3, 4, 5, 6, 7],
47
- todaysLosses: -5,
48
- todaysRevenue: 10,
49
- })
50
- )
40
+ const { historicalDailyLosses, historicalDailyRevenue } =
41
+ updateFinancialRecords(
42
+ testState({
43
+ historicalDailyLosses: [-1, -2, -3, -4, -5, -6, -7],
44
+ historicalDailyRevenue: [1, 2, 3, 4, 5, 6, 7],
45
+ todaysLosses: -5,
46
+ todaysRevenue: 10,
47
+ })
48
+ )
51
49
 
52
50
  expect(historicalDailyLosses).toEqual([-5, -1, -2, -3, -4, -5, -6])
53
51
  expect(historicalDailyRevenue).toEqual([10, 1, 2, 3, 4, 5, 6])
@@ -55,20 +53,18 @@ describe('updateFinancialRecords', () => {
55
53
 
56
54
  describe('profitabilityStreak', () => {
57
55
  test('unprofitable day resets streak', () => {
58
- const {
59
- profitabilityStreak,
60
- recordProfitabilityStreak,
61
- } = updateFinancialRecords(
62
- testState({
63
- historicalDailyLosses: [],
64
- historicalDailyRevenue: [],
65
- profitabilityStreak: 10,
66
- record7dayProfitAverage: 0,
67
- recordProfitabilityStreak: 10,
68
- todaysLosses: -10,
69
- todaysRevenue: 10,
70
- })
71
- )
56
+ const { profitabilityStreak, recordProfitabilityStreak } =
57
+ updateFinancialRecords(
58
+ testState({
59
+ historicalDailyLosses: [],
60
+ historicalDailyRevenue: [],
61
+ profitabilityStreak: 10,
62
+ record7dayProfitAverage: 0,
63
+ recordProfitabilityStreak: 10,
64
+ todaysLosses: -10,
65
+ todaysRevenue: 10,
66
+ })
67
+ )
72
68
 
73
69
  expect(profitabilityStreak).toEqual(0)
74
70
  expect(recordProfitabilityStreak).toEqual(10)
@@ -13,11 +13,8 @@ export const updateFinancialRecords = (
13
13
  record7dayProfitAverage,
14
14
  recordProfitabilityStreak,
15
15
  } = state
16
- let {
17
- historicalDailyLosses,
18
- historicalDailyRevenue,
19
- recordSingleDayProfit,
20
- } = state
16
+ let { historicalDailyLosses, historicalDailyRevenue, recordSingleDayProfit } =
17
+ state
21
18
 
22
19
  historicalDailyLosses = [todaysLosses, ...historicalDailyLosses].slice(
23
20
  0,
@@ -4,20 +4,18 @@ import { updateInventoryRecordsForNextDay } from './updateInventoryRecordsForNex
4
4
 
5
5
  describe('updateInventoryRecordsForNextDay', () => {
6
6
  test('records inventory records for next day', () => {
7
- const {
8
- todaysPurchases,
9
- todaysStartingInventory,
10
- } = updateInventoryRecordsForNextDay(
11
- testState({
12
- inventory: [
13
- { id: 'sample-item-1', quantity: 2 },
14
- { id: 'sample-item-2', quantity: 5 },
15
- ],
16
- todaysPurchases: {
17
- 'sample-item-3': 3,
18
- },
19
- })
20
- )
7
+ const { todaysPurchases, todaysStartingInventory } =
8
+ updateInventoryRecordsForNextDay(
9
+ testState({
10
+ inventory: [
11
+ { id: 'sample-item-1', quantity: 2 },
12
+ { id: 'sample-item-2', quantity: 5 },
13
+ ],
14
+ todaysPurchases: {
15
+ 'sample-item-3': 3,
16
+ },
17
+ })
18
+ )
21
19
 
22
20
  expect(todaysPurchases).toEqual({})
23
21
  expect(todaysStartingInventory).toEqual({
@@ -48,8 +48,10 @@ describe('UI Event Handlers', () => {
48
48
  isAwaitingCowTradeRequest: false,
49
49
  currentDialogView: dialogView.NONE,
50
50
  showHomeScreen: true,
51
+ notificationDuration: 6000,
51
52
  },
52
53
  setState: vi.fn(),
54
+ props: { localforage: { setItem: vi.fn().mockResolvedValue(undefined) } },
53
55
  purchaseItem: vi.fn(),
54
56
  makeRecipe: vi.fn(),
55
57
  makeFermentationRecipe: vi.fn(),
@@ -152,9 +154,8 @@ describe('UI Event Handlers', () => {
152
154
 
153
155
  describe('handleViewChangeButtonClick', () => {
154
156
  test('navigates to selected view', () => {
155
- const handler = uiEventHandlers.handleViewChangeButtonClick.bind(
156
- mockContext
157
- )
157
+ const handler =
158
+ uiEventHandlers.handleViewChangeButtonClick.bind(mockContext)
158
159
 
159
160
  handler(stageFocusType.SHOP)
160
161
 
@@ -172,7 +173,7 @@ describe('UI Event Handlers', () => {
172
173
  enablesFieldMode: fieldMode.PLANT,
173
174
  })
174
175
 
175
- handler((mockItem as unknown) as Parameters<typeof handler>[0])
176
+ handler(mockItem as unknown as Parameters<typeof handler>[0])
176
177
 
177
178
  expect(mockContext.setState).toHaveBeenCalledWith({
178
179
  fieldMode: fieldMode.PLANT,
@@ -183,12 +184,11 @@ describe('UI Event Handlers', () => {
183
184
 
184
185
  describe('handleForestItemSelectClick', () => {
185
186
  test('selects the sapling and switches to PLANT mode', () => {
186
- const handler = uiEventHandlers.handleForestItemSelectClick.bind(
187
- mockContext
188
- )
187
+ const handler =
188
+ uiEventHandlers.handleForestItemSelectClick.bind(mockContext)
189
189
  const mockItem = testItem({ id: 'test-sapling' })
190
190
 
191
- handler((mockItem as unknown) as Parameters<typeof handler>[0])
191
+ handler(mockItem as unknown as Parameters<typeof handler>[0])
192
192
 
193
193
  // Regression: selecting a sapling must back out of whatever field
194
194
  // mode (e.g. CHOP, FERTILIZE) was previously active, or clicking an
@@ -219,7 +219,7 @@ describe('UI Event Handlers', () => {
219
219
  test('opens menu when explicitly requested', () => {
220
220
  const handler = uiEventHandlers.handleMenuToggle.bind(mockContext)
221
221
 
222
- handler((true as unknown) as Parameters<typeof handler>[0])
222
+ handler(true as unknown as Parameters<typeof handler>[0])
223
223
 
224
224
  const stateUpdater = mockContext.setState.mock.calls[0][0]
225
225
  const newState = stateUpdater({ isMenuOpen: false })
@@ -305,9 +305,8 @@ describe('UI Event Handlers', () => {
305
305
 
306
306
  describe('handleClickDialogViewButton', () => {
307
307
  test('displays requested dialog screen', () => {
308
- const handler = uiEventHandlers.handleClickDialogViewButton.bind(
309
- mockContext
310
- )
308
+ const handler =
309
+ uiEventHandlers.handleClickDialogViewButton.bind(mockContext)
311
310
 
312
311
  handler(dialogView.FARMERS_LOG)
313
312
 
@@ -350,9 +349,8 @@ describe('UI Event Handlers', () => {
350
349
 
351
350
  describe('handleFieldActionRangeChange', () => {
352
351
  test('adjusts tool range preview size', () => {
353
- const handler = uiEventHandlers.handleFieldActionRangeChange.bind(
354
- mockContext
355
- )
352
+ const handler =
353
+ uiEventHandlers.handleFieldActionRangeChange.bind(mockContext)
356
354
 
357
355
  handler(3)
358
356
 
@@ -413,9 +411,8 @@ describe('UI Event Handlers', () => {
413
411
 
414
412
  describe('handleShowHomeScreenChange', () => {
415
413
  test('enables home screen display', () => {
416
- const handler = uiEventHandlers.handleShowHomeScreenChange.bind(
417
- mockContext
418
- )
414
+ const handler =
415
+ uiEventHandlers.handleShowHomeScreenChange.bind(mockContext)
419
416
 
420
417
  handler(null, true)
421
418
 
@@ -426,9 +423,8 @@ describe('UI Event Handlers', () => {
426
423
 
427
424
  test('navigates away from home when disabling home screen while viewing it', () => {
428
425
  mockContext.state.stageFocus = stageFocusType.HOME
429
- const handler = uiEventHandlers.handleShowHomeScreenChange.bind(
430
- mockContext
431
- )
426
+ const handler =
427
+ uiEventHandlers.handleShowHomeScreenChange.bind(mockContext)
432
428
 
433
429
  handler(null, false)
434
430
 
@@ -439,6 +435,19 @@ describe('UI Event Handlers', () => {
439
435
  })
440
436
  })
441
437
 
438
+ describe('notification duration handlers', () => {
439
+ test('updates notification duration in milliseconds from slider seconds', () => {
440
+ const handler =
441
+ uiEventHandlers.handleNotificationDurationChange.bind(mockContext)
442
+
443
+ handler(new Event('change'), 8)
444
+
445
+ expect(mockContext.setState).toHaveBeenCalledWith({
446
+ notificationDuration: 8000,
447
+ })
448
+ })
449
+ })
450
+
442
451
  describe('handleRNGSeedChange', () => {
443
452
  test('applies custom random seed for reproducible gameplay', () => {
444
453
  const handler = uiEventHandlers.handleRNGSeedChange.bind(mockContext)
@@ -465,9 +474,8 @@ describe('UI Event Handlers', () => {
465
474
 
466
475
  describe('navigation handlers', () => {
467
476
  test('moves to next view', () => {
468
- const handler = uiEventHandlers.handleClickNextMenuButton.bind(
469
- mockContext
470
- )
477
+ const handler =
478
+ uiEventHandlers.handleClickNextMenuButton.bind(mockContext)
471
479
 
472
480
  handler()
473
481
 
@@ -475,9 +483,8 @@ describe('UI Event Handlers', () => {
475
483
  })
476
484
 
477
485
  test('moves to previous view', () => {
478
- const handler = uiEventHandlers.handleClickPreviousMenuButton.bind(
479
- mockContext
480
- )
486
+ const handler =
487
+ uiEventHandlers.handleClickPreviousMenuButton.bind(mockContext)
481
488
 
482
489
  handler()
483
490
 
@@ -503,9 +510,8 @@ describe('UI Event Handlers', () => {
503
510
  })
504
511
 
505
512
  test('increases inventory capacity', () => {
506
- const handler = uiEventHandlers.handleStorageExpansionPurchase.bind(
507
- mockContext
508
- )
513
+ const handler =
514
+ uiEventHandlers.handleStorageExpansionPurchase.bind(mockContext)
509
515
 
510
516
  handler()
511
517
 
@@ -515,9 +521,8 @@ describe('UI Event Handlers', () => {
515
521
 
516
522
  describe('loan handlers', () => {
517
523
  test('reduces debt by payment amount', () => {
518
- const handler = uiEventHandlers.handleClickLoanPaydownButton.bind(
519
- mockContext
520
- )
524
+ const handler =
525
+ uiEventHandlers.handleClickLoanPaydownButton.bind(mockContext)
521
526
 
522
527
  handler(500)
523
528
 
@@ -525,9 +530,8 @@ describe('UI Event Handlers', () => {
525
530
  })
526
531
 
527
532
  test('borrows money increasing debt', () => {
528
- const handler = uiEventHandlers.handleClickTakeOutLoanButton.bind(
529
- mockContext
530
- )
533
+ const handler =
534
+ uiEventHandlers.handleClickTakeOutLoanButton.bind(mockContext)
531
535
 
532
536
  handler(1000)
533
537
 
@@ -537,9 +541,8 @@ describe('UI Event Handlers', () => {
537
541
 
538
542
  describe('utility handlers', () => {
539
543
  test('resets all saved game data', () => {
540
- const handler = uiEventHandlers.handleClearPersistedDataClick.bind(
541
- mockContext
542
- )
544
+ const handler =
545
+ uiEventHandlers.handleClearPersistedDataClick.bind(mockContext)
543
546
 
544
547
  handler()
545
548
 
@@ -555,9 +558,8 @@ describe('UI Event Handlers', () => {
555
558
  })
556
559
 
557
560
  test('shows or hides chat window', () => {
558
- const handler = uiEventHandlers.handleChatRoomOpenStateChange.bind(
559
- mockContext
560
- )
561
+ const handler =
562
+ uiEventHandlers.handleChatRoomOpenStateChange.bind(mockContext)
561
563
 
562
564
  handler(true)
563
565
 
@@ -460,6 +460,16 @@ export default {
460
460
  this.setState({ showNotifications: checked })
461
461
  },
462
462
 
463
+ handleNotificationDurationChange(
464
+ this: Farmhand,
465
+ _event: React.SyntheticEvent | Event,
466
+ value: number | number[]
467
+ ) {
468
+ if (typeof value === 'number') {
469
+ this.setState({ notificationDuration: value * 1000 })
470
+ }
471
+ },
472
+
463
473
  handleClickNotificationIndicator(this: Farmhand) {
464
474
  this.openDialogView(dialogView.FARMERS_LOG)
465
475
  },
@@ -531,8 +541,13 @@ export default {
531
541
  this: Farmhand,
532
542
  updateServiceWorker: (reloadPage?: boolean) => Promise<void>
533
543
  ) {
534
- this.showNotification(UPDATE_AVAILABLE, 'success', () => {
535
- updateServiceWorker(true)
536
- })
544
+ this.showNotification(
545
+ UPDATE_AVAILABLE,
546
+ 'success',
547
+ () => {
548
+ updateServiceWorker(true)
549
+ },
550
+ 'Reload'
551
+ )
537
552
  },
538
553
  }
@@ -27,18 +27,22 @@ export const usePrefersReducedMotion = (): boolean => {
27
27
  mediaQueryList.addEventListener('change', listener)
28
28
  } else if ('addListener' in mediaQueryList) {
29
29
  // Compatibility for legacy mediaQueryList implementations
30
- ;((mediaQueryList as unknown) as {
31
- addListener: (cb: (e: MediaQueryListEvent) => void) => void
32
- }).addListener(listener)
30
+ ;(
31
+ mediaQueryList as unknown as {
32
+ addListener: (cb: (e: MediaQueryListEvent) => void) => void
33
+ }
34
+ ).addListener(listener)
33
35
  }
34
36
 
35
37
  return () => {
36
38
  if (mediaQueryList.removeEventListener) {
37
39
  mediaQueryList.removeEventListener('change', listener)
38
40
  } else if ('removeListener' in mediaQueryList) {
39
- ;((mediaQueryList as unknown) as {
40
- removeListener: (cb: (e: MediaQueryListEvent) => void) => void
41
- }).removeListener(listener)
41
+ ;(
42
+ mediaQueryList as unknown as {
43
+ removeListener: (cb: (e: MediaQueryListEvent) => void) => void
44
+ }
45
+ ).removeListener(listener)
42
46
  }
43
47
  }
44
48
  }, [])
package/src/index.tsx CHANGED
@@ -9,8 +9,6 @@ import { HashRouter as Router, Route } from 'react-router-dom'
9
9
 
10
10
  import Farmhand from './components/Farmhand/index.js'
11
11
  import { features } from './config.js'
12
- import '@fontsource/francois-one'
13
- import '@fontsource/public-sans'
14
12
 
15
13
  const FarmhandRoute = (props: any) => <Farmhand {...{ ...props, features }} />
16
14