@@ -8,10 +8,6 @@ import { resolveAsset } from './../assets';
88
99// Store data for UI elements within Data
1010type Data = {
11- tabs : Tab [ ] ;
12- }
13-
14- type Tab = {
1511 food : FoodStats [ ] ;
1612 mainDrinks : MainDrinkStats [ ] ;
1713 mixerDrinks : MixerDrinkStats [ ] ;
@@ -141,7 +137,7 @@ const CapacityRow = (props, context) => {
141137
142138const FoodRow = ( props , context ) => {
143139 // Get data from ui_data in backend code
144- const { act, data } = useBackend < Tab > ( context ) ;
140+ const { act, data } = useBackend < Data > ( context ) ;
145141 // Get food information from data
146142 const { food = [ ] } = data ;
147143
@@ -350,10 +346,10 @@ const DrinkTransferRow = (props, context) => {
350346
351347const MainDrinkRow = ( props , context ) => {
352348 // Get data from ui_data in backend code
353- const { act, data } = useBackend < Tab > ( context ) ;
349+ const { act, data } = useBackend < Data > ( context ) ;
354350 // Get drink information for cart's container from data
355351 const { mainDrinks = [ ] } = data ;
356- const { drink_capacity } = data . storage ;
352+ const { storage } = data ;
357353
358354 if ( mainDrinks . length > 0 ) {
359355 return (
@@ -374,7 +370,7 @@ const MainDrinkRow = (props, context) => {
374370 </ Table . Cell >
375371 < Table . Cell >
376372 < ProgressBar
377- value = { reagent . drink_quantity / 200 } >
373+ value = { reagent . drink_quantity / storage . drink_capacity } >
378374 { reagent . drink_quantity } u
379375 </ ProgressBar >
380376 </ Table . Cell >
@@ -436,20 +432,18 @@ const MainDrinkRow = (props, context) => {
436432
437433const MixerDrinkRow = ( props , context ) => {
438434 // Get data from ui_data in backend code
439- const { act, data } = useBackend < Tab > ( context ) ;
435+ const { act, data } = useBackend < Data > ( context ) ;
440436 // Get drink information for cart's container from data
441437 const { mixerDrinks = [ ] } = data ;
442438
443439 if ( mixerDrinks . length > 0 ) {
444440 return (
445441 // Create Table for horizontal format
446- < Table
447- direction = "column" >
442+ < Table >
448443 { /* Use map to create dynamic rows based on the contents of drinks, with drink being the individual item and its stats */ }
449444 { mixerDrinks . map ( reagent => (
450445 // Start row for holding ui elements and given data
451446 < Table . Row
452- direction = "row"
453447 key = { reagent . drink_name }
454448 fontSize = "14px"
455449 height = "30px" >
@@ -459,19 +453,19 @@ const MixerDrinkRow = (props, context) => {
459453 { /* Get name */ }
460454 { capitalize ( reagent . drink_name ) }
461455 </ Table . Cell >
462- < Table . Cell
463- textAlign = "left" >
464- { /* Get amount of reagent in storage */ }
465- { reagent . drink_quantity } u
466- </ Table . Cell >
467456 < Table . Cell >
468- { /* Make dispense button */ }
457+ < ProgressBar
458+ value = { reagent . drink_quantity / 50 } >
459+ { reagent . drink_quantity } u
460+ </ ProgressBar >
461+ </ Table . Cell >
462+ < Table . Cell >
463+ { /* Transfer reagents back to cart */ }
469464 < Button
470- fluid
471465 content = "Transfer Back"
472466 textAlign = "center"
473467 fontSize = "16px"
474- width = "175px "
468+ width = "150px "
475469 // Disable if there is none of the reagent in storage
476470 disabled = { (
477471 reagent . drink_quantity === 0
@@ -483,14 +477,15 @@ const MixerDrinkRow = (props, context) => {
483477 </ Table . Cell >
484478 </ Table . Row >
485479 ) ) }
486- < Table . Row
487- justify = "center" >
488- < Table . Cell >
480+ < Table . Row >
481+ < Table . Cell
482+ justify = "center" >
483+ { /* Dispence reagents into glass */ }
489484 < Button
490- fluid
491485 content = "Pour glass"
492486 textAlign = "center"
493487 fontSize = "16px"
488+ width = "100%"
494489 onClick = { ( ) => act ( "pour" ) }
495490 />
496491 </ Table . Cell >
@@ -515,7 +510,7 @@ const MixerDrinkRow = (props, context) => {
515510
516511const MixerDrinkRow1 = ( props , context ) => {
517512 // Get data from ui_data in backend code
518- const { act, data } = useBackend < Tab > ( context ) ;
513+ const { act, data } = useBackend < Data > ( context ) ;
519514 // Get drink information for cart's container from data
520515 const { mixerDrinks = [ ] } = data ;
521516
0 commit comments