Skip to content

Commit 433c209

Browse files
authored
Refactor meal category colors from blue/green/brown to orange/amber/yellow
2 parents 06197b0 + 68a87ae commit 433c209

3 files changed

Lines changed: 28 additions & 30 deletions

File tree

create.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
'protein' => 10,
1616
'carbs' => 50,
1717
'fat' => 5,
18-
'color' => 'blue'
18+
'color' => 'amber'
1919
],
2020
[
2121
'name' => 'Chicken Salad',
2222
'protein' => 30,
2323
'carbs' => 15,
2424
'fat' => 18,
25-
'color' => 'green'
25+
'color' => 'orange'
2626
]
2727
];
2828
file_put_contents($mealsFile, json_encode($initialMeals, JSON_PRETTY_PRINT));
@@ -356,9 +356,9 @@ class="w-full px-3 py-2 bg-stone-50 border border-stone-200 rounded-lg text-ston
356356
<label for="color" class="block text-sm font-medium text-stone-600 mb-1.5">Category</label>
357357
<select id="color" name="color"
358358
class="w-full px-3 py-2 bg-stone-50 border border-stone-200 rounded-lg text-stone-800 focus:outline-none focus:ring-2 focus:ring-stone-400 focus:border-transparent transition-all">
359-
<option value="blue">Protein-rich</option>
360-
<option value="brown">Snacks</option>
361-
<option value="orange">Mixed</option>
359+
<option value="orange">Protein-rich</option>
360+
<option value="amber">Mixed</option>
361+
<option value="yellow">Snacks</option>
362362
</select>
363363
</div>
364364

@@ -497,10 +497,9 @@ class="w-full px-3 py-2 bg-stone-50 border border-stone-200 rounded-lg text-ston
497497
<label for="edit-color" class="block text-sm font-medium text-stone-600 mb-1.5">Category</label>
498498
<select id="edit-color" name="color"
499499
class="w-full px-3 py-2 bg-stone-50 border border-stone-200 rounded-lg text-stone-800 focus:outline-none focus:ring-2 focus:ring-stone-400 focus:border-transparent transition-all">
500-
<option value="blue">Protein-rich</option>
501-
<option value="green">Vegetables</option>
502-
<option value="brown">Snacks</option>
503-
<option value="orange">Mixed</option>
500+
<option value="orange">Protein-rich</option>
501+
<option value="amber">Mixed</option>
502+
<option value="yellow">Snacks</option>
504503
</select>
505504
</div>
506505

index.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,42 @@
1616
'protein' => 10,
1717
'carbs' => 50,
1818
'fat' => 5,
19-
'color' => 'green'
19+
'color' => 'amber'
2020
],
2121
[
2222
'name' => 'Chicken Salad',
2323
'protein' => 30,
2424
'carbs' => 15,
2525
'fat' => 18,
26-
'color' => 'blue'
26+
'color' => 'orange'
2727
],
2828
[
2929
'name' => 'Protein Shake',
3030
'protein' => 25,
3131
'carbs' => 10,
3232
'fat' => 3,
33-
'color' => 'blue'
33+
'color' => 'orange'
3434
],
3535
[
3636
'name' => 'Salmon with Rice',
3737
'protein' => 35,
3838
'carbs' => 40,
3939
'fat' => 15,
40-
'color' => 'orange'
40+
'color' => 'amber'
4141
],
4242
[
4343
'name' => 'Greek Yogurt',
4444
'protein' => 15,
4545
'carbs' => 8,
4646
'fat' => 5,
47-
'color' => 'blue'
47+
'color' => 'orange'
4848
],
4949
[
5050
'name' => 'Banana',
5151
'protein' => 1,
5252
'carbs' => 27,
5353
'fat' => 0,
54-
'color' => 'brown'
54+
'color' => 'yellow'
5555
]
5656
];
5757
file_put_contents($mealsFile, json_encode($initialMeals, JSON_PRETTY_PRINT));
@@ -117,7 +117,7 @@ function calculateKcal($protein, $carbs, $fat)
117117
'protein' => $mealToAdd['protein'],
118118
'carbs' => $mealToAdd['carbs'],
119119
'fat' => $mealToAdd['fat'],
120-
'color' => isset($mealToAdd['color']) ? $mealToAdd['color'] : 'blue'
120+
'color' => isset($mealToAdd['color']) ? $mealToAdd['color'] : 'orange'
121121
];
122122
$dailyMeals[$targetDate]['meals'][] = $newMeal;
123123

@@ -308,7 +308,7 @@ function calculateKcal($protein, $carbs, $fat)
308308
'protein' => $meal['protein'],
309309
'carbs' => $meal['carbs'],
310310
'fat' => $meal['fat'],
311-
'color' => isset($meal['color']) ? $meal['color'] : 'blue',
311+
'color' => isset($meal['color']) ? $meal['color'] : 'orange',
312312
'count' => 1,
313313
'indices' => [$index]
314314
];
@@ -445,17 +445,17 @@ function calculateKcal($protein, $carbs, $fat)
445445
<button type="submit" name="add_meal"
446446
class="meal-button h-full w-full
447447
<?php
448-
$buttonColor = isset($meal['color']) ? $meal['color'] : 'grey';
448+
$buttonColor = isset($meal['color']) ? $meal['color'] : 'orange';
449449
switch ($buttonColor) {
450-
case 'brown':
451-
echo 'bg-amber-700 hover:bg-amber-800';
450+
case 'yellow':
451+
echo 'bg-yellow-500 hover:bg-yellow-600';
452452
break;
453-
case 'orange':
454-
echo 'bg-orange-500 hover:bg-orange-600';
453+
case 'amber':
454+
echo 'bg-amber-500 hover:bg-amber-600';
455455
break;
456-
case 'blue':
456+
case 'orange':
457457
default:
458-
echo 'bg-blue-600 hover:bg-blue-700';
458+
echo 'bg-orange-500 hover:bg-orange-600';
459459
break;
460460
}
461461
?> text-white py-3 px-3 rounded-lg text-left pr-8">

sort.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,15 @@ if (mealContainer) {
7373

7474
// Extract color class from class list
7575
const colorA = Array.from(buttonA.classList).find(cls =>
76-
cls.startsWith('bg-stone-') && !cls.includes('hover'));
76+
(cls.startsWith('bg-orange-') || cls.startsWith('bg-amber-') || cls.startsWith('bg-yellow-')) && !cls.includes('hover'));
7777
const colorB = Array.from(buttonB.classList).find(cls =>
78-
cls.startsWith('bg-stone-') && !cls.includes('hover'));
78+
(cls.startsWith('bg-orange-') || cls.startsWith('bg-amber-') || cls.startsWith('bg-yellow-')) && !cls.includes('hover'));
7979

8080
// Define color order (darker shades first)
8181
const colorOrder = {
82-
'bg-stone-800': 1,
83-
'bg-stone-700': 2,
84-
'bg-stone-600': 3,
85-
'bg-stone-500': 4
82+
'bg-orange-500': 1,
83+
'bg-amber-500': 2,
84+
'bg-yellow-500': 3
8685
};
8786

8887
return (colorOrder[colorA] || 5) - (colorOrder[colorB] || 5);

0 commit comments

Comments
 (0)