Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar link's scroll position resolved. #194

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@ input[type="radio"] {
cursor: pointer;
font-size: 2rem;
margin-bottom: 0;
}
}

.card {
transition: all 0.3s ease; /* Ensure smooth transitions */
}

/* Shadow effect on hover */
.card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* Add a shadow on hover */
}
Comment on lines +39 to +42
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Approved: Effective hover effect added to .card class.

The hover effect for the .card class is well-implemented. It adds a subtle box shadow that provides visual feedback when users interact with card elements, enhancing the overall user experience.

However, there's a minor issue to address:

The file is missing a closing brace } at the end. Please add it to properly close the .card:hover rule:

  .card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* Add a shadow on hover */
  }
+ }

Committable suggestion was skipped due to low confidence.

🧰 Tools
🪛 Biome

[error] 42-42: expected } but instead the file ends

the file ends here

(parse)

4 changes: 4 additions & 0 deletions frontend/src/components/Pages/About.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import bgpic from "../../assets/img/abt1.jpg";
import React, { useEffect } from 'react';

export default function About() {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return (
<div id="about" className="relative w-full h-screen md:mt-28">
<div
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/Pages/Boardgame.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState , useEffect } from 'react';
import board1 from "../../assets/Boardgames/board1.png";
import board2 from "../../assets/Boardgames/board2.png";
import board3 from "../../assets/Boardgames/board3.jpg";
Expand Down Expand Up @@ -188,7 +188,9 @@ export default function Boardgame() {
},
];


useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Pages/Event.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ export default function Event() {
};
}, []);

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<>
<div id="event" className="w-full h-fit bg-amber-100 md:overflow-hidden ">
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import Landing from "../ui/Landing";
import ReviewCarousel from "../ui/ReviewCarousel";
import FeedbackForm from "../ui/FeedbackForm";
import About from "./About";
import React, { useEffect } from 'react';

