Skip to content

Commit

Permalink
Merge pull request #177 from pathirny/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
PurpleNurps authored Dec 21, 2023
2 parents 78e2235 + 5c6885c commit 8a115e1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
29 changes: 26 additions & 3 deletions harvesthub/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ hr {
black calc(100% - 48px),
transparent 100%
);
height: 45.5rem;
max-height: 45.5rem;
overflow: scroll;
margin-bottom: 4rem;
}
Expand Down Expand Up @@ -678,7 +678,7 @@ hr {
background-color: var(--light-green-color);
border: 3vw solid var(--dark-green-color);
border-radius: 1vw;
color: var(--dark-green-color);
color: var(--white-cream-color);
}

.fc-daygrid-day-frame {
Expand Down Expand Up @@ -856,7 +856,7 @@ hr {
width: 80vw;
align-items: center;
display: flex;
height: 20vh;
height: 30vh;
}

.tipContainerTwo {
Expand Down Expand Up @@ -1393,5 +1393,28 @@ hr {
border: 1px solid #f3ebe4;
}


.calendar-list button{

}

#user-message{
text-align: center;
color: var(--dark-green-color);
}

#user-message-container{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 2vw;
background-color: rgba(243, 235, 228, .8);
border-radius: 3vw;
margin: 10%;
margin-top: 20vh;
}
=======
.calendar-list button {
}

14 changes: 10 additions & 4 deletions harvesthub/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


import Link from "next/link";
// importing dependancys
import { headers, cookies } from "next/headers";
Expand All @@ -11,6 +13,7 @@ export default function Login({
}: {
searchParams: { message: string };
}) {

const signIn = async (formData: FormData) => {
"use server";
// storing sign in data in varibales
Expand All @@ -25,8 +28,8 @@ export default function Login({
});

if (error) {
return redirect("/login?message=Could not authenticate user");
alert("Could not authenticate user");

return redirect("/userMessage/User cannot be authenticated. Please ensure username and password are correct.");
}

return redirect("/");
Expand All @@ -51,10 +54,12 @@ export default function Login({

if (error) {
console.log(error);
return redirect("/login?message=Could not authenticate user");

return redirect("/userMessage/User cannot be authenticated. Please Try again.");
}


return redirect("/login?message=Check email to continue sign in process");
return redirect("/userMessage/Please check your email to continue sign up");
};
// rendering user data inputs and sign in button
return (
Expand Down Expand Up @@ -92,6 +97,7 @@ export default function Login({
<Link href="https://harvest-hub-tau.vercel.app/">
<button>Continue as Guest</button>
</Link>

</div>
);
}
12 changes: 0 additions & 12 deletions harvesthub/app/tips-and-tricks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ export default function TipsnTricks() {
getTips();
}
useEffect(() => {
//render the tips using supabase query
// async function getTips() {
// let { data: tips, error } = await supabase.from("tips").select("*");
// // set the state of tips and filteredTips
// if (tips) {
// setGardeningTips(tips);
// setFilteredTips(tips);
// console.log(tips);
// } else {
// console.log(error);
// }
// }
viewTips();
}, []); // empty dependency so it loads on render

Expand Down
12 changes: 12 additions & 0 deletions harvesthub/app/userMessage/[auth]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Link from "next/link"
import { useEffect } from "react"

export default function checkEmailPage({ params } : any){

return(<>
<div id="user-message-container">
<h3 id="user-message"> {params.auth.replace(/%20/g, " ")}</h3>
<Link href="/login"><button>Back</button></Link>
</div>
</>)
}
7 changes: 2 additions & 5 deletions harvesthub/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default function Header({ title }: any) {
);

useEffect(() => {

async function getUserImg() {
console.log("hello");
let { data: userImg, error } = await supabase
Expand All @@ -30,7 +31,7 @@ export default function Header({ title }: any) {
}
}
getUserImg();
}, []);
}, [signedIn]);

return (
<>
Expand All @@ -50,10 +51,6 @@ export default function Header({ title }: any) {
width="500"
height="500"
className="userImg"
// style={{
// width: "10vw",
// height: "auto",
// }}
alt="the Users profile"
/>
</div>
Expand Down
11 changes: 7 additions & 4 deletions harvesthub/components/TipCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { gardeningTipsType } from "@/app/tips-and-tricks/renderTips";
import { FaHeartCircleCheck } from "react-icons/fa6";
import { createBrowserClient } from "@supabase/ssr";
import { useEffect, useState } from "react";
import useCheckSignedIn from "./hooks/useCheckSignedIn";
// 1 - Style card with border etc.
// 2 - Create a data.json file in same folder as tnt
// 3 - Create a function to map through the array of tips and render a card for each one
Expand All @@ -31,8 +32,10 @@ export const TipCard: React.FC<TipCardtip> = ({ tip }) => {
);
// sets state (if tip is favourited or not)
const [favourited, setFavourited] = useState(false);
const [signedIn] = useCheckSignedIn()

useEffect(() => {

async function apiCall(idIn: number) {
console.log(idIn);
//checks if tip is in the favourties page and render empty heart if its not there, and filled heart if it is
Expand All @@ -52,7 +55,7 @@ export const TipCard: React.FC<TipCardtip> = ({ tip }) => {
}

apiCall(tip.id);
}, []);
}, [signedIn]);
// adds selected tip to user's favourited list
function favTip() {
async function apiCall(idIn: any) {
Expand Down Expand Up @@ -105,14 +108,14 @@ export const TipCard: React.FC<TipCardtip> = ({ tip }) => {
</CardHeader>
</Card>
</Link>

<IconButton
{signedIn ? <IconButton
style={{ margin: "0" }}
aria-label="Add to favourites"
onClick={favTip}
className="favButton"
icon={favourited ? <FaHeartCircleCheck /> : <CiHeart />}
/>
/> : <></>}

</div>
</>
);
Expand Down

0 comments on commit 8a115e1

Please sign in to comment.