-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add edit functionality * Remove old add recipe form * Remove meta data from recipe edit page * Fix code smells * Fix all type errors and formatted files
- Loading branch information
1 parent
72a757e
commit 8d9ea5d
Showing
25 changed files
with
624 additions
and
379 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
5 changes: 5 additions & 0 deletions
5
src/app/(dashboard)/dashboard/recipe/[recipeId]/edit/loading.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,5 @@ | ||
import { RecipeSkeleton } from '@/components/skeleton/RecipeSkeleton'; | ||
|
||
export default function RecipeLoading() { | ||
return <RecipeSkeleton />; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/app/(dashboard)/dashboard/recipe/[recipeId]/edit/not-found.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,15 @@ | ||
import { ErrorCard } from '@/components/cards/error-card'; | ||
import { Shell } from '@/components/shells/shell'; | ||
|
||
export default function RecipeNotFound() { | ||
return ( | ||
<Shell variant="centered" className="max-w-md"> | ||
<ErrorCard | ||
title="Recipe not found" | ||
description="The recipe you are looking for does not exist." | ||
retryLink="/recipes" | ||
retryLinkText="Go to Recipes" | ||
/> | ||
</Shell> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/app/(dashboard)/dashboard/recipe/[recipeId]/edit/page.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,48 @@ | ||
import { serverClient } from '@/app/_trpc/serverClient'; | ||
import { EditRecipeForm } from '@/components/forms/recipe/UpdateRecipeForm'; | ||
import { Breadcrumbs } from '@/components/pagers/breadcrumbs'; | ||
import { Shell } from '@/components/shells/shell'; | ||
import { currentUser } from '@clerk/nextjs/server'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
interface ProductPageProps { | ||
params: { | ||
recipeId: string; | ||
}; | ||
} | ||
|
||
export default async function RecipeEditPage({ | ||
params, | ||
}: Readonly<ProductPageProps>) { | ||
if (!params.recipeId) { | ||
notFound(); | ||
} | ||
|
||
const user = await currentUser(); | ||
|
||
const recipe = await serverClient.recipe | ||
.getRecipe({ id: params.recipeId }) | ||
.catch(() => null); | ||
|
||
if (!recipe || !user || recipe.userId !== user.id) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<Shell> | ||
<Breadcrumbs | ||
segments={[ | ||
{ | ||
title: 'My Recipes', | ||
href: '/dashboard/recipes', | ||
}, | ||
{ | ||
title: recipe.title, | ||
href: `/dashboard/recipe/${recipe.id}`, | ||
}, | ||
]} | ||
/> | ||
<EditRecipeForm recipeId={recipe.id} initialRecipe={recipe} /> | ||
</Shell> | ||
); | ||
} |
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
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
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
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
Oops, something went wrong.
8d9ea5d
There was a problem hiding this comment.
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:
mealtime – ./
momentmeal.com
mealtime-git-master-mealtime.vercel.app
mealtime-mealtime.vercel.app
www.momentmeal.com