-
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.
feat(app): integrate project db data into web app. Also set up suspen…
…se for projects.
- Loading branch information
Showing
13 changed files
with
187 additions
and
193 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,12 @@ | ||
'use server'; | ||
|
||
import { Project } from '@/models'; | ||
import { revalidatePath } from 'next/cache'; | ||
|
||
export const action = async () => { | ||
const projects = await Project.getProjects(); | ||
|
||
revalidatePath('/projects'); | ||
|
||
return projects; | ||
}; |
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,19 @@ | ||
import Loading from './loading'; | ||
import { Suspense } from 'react'; | ||
|
||
type ProjectsLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default async function ProjectsLayout({ | ||
children | ||
}: ProjectsLayoutProps) { | ||
return ( | ||
<div className='container mx-auto px-4 py-8'> | ||
<h1 className='mb-8 text-3xl font-bold'>My Projects</h1> | ||
<div className='grid grid-cols-1 gap-6 md:grid-cols-2'> | ||
<Suspense fallback={<Loading />}>{children}</Suspense> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ProjectSkeleton } from '@/components/project-skeleton'; | ||
|
||
export default async function Loading() { | ||
return <ProjectSkeleton />; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle | ||
} from '@/components/ui/card'; | ||
|
||
import { Skeleton } from '@/components/ui/skeleton'; | ||
|
||
export const ProjectSkeleton = () => ( | ||
<Card className='flex flex-col'> | ||
<CardHeader> | ||
<CardTitle className='flex items-center justify-between'> | ||
<Skeleton className='animate-shimmer h-6 w-3/4' /> | ||
<div className='flex flex-row space-x-2'> | ||
<Skeleton className='animate-shimmer h-4 w-4 rounded-full' /> | ||
<Skeleton className='animate-shimmer h-4 w-4 rounded-full' /> | ||
</div> | ||
</CardTitle> | ||
<CardDescription> | ||
<Skeleton className='animate-shimmer h-4 w-full' /> | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent className='flex-grow'> | ||
<h3 className='mb-2 font-semibold'>Key Achievements:</h3> | ||
<ul className='mb-4 list-inside list-disc space-y-1'> | ||
<li> | ||
<Skeleton className='animate-shimmer h-4 w-full' /> | ||
</li> | ||
<li> | ||
<Skeleton className='animate-shimmer h-4 w-11/12' /> | ||
</li> | ||
<li> | ||
<Skeleton className='animate-shimmer h-4 w-10/12' /> | ||
</li> | ||
</ul> | ||
<div> | ||
<h3 className='mb-2 font-semibold'>Technologies Used:</h3> | ||
<div className='flex flex-wrap gap-2'> | ||
{[1, 2, 3, 4].map((i) => ( | ||
<Skeleton key={i} className='animate-shimmer h-6 w-16' /> | ||
))} | ||
</div> | ||
</div> | ||
</CardContent> | ||
</Card> | ||
); |
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.