Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #203 from igrowker/component-FincaInfo
Browse files Browse the repository at this point in the history
fetch finca info
  • Loading branch information
euphoricdesign authored Oct 3, 2024
2 parents 1c1f7c7 + ec96173 commit b47558e
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 245 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Afacad+Flux:[email protected]&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Nunito:ital,wght@0,200..1000;1,200..1000&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Afacad+Flux:[email protected]&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Nunito:ital,wght@0,200..1000;1,200..1000&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<title>Vite + React + TS</title>
</head>
<body>
Expand Down
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@
"react-slick": "^0.30.2",
"redux-persist": "^6.0.0",
"slick-carousel": "^1.8.1",
"socket.io-client": "^4.8.0",
"template-vite-react": "file:"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/redux-persist": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react": "^4.3.1",
Expand Down
Binary file added public/impacto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/ArbolCuenta.png
Binary file not shown.
Binary file removed src/assets/Hojas.png
Binary file not shown.
Binary file modified src/assets/Mandarinas.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/citricos.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/cosecha.png
Binary file not shown.
Binary file removed src/assets/farmer.jpg
Binary file not shown.
Binary file removed src/assets/imgAdopcion.png
Binary file not shown.
Binary file removed src/assets/imgFincas.png
Binary file not shown.
Binary file removed src/assets/imgProveedor.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Banner/Banner.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}
.banner h1 {
font-size: 48px;
font-weight: bold;
font-weight: 800;
line-height: 1.3;
margin-bottom: 24px;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/ImpactoAmbiental/ImpactoAmbiental.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ImpactoAmbiental: React.FC = () => {
<Section
title="Regenerar la tierra que nos alimenta"
content="Adoptree es una plataforma que busca conectar a personas con la naturaleza, permitiendo adoptar árboles y reforestar áreas deforestadas."
imageSrc="./bio1.svg"
imageSrc="./impacto.png"
imageAlt="Agricultura Regenerativa"
/>

Expand Down Expand Up @@ -110,7 +110,7 @@ const Section: React.FC<{
imageSrc: string;
imageAlt: string;
}> = ({ title, content, imageSrc, imageAlt }) => (
<section className="flex flex-col items-center lg:flex-row px-[30px] py-20">
<section className="flex flex-col items-center lg:flex-row pb-[3.2rem] gap-[30px]">
<motion.div
className="flex-1 mb-8 lg:mb-0"
initial={{ opacity: 0, y: 50 }}
Expand All @@ -127,7 +127,7 @@ const Section: React.FC<{
transition={{ duration: 0.5, delay: 0.2 }}
>
<img
className="max-w-[400px] h-auto rounded-lg"
className="h-auto rounded-lg"
src={imageSrc}
alt={imageAlt}
/>
Expand Down
12 changes: 7 additions & 5 deletions src/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ const Login: React.FC = () => {
<img src={backgroundImage} alt="Background" />
</div>
<div className="login-form shadow-sm">
<img
src={logo}
alt="Adoptree Logo"
className="logo w-[115px] mb-[30px]"
/>
<a href="/">
<img
src={logo}
alt="Adoptree Logo"
className="logo w-[115px] mb-[30px]"
/>
</a>
<h2 className="mb-[30px] font-[900]">
Hola, <br /> Bienvenido de nuevo
</h2>
Expand Down
82 changes: 70 additions & 12 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@ import Logo from '../../assets/adoptree 1.png';
import { useSelector, useDispatch } from 'react-redux';
import { Link, useNavigate } from 'react-router-dom';
import { logout } from '../../store/features/userSlice';
import './Navbar.css';
import { RootState } from '../../types/types';
import { io } from "socket.io-client";
import './Navbar.css';

export interface AnchorProps
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
style?: React.CSSProperties & { '--i'?: number };
}

const socket = io("http://localhost:4000", { withCredentials: true });

const Navbar: React.FC = () => {
const [scrollPosition, setScrollPosition] = useState(0);
const [showModal, setShowModal] = useState<boolean>(false);
// const [notificationsModal, setNotificationsModal] = useState<boolean>(false);
const [notificationsModal, setNotificationsModal] = useState<boolean>(false);
// const [notifications, setNotifications] = useState<any[]>([])

const modalRef = useRef<HTMLDivElement | null>(null);
const currentClickRef = useRef<EventTarget | null>(null);
Expand All @@ -33,6 +37,15 @@ const Navbar: React.FC = () => {

const navigate = useNavigate();

const handleShowNotifications = (event: React.MouseEvent<HTMLElement>) => {
currentClickRef.current = event.target;
setNotificationsModal((prevShowNotification) => !prevShowNotification);
};

const handleCloseNotifications = () => {
setNotificationsModal(false);
};

const handleShowModal = (event: React.MouseEvent<HTMLElement>) => {
currentClickRef.current = event.target;
setShowModal((prevShowModal) => !prevShowModal);
Expand All @@ -59,10 +72,42 @@ const Navbar: React.FC = () => {
};
}, []);

// const styles = {
// '--i': 5,
// display: window.innerWidth < 780 ? 'block' : 'none',
// };

useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (
modalRef.current &&
!modalRef.current?.contains(event.target as Node) && // Operador de aserción de tipo as Node para asegurarnos de que event.target sea un nodo del DOM. Es necesario porque event.target puede ser null
event.target !== currentClickRef.current
) {
handleCloseModal();
handleCloseNotifications();
}
};

document.addEventListener("mousedown", handleClickOutside);

return () => {
document.removeEventListener("mousedown", handleClickOutside);
};
}, []);

useEffect(() => {
socket.on("new_adoption", (adoption) => {
console.log("Nueva adopción:", adoption);
if (adoption) {
// Asegúrate de que post no sea null
// setNotifications((prevNotifications) => [
// ...prevNotifications,
// { id: post.id, message: `Nuevo post: ${post.title}` },
// ]);
}
});

return () => {
socket.off("new_post");
};
}, []);

return (
<header
Expand Down Expand Up @@ -147,7 +192,7 @@ const Navbar: React.FC = () => {
>
<PersonIcon className="text-[#4BAF47] text[20px]" />
</div>
<div className="p-[6px] bg-white border border-gray-300 rounded-full ml-2 cursor-pointer">
<div onClick={handleShowNotifications} className="p-[6px] bg-white border border-gray-300 rounded-full ml-2 cursor-pointer">
<NotificationsIcon className="text-[#4BAF47] text[20px]" />
</div>

Expand Down Expand Up @@ -195,15 +240,28 @@ const Navbar: React.FC = () => {
</div>
</div>
)}
{notificationsModal && (
<div
className="absolute md:top-[3.8rem] desktop:top-[4.1rem] w-[14rem] bg-white gap-4 md:right-[50px] desktop:right-[185px] px-1 min-h-[7.8rem] rounded shadow-md"
ref={modalRef}>
<div className="flex flex-col items-center">
<h5 className="text-base font-medium text-[#05264E] mt-5">Your Notifications</h5>
{/* {notifications && (
<div className="w-full">
<ul>
{notifications.map((notification) => (
<></>
))}
</ul>
</div>
)} */}
</div>
</div>
)}
</div>
)}
</div>
</div>

{/* <div className="md:flex items-center mobile:hidden ">
<AccountCircleIcon />
<CircleNotificationsIcon />
</div> */}
</div>
</header>
);
Expand Down
Loading

2 comments on commit b47558e

@emacuello
Copy link
Collaborator

Choose a reason for hiding this comment

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

Deploy preview for adoptree ready!

✅ Preview
https://adoptree-1pjvz9npt-emanuels-projects-e0d75c1b.vercel.app

Built with commit b47558e.
This pull request is being automatically deployed with vercel-action

@emacuello
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sign in to comment.