Skip to content

Commit

Permalink
updated ingredient card cleaned up a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
WTanardi committed Jun 6, 2023
1 parent 6697fdf commit 9e68ab0
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/dashboard/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export default function AdminDashboard() {
{/* Ingredient list table */}
<>
<div className="flex justify-between py-8">
<p className="text-5xl font-bold">Ingredients</p>
<p className="text-5xl lg:text-6xl font-bold">Ingredients</p>
<button
className="px-3 lg:p-4 border-rose-600 rounded-xl bg-rose-600"
onClick={handleIngredientAddModal}
Expand Down
2 changes: 1 addition & 1 deletion app/dashboard/user/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default function UserDashboard() {
<button className="absolute inset-y-0 right-0 px-4 py-1 text-gray-300 font-medium rounded-md focus:outline-none">
<Search />
</button>
</div>
</div>
</div>
{/* <!-- Pantry Content --> */}
<div className="flex flex-col md:flex-row md:flex-wrap gap-8 md:justify-center items-center p-8 overflow-y-auto">
Expand Down
11 changes: 10 additions & 1 deletion app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ type Props = {
};

export const NextAuthProvider = ({ children }: Props) => {
return <SessionProvider>{children}</SessionProvider>;
return (
<SessionProvider
// Re-fetch session every 5 minutes
refetchInterval={5 * 60}
// Re-fetches session when window is focused
refetchOnWindowFocus={true}
>
{children}
</SessionProvider>
);
};
17 changes: 14 additions & 3 deletions components/IngredientCard.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
"use client";
import React, { FC, useState } from "react";
import Image, { StaticImageData } from "next/image";
import { FC, useState } from "react";
import Image from "next/image";

interface IngredientProps {
name: string;
}

const Ingredient: FC<IngredientProps> = ({ name }) => {
const [userHas, setUserHas] = useState(false);
const handleClick = () => {
setUserHas(!userHas);
};
return (
<>
<div className="text-white text-sm rounded-md border-x-8 border-y-4 bg-emerald-500 border-emerald-500">
<div
className={`text-white text-sm rounded-md border-x-8 border-y-4 select-none ${
userHas
? "bg-emerald-500 border-emerald-500"
: "bg-gray-400 border-gray-400"
}`}
onClick={handleClick}
>
{name}
</div>
</>
Expand Down
10 changes: 5 additions & 5 deletions components/RecipeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const RecipeCard: FC<Recipe> = ({ name, img, ingredients, step }) => {
{/* Card Image */}
<div>
<Image
src={img ?? ""}
src={img ?? "https://picsum.photos/200"}
alt={`${name} recipe`}
width={96}
height={96}
Expand All @@ -56,16 +56,16 @@ const RecipeCard: FC<Recipe> = ({ name, img, ingredients, step }) => {
</div>
{/* Modal */}
<div className={isOpen ? "modal modal-open" : "modal"}>
<div className="modal-box">
<div className="modal-box p-0">
<Image
src={img ?? ""}
src={img ?? "https://picsum.photos/200"}
alt={`${name} image`}
width={350}
height={350}
className="w-full h-36 object-cover"
/>
<div className="text-sm">
<h2 className="text-2xl font-bold my-4">{name}</h2>
<div className="text-sm p-6">
<h2 className="text-2xl font-bold mb-4">{name}</h2>
<h3 className="font-semibold mb-2">Ingredients:</h3>
<ul className="mb-4">
{ingredients.map((e, i) => (
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const nextConfig = {
},
swcMinify: true,
images: {
domains: ["source.unsplash.com"],
domains: ["source.unsplash.com", "picsum.photos"],
},
};

Expand Down
16 changes: 9 additions & 7 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ datasource db {
}

model User {
name String
email String @unique
isAdmin Boolean @default(false)
password String
id Int @id @default(autoincrement())
orders Order[]
name String
email String @unique
isAdmin Boolean @default(false)
password String
id Int @id @default(autoincrement())
orders Order[]
ingredients Ingredient[]
}

model Category {
Expand All @@ -32,6 +33,7 @@ model Ingredient {
categoryId Int
category Category @relation(fields: [categoryId], references: [id])
recipes IngredientsOnRecipes[]
users User[]
}

model Recipe {
Expand Down Expand Up @@ -71,4 +73,4 @@ model Payment {
orderId Int @unique
isPaid Boolean @default(false)
order Order @relation(fields: [orderId], references: [id])
}
}

1 comment on commit 9e68ab0

@vercel
Copy link

@vercel vercel bot commented on 9e68ab0 Jun 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

pantry-pilot-2 – ./

pantry-pilot-2-git-main-wtanardi.vercel.app
pantry-pilot-2-wtanardi.vercel.app
pantry-pilot-2.vercel.app

Please sign in to comment.