|
1 | 1 | import { storage } from 'common/storage'; |
2 | 2 | import { capitalize } from 'common/string'; |
| 3 | +import { Fragment } from 'inferno'; |
3 | 4 | import { useBackend, useLocalState } from '../backend'; |
4 | 5 | import { Button, Section, Table, Tabs, Box, TextArea, Stack, Tooltip, Flex } from '../components'; |
5 | 6 | import { Window } from '../layouts'; |
6 | 7 | import { resolveAsset } from './../assets'; |
7 | 8 |
|
8 | | -// Store data for cones and scoops within Data |
| 9 | +// Store data for UI elements within Data |
9 | 10 | type Data = { |
10 | 11 | tabs: Tab[]; |
11 | 12 | } |
@@ -39,6 +40,7 @@ type MixerDrinkStats = { |
39 | 40 | drink_type_path: string; |
40 | 41 | } |
41 | 42 |
|
| 43 | +// Stats for all storage information |
42 | 44 | type StorageStats = { |
43 | 45 | contents_length: number; |
44 | 46 | storage_capacity: number; |
@@ -328,7 +330,7 @@ const DrinkTransferRow = (props, context) => { |
328 | 330 | content={amount} |
329 | 331 | textAlign="center" |
330 | 332 | selected={amount === dispence_selected} |
331 | | - onClick={() => act("amount", { |
| 333 | + onClick={() => act("transferNum", { |
332 | 334 | dispenceAmount: amount, |
333 | 335 | })}/> |
334 | 336 | </Flex.Item> |
@@ -375,7 +377,7 @@ const MainDrinkRow = (props, context) => { |
375 | 377 | content="Purge" |
376 | 378 | textAlign="center" |
377 | 379 | fontSize="16px" |
378 | | - // Dissable if there is none of the reagent in storage |
| 380 | + // Disable if there is none of the reagent in storage |
379 | 381 | disabled={( |
380 | 382 | reagent.drink_quantity === 0 |
381 | 383 | )} |
@@ -430,56 +432,54 @@ const MixerDrinkRow = (props, context) => { |
430 | 432 | if(mixerDrinks.length > 0) { |
431 | 433 | return ( |
432 | 434 | // Create Table for horizontal format |
433 | | - <Table> |
| 435 | + <Table |
| 436 | + direction="column"> |
434 | 437 | {/* Use map to create dynamic rows based on the contents of drinks, with drink being the individual item and its stats */} |
435 | 438 | {mixerDrinks.map(reagent => ( |
436 | 439 | // Start row for holding ui elements and given data |
437 | 440 | <Table.Row |
| 441 | + direction="row" |
438 | 442 | key={reagent.drink_name} |
439 | 443 | fontSize="14px"> |
440 | | - <Table.Cell |
441 | | - bold> |
442 | | - {/* Get name */} |
443 | | - {capitalize(reagent.drink_name)} |
444 | | - </Table.Cell> |
445 | | - <Table.Cell |
446 | | - textAlign="right"> |
447 | | - {/* Get amount of reagent in storage */} |
448 | | - {reagent.drink_quantity}u |
449 | | - </Table.Cell> |
450 | | - <Table.Cell> |
451 | | - {/* Make dispense button */} |
452 | | - <Button |
453 | | - fluid |
454 | | - content="Transfer Back" |
455 | | - textAlign="center" |
456 | | - fontSize="16px" |
457 | | - // Dissable if there is none of the reagent in storage |
458 | | - disabled={( |
459 | | - reagent.drink_quantity === 0 |
460 | | - )} |
461 | | - onClick={() => act("transferBack", { |
462 | | - itemPath: reagent.drink_type_path, |
463 | | - })} |
464 | | - /> |
465 | | - </Table.Cell> |
466 | | - <Table.Cell> |
467 | | - <Button |
468 | | - fluid |
469 | | - content="Pour in glass" |
470 | | - textAlign="center" |
471 | | - fontSize="16px" |
472 | | - // Dissable if there is none of the reagent in storage |
473 | | - disabled={( |
474 | | - reagent.drink_quantity === 0 |
475 | | - )} |
476 | | - onClick={() => act("pour", { |
477 | | - itemPath: reagent.drink_type_path, |
478 | | - })} |
479 | | - /> |
480 | | - </Table.Cell> |
| 444 | + <Table.Cell |
| 445 | + bold> |
| 446 | + {/* Get name */} |
| 447 | + {capitalize(reagent.drink_name)} |
| 448 | + </Table.Cell> |
| 449 | + <Table.Cell |
| 450 | + textAlign="left"> |
| 451 | + {/* Get amount of reagent in storage */} |
| 452 | + {reagent.drink_quantity}u |
| 453 | + </Table.Cell> |
| 454 | + <Table.Cell> |
| 455 | + {/* Make dispense button */} |
| 456 | + <Button |
| 457 | + fluid |
| 458 | + content="Transfer Back" |
| 459 | + textAlign="center" |
| 460 | + fontSize="16px" |
| 461 | + width="175px" |
| 462 | + // Disable if there is none of the reagent in storage |
| 463 | + disabled={( |
| 464 | + reagent.drink_quantity === 0 |
| 465 | + )} |
| 466 | + onClick={() => act("transferBack", { |
| 467 | + itemPath: reagent.drink_type_path, |
| 468 | + })} |
| 469 | + /> |
| 470 | + </Table.Cell> |
481 | 471 | </Table.Row> |
482 | | - ))} |
| 472 | + ))} |
| 473 | + <Table.Row |
| 474 | + align="center"> |
| 475 | + <Button |
| 476 | + fluid |
| 477 | + content="Pour glass" |
| 478 | + textAlign="center" |
| 479 | + fontSize="16px" |
| 480 | + onClick={() => act("pour")} |
| 481 | + /> |
| 482 | + </Table.Row> |
483 | 483 | </Table> |
484 | 484 | ); |
485 | 485 | } else { |
|
0 commit comments