-
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 #62 from hubcio2115/feat/update-project-list-to-fe…
…tch-them-from-api Update project list to fetch them from api
- Loading branch information
Showing
23 changed files
with
2,497 additions
and
2,643 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
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
apps/web/src/app/api/organizations/[name]/projects/route.ts
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,28 @@ | ||
import { redirect } from "next/navigation"; | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { | ||
getOrganizationProjects, | ||
getOwnOrganizationByName, | ||
} from "~/server/actions/organization"; | ||
|
||
export async function GET( | ||
req: NextRequest, | ||
{ params }: { params: { name: string } }, | ||
) { | ||
const [organization, err] = await getOwnOrganizationByName(params.name); | ||
|
||
if (err !== null) { | ||
if (err === "Not found") { | ||
return redirect("404"); | ||
} | ||
|
||
return NextResponse.json( | ||
{ message: "Could fetch project." }, | ||
{ status: 500 }, | ||
); | ||
} | ||
|
||
const projects = await getOrganizationProjects(organization.id); | ||
|
||
return NextResponse.json(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
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,24 +1,25 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
import { useEffect } from "react"; | ||
import Link from "next/link"; | ||
import { Button } from "~/components/ui/button"; | ||
|
||
export default function Error({ | ||
export default function ErrorPage({ | ||
error, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) { | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
console.error(error); | ||
}, [error]); | ||
console.error(error); | ||
|
||
return ( | ||
<div> | ||
<h2>Something went wrong! :(</h2> | ||
<button onClick={() => router.push("/")}>Go back to homepage</button> | ||
|
||
<pre>{JSON.stringify(error)}</pre> | ||
|
||
<Link href="/"> | ||
<Button>Go back to homepage</Button> | ||
</Link> | ||
</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
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,27 @@ | ||
import { | ||
Card, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "~/components/ui/card"; | ||
import type { Project } from "~/lib/validators/project"; | ||
|
||
interface ProjectCardProps { | ||
project: Project; | ||
} | ||
|
||
export default function VideoCard({ project }: ProjectCardProps) { | ||
return ( | ||
<Card className="max-w-[460px] hover:cursor-pointer hover:bg-slate-50"> | ||
<CardHeader> | ||
<CardTitle className="h-6 text-base sm:text-2xl"> | ||
{project.title} | ||
</CardTitle> | ||
|
||
<CardDescription className="h-10 overflow-hidden"> | ||
{project.description} | ||
</CardDescription> | ||
</CardHeader> | ||
</Card> | ||
); | ||
} |
Oops, something went wrong.