-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { Recipe } from "../components/Recipe"; | ||
import { FullscreenLoading } from "../components/FullscreenLoading"; | ||
import { Alert, AlertDescription, AlertTitle } from "../components/ui/alert"; | ||
import { AlertCircle, Filter } from "lucide-react"; | ||
Check warning on line 5 in frontend/src/routes/bookmarks.tsx GitHub Actions / build
|
||
import { useNavigate } from "react-router-dom"; | ||
import { useGetMe } from "../services/api/semanticBrowseComponents"; | ||
import { renderError } from "../services/api/semanticBrowseFetcher"; | ||
|
||
// Inside the Bookmarks component | ||
export const Bookmarks = () => { | ||
const navigate = useNavigate(); | ||
Check warning on line 12 in frontend/src/routes/bookmarks.tsx GitHub Actions / build
|
||
const { data: bookmarksData, isLoading, error } = useGetMe({}); | ||
|
||
if (isLoading) { | ||
return <FullscreenLoading overlay />; | ||
} | ||
|
||
if (error) { | ||
return ( | ||
<div className="container flex flex-col gap-2 py-8"> | ||
<Alert variant="destructive"> | ||
<AlertCircle className="h-4 w-4" /> | ||
<AlertTitle>Error</AlertTitle> | ||
<AlertDescription>{renderError(error)}</AlertDescription> | ||
</Alert> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="container flex flex-col gap-2 py-8"> | ||
<div className="mt-4 flex justify-between items-center"> | ||
<h1 className="text-2xl font-bold text-center">Bookmarks</h1> | ||
<p>{bookmarksData?.data?.bookmarks && ( | ||
<span className="text-gray-500"> {bookmarksData.data?.bookmarks.length} recipes</span> | ||
)}</p> | ||
</div> | ||
<div className="mt-4 grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-4"> | ||
{bookmarksData?.data?.bookmarks?.map((recipe) => ( | ||
<Recipe | ||
key={recipe.id} | ||
recipe={recipe} | ||
/> | ||
))} | ||
</div> | ||
</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