Skip to content

Commit f7e7fde

Browse files
committed
fix UI issues and CORS configuration for AI recommendations
1 parent 7b0f53a commit f7e7fde

6 files changed

Lines changed: 31 additions & 79 deletions

File tree

backend/app/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@
3838
# CORS middleware (allow frontend to call backend)
3939
app.add_middleware(
4040
CORSMiddleware,
41-
allow_origins=["*"],
41+
allow_origins=[
42+
"https://nutrisync.me",
43+
"https://www.nutrisync.me",
44+
"http://localhost:5173",
45+
"http://localhost:3000",
46+
],
4247
allow_credentials=True,
4348
allow_methods=["*"],
4449
allow_headers=["*"],

frontend/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<link rel="preconnect" href="https://fonts.googleapis.com">
1010
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1111
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet">
12-
13-
<!-- Google AdSense -->
14-
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3174647321886371"
15-
crossorigin="anonymous"></script>
1612
</head>
1713
<body>
1814
<div id="root"></div>

frontend/src/components/AdSenseAd.jsx

Lines changed: 0 additions & 50 deletions
This file was deleted.

frontend/src/components/Recommendations.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useState, useEffect, useRef, useCallback, useMemo } from 'react';
22
import { supabase } from '../supabaseClient';
33
import { useGoals } from '../contexts/GoalsContext';
4-
import { AnimatePresence } from 'motion/react';
4+
import { motion as Motion, AnimatePresence } from 'motion/react';
55
import api from '../services/api';
66

77
export default function Recommendations({ limit = 3, refreshTrigger = 0 }) {

frontend/src/pages/Landing.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default function Landing() {
133133
<Motion.div initial={{ opacity: 0, y: 30 }}
134134
animate={{ opacity: 1, y: 0 }}
135135
transition={{ duration: 0.8, delay: 0.3 }}
136-
className="mt-20 grid grid-cols-3 gap-8 max-w-2xl mx-auto"
136+
className="mt-16 grid grid-cols-3 gap-8 max-w-2xl mx-auto"
137137
>
138138
{stats.map((stat, index) => (
139139
<div key={index} className="text-center">
@@ -149,12 +149,12 @@ export default function Landing() {
149149
</section>
150150

151151
{/* Features Section */}
152-
<section className="py-32 px-6 bg-[#0a0a0a]">
152+
<section className="py-20 px-6 bg-[#0a0a0a]">
153153
<div className="max-w-7xl mx-auto">
154154
<Motion.div initial={{ opacity: 0, y: 20 }}
155155
whileInView={{ opacity: 1, y: 0 }}
156156
viewport={{ once: true }}
157-
className="text-center mb-20"
157+
className="text-center mb-12"
158158
>
159159
<h2 className="text-4xl md:text-5xl font-heading font-bold text-white mb-6">
160160
Powerful Features
@@ -205,7 +205,7 @@ export default function Landing() {
205205
</section>
206206

207207
{/* How It Works */}
208-
<section className="py-32 px-6 bg-black">
208+
<section className="py-20 px-6 bg-black">
209209
<div className="max-w-7xl mx-auto">
210210
<Motion.div initial={{ opacity: 0, y: 20 }}
211211
whileInView={{ opacity: 1, y: 0 }}
@@ -272,7 +272,7 @@ export default function Landing() {
272272
</section>
273273

274274
{/* Benefits Section */}
275-
<section className="py-32 px-6 bg-[#0a0a0a]">
275+
<section className="py-20 px-6 bg-[#0a0a0a]">
276276
<div className="max-w-7xl mx-auto">
277277
<div className="grid grid-cols-1 lg:grid-cols-2 gap-16 items-center">
278278
<Motion.div initial={{ opacity: 0, x: -30 }}
@@ -385,7 +385,7 @@ export default function Landing() {
385385
</section>
386386

387387
{/* CTA Section */}
388-
<section className="py-32 px-6 bg-[#0a0a0a]">
388+
<section className="py-20 px-6 bg-[#0a0a0a]">
389389
<Motion.div initial={{ opacity: 0, y: 20 }}
390390
whileInView={{ opacity: 1, y: 0 }}
391391
viewport={{ once: true }}

frontend/src/pages/Progress.jsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -595,34 +595,35 @@ export default function Progress() {
595595

596596
{/* Streak Display and Stats */}
597597
{stats && (
598-
<div className="flex flex-wrap gap-4">
599-
<Motion.div initial={{ opacity: 0, scale: 0.9 }}
598+
<div className="grid grid-cols-3 gap-2 sm:gap-3 max-w-xs sm:max-w-sm">
599+
<Motion.div
600+
initial={{ opacity: 0, scale: 0.9 }}
600601
animate={{ opacity: 1, scale: 1 }}
601-
className={`card px-6 py-4 flex items-center gap-4 relative ${stats.goalsMetStreak > 0 ? 'border-amber-500/30' : ''}`}
602+
className={`card p-3 sm:p-4 ${stats.goalsMetStreak > 0 ? 'border-amber-500/30' : ''}`}
602603
>
603-
<div className="flex-1">
604-
<p className={`text-3xl font-mono font-bold ${stats.goalsMetStreak > 0 ? 'text-amber-400' : 'text-white/40'}`}>
605-
{stats.goalsMetStreak}
606-
</p>
607-
<p className="text-white/50 text-sm">Day Streak</p>
608-
</div>
604+
<p className={`text-xl sm:text-2xl font-mono font-bold ${stats.goalsMetStreak > 0 ? 'text-amber-400' : 'text-white/40'}`}>
605+
{stats.goalsMetStreak}
606+
</p>
607+
<p className="text-white/50 text-xs mt-1">Streak</p>
609608
</Motion.div>
610609

611-
<Motion.div initial={{ opacity: 0, y: 20 }}
610+
<Motion.div
611+
initial={{ opacity: 0, y: 20 }}
612612
animate={{ opacity: 1, y: 0 }}
613-
className="card p-5"
613+
className="card p-3 sm:p-4"
614614
>
615-
<p className="text-3xl font-mono font-bold text-primary-500">{stats.totalMeals}</p>
616-
<p className="text-white/50 text-sm mt-1">Total Meals</p>
615+
<p className="text-xl sm:text-2xl font-mono font-bold text-primary-500">{stats.totalMeals}</p>
616+
<p className="text-white/50 text-xs mt-1">Meals</p>
617617
</Motion.div>
618618

619-
<Motion.div initial={{ opacity: 0, y: 20 }}
619+
<Motion.div
620+
initial={{ opacity: 0, y: 20 }}
620621
animate={{ opacity: 1, y: 0 }}
621622
transition={{ delay: 0.1 }}
622-
className="card p-5"
623+
className="card p-3 sm:p-4"
623624
>
624-
<p className="text-3xl font-mono font-bold text-secondary-400">{stats.avgCaloriesPerMeal}</p>
625-
<p className="text-white/50 text-sm mt-1">Avg Cal/Meal</p>
625+
<p className="text-xl sm:text-2xl font-mono font-bold text-secondary-400">{stats.avgCaloriesPerMeal}</p>
626+
<p className="text-white/50 text-xs mt-1">Cal/Meal</p>
626627
</Motion.div>
627628
</div>
628629
)}

0 commit comments

Comments
 (0)