Skip to content

Commit

Permalink
feat(#491): show days needed to mature wine
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Apr 20, 2024
1 parent 71f1e66 commit 017ca42
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/WineRecipeList/WineRecipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import CardHeader from '@mui/material/CardHeader'
import CardActions from '@mui/material/CardActions'
import Button from '@mui/material/Button'

import { grapeVarietyNameMap } from '../../data/crops/grape'
import {
grapeVarietyNameMap,
wineVarietyValueMap,
} from '../../data/crops/grape'
import { grapeVariety } from '../../enums'
import { wines } from '../../img'
import { integerString } from '../../utils'

/**
* @param {{
Expand All @@ -16,6 +20,7 @@ import { wines } from '../../img'
*/
export const WineRecipe = ({ wineVariety }) => {
const wineName = grapeVarietyNameMap[wineVariety]

return (
<Card className="WineRecipe">
<CardHeader
Expand All @@ -28,6 +33,19 @@ export const WineRecipe = ({ wineVariety }) => {
alt={wineName}
/>
}
subheader={
<>
<p>
Days to mature:{' '}
{integerString(3 * wineVarietyValueMap[wineVariety])}
</p>
{
// FIXME: Show type and number of grapes required (4x their wineVarietyValueMap value)
// FIXME: Show number of required grapes in inventory
// FIXME: Show amount in cellar
}
</>
}
></CardHeader>
<CardActions>
<Button color="primary" variant="contained">
Expand Down
17 changes: 17 additions & 0 deletions src/data/crops/grape.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ export const grapeVarietyNameMap = {
[grapeVariety.NEBBIOLO]: 'Nebbiolo',
}

/**
* @type {Record<grapeVariety, number>} The number value represents a wine's
* value relative to a baseline of 1. Must be an integer.
*/
export const wineVarietyValueMap = {
[grapeVariety.CHARDONNAY]: 1,
[grapeVariety.SAUVIGNON_BLANC]: 8,
//[grapeVariety.PINOT_BLANC]: 2,
//[grapeVariety.MUSCAT]: 4,
//[grapeVariety.RIESLING]: 7,
//[grapeVariety.MERLOT]: 6,
[grapeVariety.CABERNET_SAUVIGNON]: 3,
//[grapeVariety.SYRAH]: 9,
[grapeVariety.TEMPRANILLO]: 5,
[grapeVariety.NEBBIOLO]: 10,
}

/**
* @property farmhand.module:items.grapeChardonnay
* @type {farmhand.grape}
Expand Down

0 comments on commit 017ca42

Please sign in to comment.