export default function Home() {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return (
<div id="home" className="bg-[#FDF3C7]">
<Landing />
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/Pages/Login.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

import React, { useState , useEffect } from "react";
import { Link } from "react-router-dom";
import photo from "../../assets/login.png";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ashwinib26 you add twice it remove and follow code rabit suggestions


import { Link, useNavigate } from "react-router-dom";
import photo from "../../assets/login.png";
import React, { useState } from "react";
import { message } from "antd";
Comment on lines +2 to 9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct useEffect import, but clean up duplicate imports

The addition of useEffect to the React import is correct. However, there are duplicate import statements that need to be addressed:

Please apply the following changes to clean up the imports:

-import React, { useState , useEffect } from "react";
-import { Link } from "react-router-dom";
-import photo from "../../assets/login.png";
-
import { Link, useNavigate } from "react-router-dom";
import photo from "../../assets/login.png";
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import { message } from "antd";

This will remove the duplicate imports and consolidate them into a single, clean import section.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import React, { useState , useEffect } from "react";
import { Link } from "react-router-dom";
import photo from "../../assets/login.png";
import { Link, useNavigate } from "react-router-dom";
import photo from "../../assets/login.png";
import React, { useState } from "react";
import { message } from "antd";
import { Link, useNavigate } from "react-router-dom";
import photo from "../../assets/login.png";
import React, { useState, useEffect } from "react";
import { message } from "antd";
🧰 Tools
🪛 Biome

[error] 6-6: Shouldn't redeclare 'Link'. Consider to delete it or rename it.

'Link' is defined here:

(lint/suspicious/noRedeclare)


[error] 7-7: Shouldn't redeclare 'photo'. Consider to delete it or rename it.

'photo' is defined here:

(lint/suspicious/noRedeclare)


[error] 8-8: Shouldn't redeclare 'React'. Consider to delete it or rename it.

'React' is defined here:

(lint/suspicious/noRedeclare)


[error] 8-8: Shouldn't redeclare 'useState'. Consider to delete it or rename it.

'useState' is defined here:

(lint/suspicious/noRedeclare)



const Login = () => {
const API_URL = import.meta.env.VITE_BACKEND_URL || "http://localhost:3000";
const [data, setData] = useState({
Expand Down Expand Up @@ -43,6 +49,10 @@ const Login = () => {
}
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<div className="w-screen h-screen flex items-center justify-center pt-10">
<img src={photo} alt="login" className=" w-3/4 absolute" />
Expand Down
16 changes: 13 additions & 3 deletions frontend/src/components/Pages/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useState , useEffect } from 'react';
import { motion } from 'framer-motion';
import Mybook from './MyBook';
import TodaysSpecial from './TodaysSpecial';
Expand Down Expand Up @@ -28,6 +28,10 @@ function ParallaxImage() {
y: mousePosition.y / 30,
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<>
<div className="w-full h-auto bg-amber-100 items-center justify-center overflow-hidden" onMouseMove={handleMouseMove}>
Expand Down Expand Up @@ -56,10 +60,16 @@ function ParallaxImage() {
<h1 className="text-5xl md:text-9xl font-roboto">Flip Menu</h1>
<GiArrowDunk size={60} className="mt-2 text-orange-400" />
</div>
<div className="w-full md:flex md:items-center md:justify-center">
{/* <div className="w-full md:flex md:items-center md:justify-center">
<Mybook />
</div>
<TodaysSpecial /> */}
<div className="w-full md:flex md:items-center md:justify-center mb-20"> {/* Adjust this container */}
<Mybook />
</div>
<TodaysSpecial />
<div className="w-full md:flex md:items-center md:justify-center" style={{ paddingBottom: '80px' }}> {/* Add bottom padding here */}
<TodaysSpecial />
</div>
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Pages/MyBook.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function MyBook() {
return () => window.removeEventListener('resize', handleResize);
}, []);

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<div style={BgTextureStyle} className=" mt-2 mb-20 overflow-hidden w-full h-full flex justify-center items-center ">
<HTMLFlipBook
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/Pages/Notfound.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Notfound from "../../assets/Menu_assets/Notfound.gif"
import React, { useState , useEffect } from 'react';

const NotFound = () => {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return (
<div>
<div className="flex flex-col items-center justify-center h-screen">
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/Pages/Pages.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { forwardRef } from "react";
import PropTypes from "prop-types";
import React, { useState , useEffect , forwardRef } from 'react';

const Page = forwardRef((props, ref) => {
useEffect(() => {
window.scrollTo(0, 0);
}, []);
return (
<div className="demoPage bg-white" ref={ref}>
<div className="h-full">{props.children}</div>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/Pages/Register.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useState , useEffect } from "react";
import pic from "../../assets/img/abt1.jpg";
import pic2 from "../../assets/img/abt1.png";
import pic3 from "../../assets/img/abt2.png";
Expand Down Expand Up @@ -33,6 +33,10 @@ export default function Register() {
.catch((error) => console.log(error));
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<>
<div className="w-full mx-auto mt-10 lg:mt-0 md:mt-0">
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/components/Pages/Signup.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useState , useEffect } from "react";
import photo from "../../assets/login.png";
import { useNavigate } from "react-router-dom";

Expand Down Expand Up @@ -70,6 +70,10 @@ const Signup = () => {
}
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

return (
<div className="w-screen h-screen flex items-center justify-center pt-10">
<img src={photo} alt="login" className=" w-3/4 absolute" />
Expand Down
66 changes: 54 additions & 12 deletions frontend/src/components/Pages/TodaysSpecial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,25 @@ import caesar_salad from '../../assets/TSimg/caesar_salad.webp';

const menuItems = {
coffee: [
{ name: "Espresso", description: "Rich and bold coffee shot.", image: espresso },
{ name: "Cappuccino", description: "Creamy coffee with frothy milk.", image: cappuccino },
{ name: "Latte", description: "Smooth coffee with steamed milk.", image: latte },
{ name: "Espresso", description: "Rich and bold coffee shot.", image: espresso, originalPrice: "$3.00", offerPrice: "$2.50" },
{ name: "Cappuccino", description: "Creamy coffee with frothy milk.", image: cappuccino, originalPrice: "$3.50", offerPrice: "$3.00" },
{ name: "Latte", description: "Smooth coffee with steamed milk.", image: latte, originalPrice: "$4.00", offerPrice: "$3.50" },
],
drinks: [
{ name: "Mango Smoothie", description: "Refreshing mango blend.", image: mango_smoothie },
{ name: "Lemonade", description: "Zesty and chilled lemonade.", image: lemonade },
{ name: "Iced Tea", description: "Cool iced tea with lemon.", image: iced_tea },
{ name: "Mango Smoothie", description: "Refreshing mango blend.", image: mango_smoothie, originalPrice: "$4.50", offerPrice: "$4.00" },
{ name: "Lemonade", description: "Zesty and chilled lemonade.", image: lemonade, originalPrice: "$2.50", offerPrice: "$2.00" },
{ name: "Iced Tea", description: "Cool iced tea with lemon.", image: iced_tea, originalPrice: "$2.00", offerPrice: "$1.50" },
],
food: [
{ name: "Cheese Sandwich", description: "Toasted sandwich with cheese.", image: cheese_sandwich },
{ name: "Pasta Primavera", description: "Veggies and pasta in a light sauce.", image: pasta_primavera },
{ name: "Caesar Salad", description: "Crispy salad with Caesar dressing.", image: caesar_salad },
{ name: "Cheese Sandwich", description: "Toasted sandwich with cheese.", image: cheese_sandwich, originalPrice: "$3.50", offerPrice: "$3.00" },
{ name: "Pasta Primavera", description: "Veggies and pasta in a light sauce.", image: pasta_primavera, originalPrice: "$5.50", offerPrice: "$5.00" },
{ name: "Caesar Salad", description: "Crispy salad with Caesar dressing.", image: caesar_salad, originalPrice: "$5.00", offerPrice: "$4.50" },
],
};

const TodaysSpecial = () => {
const [todaysSpecial, setTodaysSpecial] = useState({ coffee: {}, drink: {}, food: {} });
const [hoveredItem, setHoveredItem] = useState(null); // State to track the hovered item

// Function to update today's special (cycling through 3 items)
const updateTodaysSpecial = () => {
Expand All @@ -51,20 +52,61 @@ const TodaysSpecial = () => {
<div className="mt-10">
<h2 className="text-5xl font-bold text-center mb-9">Today's Special</h2>
<div className="flex flex-col md:flex-row justify-around items-center mb-8 space-y-8 md:space-y-0 md:space-x-4">
<div className="card bg-pink-100 p-4 rounded-lg shadow-lg max-w-xs text-center">
{/* Coffee Card */}
<div
className="bg-pink-100 p-4 rounded-lg shadow-lg max-w-xs text-center transition-transform duration-300 ease-in-out transform hover:scale-105 mx-2"
style={{ minHeight: '300px' }} // Ensure a minimum height for the card
onMouseEnter={() => setHoveredItem('coffee')}
onMouseLeave={() => setHoveredItem(null)}
>
<img className="w-64 h-48 object-cover object-center rounded-md mb-4" src={todaysSpecial.coffee.image} alt={todaysSpecial.coffee.name} />
<h3 className="text-xl font-semibold">{todaysSpecial.coffee.name}</h3>
<p className="text-gray-600">{todaysSpecial.coffee.description}</p>
{/* Show prices below the image and description */}
{hoveredItem === 'coffee' && (
<div className="mt-4">
<p className="text-lg font-bold text-red-700 line-through">{todaysSpecial.coffee.originalPrice}</p>
<p className="text-xl font-bold text-red-500">{todaysSpecial.coffee.offerPrice}</p>
</div>
)}
</div>
<div className="card bg-teal-100 p-4 rounded-lg shadow-lg max-w-xs text-center">

{/* Food Card */}
<div
className="bg-teal-100 p-4 rounded-lg shadow-lg max-w-xs text-center transition-transform duration-300 ease-in-out transform hover:scale-105 mx-2"
style={{ minHeight: '300px' }} // Ensure a minimum height for the card
onMouseEnter={() => setHoveredItem('food')}
onMouseLeave={() => setHoveredItem(null)}
>
<img className="w-64 h-48 object-cover object-center rounded-md mb-4" src={todaysSpecial.food.image} alt={todaysSpecial.food.name} />
<h3 className="text-xl font-semibold">{todaysSpecial.food.name}</h3>
<p className="text-gray-600">{todaysSpecial.food.description}</p>
{/* Show prices below the image and description */}
{hoveredItem === 'food' && (
<div className="mt-4">
<p className="text-lg font-bold text-red-700 line-through">{todaysSpecial.food.originalPrice}</p>
<p className="text-xl font-bold text-red-500">{todaysSpecial.food.offerPrice}</p>
</div>
)}
</div>
<div className="card bg-pink-100 p-4 rounded-lg shadow-lg max-w-xs text-center">

{/* Drink Card */}
<div
className="bg-pink-100 p-4 rounded-lg shadow-lg max-w-xs text-center transition-transform duration-300 ease-in-out transform hover:scale-105 mx-2"
style={{ minHeight: '300px' }} // Ensure a minimum height for the card
onMouseEnter={() => setHoveredItem('drink')}
onMouseLeave={() => setHoveredItem(null)}
>
<img className="w-64 h-48 object-cover object-center rounded-md mb-4" src={todaysSpecial.drink.image} alt={todaysSpecial.drink.name} />
<h3 className="text-xl font-semibold">{todaysSpecial.drink.name}</h3>
<p className="text-gray-600">{todaysSpecial.drink.description}</p>
{/* Show prices below the image and description */}
{hoveredItem === 'drink' && (
<div className="mt-4">
<p className="text-lg font-bold text-red-700 line-through">{todaysSpecial.drink.originalPrice}</p>
<p className="text-xl font-bold text-red-500">{todaysSpecial.drink.offerPrice}</p>
</div>
)}
</div>
</div>
</div>
Expand Down