|
1 | 1 | import type { cookingDataType } from 'types/displayDataTypes'; |
2 | | -import { Cook, SousChef, GourmetChef } from '@media/Achievements'; |
3 | 2 | import './Cooking.css'; |
| 3 | +import { AchievementItem,ItemWithCounter } from '@components/common'; |
4 | 4 |
|
5 | | -const Food = ( {cookedItems, knownRecipes, alreadyCookedRecipes} : cookingDataType) => { |
| 5 | +const Food = ( {cookedItems, knownRecipes, alreadyCookedRecipes, totalRecipes, achievements} : cookingDataType) => { |
6 | 6 | return ( |
7 | 7 | <div className="progress-container"> |
8 | 8 | <span className="a-title"> |
9 | 9 | <h2> |
10 | | - Has cooked {alreadyCookedRecipes}, knowing {knownRecipes} out of 74 recipes |
| 10 | + Has cooked {alreadyCookedRecipes}, knowing {knownRecipes} out of {totalRecipes} recipes |
11 | 11 | </h2> |
12 | 12 | </span> |
13 | 13 | <br /> |
14 | 14 | <h2>Cooking Achievements</h2> |
15 | 15 | <div className="section-achievements"> |
16 | | - <div className="achievement-item"> |
17 | | - <img |
18 | | - className={`${(alreadyCookedRecipes >= 10) ? |
19 | | - "achieved" : "pending"}`} |
20 | | - src={Cook} |
21 | | - alt="Cook Achievement" |
22 | | - /> |
23 | | - <div> |
24 | | - <h3>Cook:</h3> |
25 | | - <p>Cook a total of 10 dishes</p> |
26 | | - </div> |
27 | | - </div> |
28 | | - <div className="achievement-item"> |
29 | | - <img |
30 | | - className={`${(alreadyCookedRecipes >= 25) ? |
31 | | - "achieved" : "pending"}`} |
32 | | - src={SousChef} |
33 | | - alt="Sous Chef Achievement" |
34 | | - /> |
35 | | - <div> |
36 | | - <h3>Sous Chef:</h3> |
37 | | - <p>Cook a total of 25 dishes</p> |
38 | | - </div> |
39 | | - </div> |
40 | | - <div className="achievement-item"> |
41 | | - <img |
42 | | - className={`${(alreadyCookedRecipes >= 74) ? |
43 | | - "achieved" : "pending"}`} |
44 | | - src={GourmetChef} |
45 | | - alt="Gourmet Chef Achievement" |
46 | | - /> |
47 | | - <div> |
48 | | - <h3>Gourmet Chef:</h3> |
49 | | - <p>Cook a total of 74 dishes</p> |
50 | | - </div> |
51 | | - </div> |
| 16 | + {achievements && achievements.map((ach, i) => ( |
| 17 | + <AchievementItem |
| 18 | + key={i} |
| 19 | + done={ach.done} |
| 20 | + image={ach.image} |
| 21 | + achievementName={ach.name} |
| 22 | + achievementDesc={ach.description} |
| 23 | + achievementHoverDesc={ach.hoverDesc} |
| 24 | + />))} |
52 | 25 | </div> |
53 | 26 | <br /> |
54 | 27 | <div className="dishes-grid"> |
55 | 28 | { cookedItems ? |
56 | | - cookedItems.map((d, i) => |
57 | | - <a |
58 | | - href={`https://stardewvalleywiki.com/${d.link}`} |
59 | | - target="blank" |
60 | | - key={i} |
61 | | - className="dish-item"> |
62 | | - <img |
63 | | - src={`https://stardew-tracker.s3.amazonaws.com/Cooking/${d.image}.png`} |
64 | | - alt={d.name} |
65 | | - className={ (d.times !== undefined) ? ((d.times > 0) ? "done" : "known" ): "" } |
66 | | - title={(d.times !== undefined) ? |
67 | | - (d.times > 0) ? `Cooked ${d.name} ${d.times} times` |
68 | | - : `You haven't cooked ${d.name}` |
69 | | - : `You don't know how to cook ${d.name}` |
70 | | - } > |
71 | | - </img> |
72 | | - <p className="times-cooked">x{d.times}</p> |
73 | | - </a>) |
74 | | - : <div>No cooking data available.</div> |
| 29 | + cookedItems.map((d, i) => |
| 30 | + <ItemWithCounter |
| 31 | + key={i} |
| 32 | + link={`https://stardewvalleywiki.com/${d.link}`} |
| 33 | + src={`https://stardew-tracker.s3.amazonaws.com/Cooking/${d.image}.png`} |
| 34 | + name={d.name} |
| 35 | + state={ (d.knownDish) ? ((d.times && d.times > 0) ? "done" : "known" ): "unknown" } |
| 36 | + hoverDesc={(d.knownDish) ? |
| 37 | + (d.times && d.times > 0) ? `Cooked ${d.name} ${d.times} times` |
| 38 | + : `You haven't cooked ${d.name}` |
| 39 | + : `You don't know how to cook ${d.name}`} |
| 40 | + times={d.knownDish ? d.times : undefined} |
| 41 | + />) |
| 42 | + : <div>No cooking data available.</div> |
75 | 43 | } |
76 | 44 | </div> |
77 | 45 | </div> |
|
0 commit comments