-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from Glider6014:S1-29_Wymog_logowania_na_stron…
…ie_glownej wymog logowania na stronie glownej
- Loading branch information
Showing
3 changed files
with
34 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
"use client"; | ||
import { Navbar } from "@/components/Navbar"; | ||
import SearchPanel from "@/components/SearchPanel"; | ||
import { RecipesList } from "@/components/RecipesList"; | ||
import { useState } from "react"; | ||
import { RecipeType } from "@/models/Recipe"; | ||
import ListIngredientsAndListRecipesSection from "@/components/sections/ListIngredientsAndListRecipesSection"; | ||
import { getServerSession } from "next-auth"; | ||
import { redirect } from "next/navigation"; | ||
import authOptions from "@/lib/nextauth"; | ||
|
||
export default async function Home() { | ||
const session = await getServerSession(authOptions); | ||
|
||
if (!session) { | ||
redirect("/user/signin"); | ||
} | ||
|
||
export default function Home() { | ||
const [recipes, setRecipes] = useState<RecipeType[]>([]); | ||
return ( | ||
<> | ||
<div className="container mx-auto p-4"> | ||
<Navbar /> | ||
<div className="flex flex-col md:flex-row gap-4"> | ||
<SearchPanel setRecipes={setRecipes} /> | ||
<div className="w-full md:w-3/5 mt-4 md:mt-0"> | ||
<RecipesList recipes={recipes} /> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
<div className="container mx-auto p-4"> | ||
<Navbar /> | ||
<ListIngredientsAndListRecipesSection /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
"use client"; | ||
import { Navbar as DropdownMenu } from "@/components/ui/dropdown-menu"; | ||
import { | ||
NavigationMenu, | ||
|
18 changes: 18 additions & 0 deletions
18
components/sections/ListIngredientsAndListRecipesSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use client"; | ||
import SearchPanel from "@/components/SearchPanel"; | ||
import { RecipesList } from "@/components/RecipesList"; | ||
import { RecipeType } from "@/models/Recipe"; | ||
import { useState } from "react"; | ||
|
||
export default function ListIngredientsAndListRecipesSection() { | ||
const [recipes, setRecipes] = useState<RecipeType[]>([]); | ||
|
||
return ( | ||
<div className="flex flex-col md:flex-row gap-4"> | ||
<SearchPanel setRecipes={setRecipes} /> | ||
<div className="w-full md:w-3/5 mt-4 md:mt-0"> | ||
<RecipesList recipes={recipes} /> | ||
</div> | ||
</div> | ||
); | ||
} |