Skip to content

Commit 14c9d37

Browse files
committed
add apple-touch-icon for better favicon support in search
1 parent f7e7fde commit 14c9d37

4 files changed

Lines changed: 49 additions & 17 deletions

File tree

frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/png" href="/favicon.png" />
6+
<link rel="apple-touch-icon" href="/favicon.png" />
67
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
78
<title>NutriSync - Nutrition Tracking</title>
89
<!-- Google Fonts -->

frontend/src/components/SetGoals.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ export default function SetGoals() {
8888
<div className="w-10 h-10 bg-primary-700/10 flex items-center justify-center">
8989
<Target size={20} className="text-primary-500" strokeWidth={2} />
9090
</div>
91-
<div className="text-left">
91+
<div className="text-left min-w-0 flex-1">
9292
<h3 className="font-heading font-semibold text-white">Daily Goals</h3>
93-
<p className="text-white/50 text-sm">
94-
{goals?.calories || 2000} kcal | {goals?.protein || 150}g P | {goals?.carbs || 250}g C | {goals?.fat || 65}g F
93+
<p className="text-white/50 text-xs sm:text-sm truncate">
94+
<span className="hidden sm:inline">{goals?.calories || 2000} kcal | {goals?.protein || 150}g P | {goals?.carbs || 250}g C | {goals?.fat || 65}g F</span>
95+
<span className="sm:hidden">{goals?.calories || 2000}cal {goals?.protein || 150}P {goals?.carbs || 250}C {goals?.fat || 65}F</span>
9596
{goals?.fasting_enabled && (
96-
<span className="text-orange-400"> | {goals.fasting_schedule_type} Fasting</span>
97+
<span className="text-orange-400"> | {goals.fasting_schedule_type}</span>
9798
)}
9899
</p>
99100
</div>

frontend/src/components/__tests__/SetGoals.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ describe('SetGoals Component', () => {
117117
it('shows fasting indicator when fasting is enabled', () => {
118118
render(<SetGoals />);
119119

120-
// Should show fasting schedule type in summary
121-
expect(screen.getByText(/16:8 Fasting/i)).toBeInTheDocument();
120+
// Should show fasting schedule type in summary (just "16:8" without "Fasting" word)
121+
expect(screen.getByText(/16:8/)).toBeInTheDocument();
122122
});
123123

124124
it('does not show fasting indicator when disabled', () => {

frontend/src/utils/nutritionCalculator.js

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,54 @@ export function adjustCaloriesForGoal(tdee, goalType, customAmount = null) {
8888
}
8989
}
9090

91+
/**
92+
* Get protein intake target (g/kg/day) based on goal and activity level
93+
* @param {string} goalType - 'lose', 'maintain', or 'gain'
94+
* @param {string} activityLevel - Activity level
95+
* @returns {number} Protein per kg (midpoint of range)
96+
*/
97+
export function getProteinPerKg(goalType, activityLevel) {
98+
// Protein targets in g/kg/day based on goal and activity level
99+
// Values are midpoints of the ranges from research-based guidelines
100+
const proteinTargets = {
101+
lose: {
102+
sedentary: 1.7, // 1.6-1.8
103+
lightly_active: 1.9, // 1.8-2.0
104+
moderately_active: 2.1, // 2.0-2.2
105+
very_active: 2.3, // 2.2-2.4
106+
extra_active: 2.45 // 2.3-2.6
107+
},
108+
maintain: {
109+
sedentary: 1.3, // 1.2-1.4
110+
lightly_active: 1.5, // 1.4-1.6
111+
moderately_active: 1.7, // 1.6-1.8
112+
very_active: 1.9, // 1.8-2.0
113+
extra_active: 2.1 // 2.0-2.2
114+
},
115+
gain: {
116+
sedentary: 1.7, // 1.6-1.8
117+
lightly_active: 1.9, // 1.8-2.0
118+
moderately_active: 2.1, // 2.0-2.2
119+
very_active: 2.3, // 2.2-2.4
120+
extra_active: 2.5 // 2.4-2.6
121+
}
122+
};
123+
124+
const goalTargets = proteinTargets[goalType] || proteinTargets.maintain;
125+
return goalTargets[activityLevel] || goalTargets.sedentary;
126+
}
127+
91128
/**
92129
* Calculate macronutrient targets
93130
* @param {number} calories - Total daily calories
94131
* @param {number} weight_kg - Weight in kilograms
95132
* @param {string} goalType - 'lose', 'maintain', or 'gain'
133+
* @param {string} activityLevel - Activity level
96134
* @returns {Object} Macro targets {protein, carbs, fat, fiber}
97135
*/
98-
export function calculateMacros(calories, weight_kg, goalType) {
99-
// Protein: 1.8-2.2g per kg for muscle maintenance/growth
100-
// Higher protein when cutting, moderate when maintaining/bulking
101-
let proteinPerKg;
102-
if (goalType === 'lose') {
103-
proteinPerKg = 2.2; // Higher protein to preserve muscle while cutting
104-
} else if (goalType === 'gain') {
105-
proteinPerKg = 1.8; // Moderate protein for muscle building
106-
} else {
107-
proteinPerKg = 2.0; // Maintenance
108-
}
136+
export function calculateMacros(calories, weight_kg, goalType, activityLevel = 'sedentary') {
137+
// Get protein target based on goal and activity level
138+
const proteinPerKg = getProteinPerKg(goalType, activityLevel);
109139

110140
const protein = Math.round(weight_kg * proteinPerKg);
111141
const proteinCalories = protein * 4; // 4 calories per gram of protein

0 commit comments

Comments
 (0)