import Image from "next/image"; import Link from "next/link"; import ReactMarkdown from "react-markdown"; import * as Tabs from "@radix-ui/react-tabs"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { Separator } from "@/components/ui/separator"; import { createSupabaseClient } from "@/lib/supabase/serverComponentClient"; import FollowShareButtons from "./followShareButton"; import { getProjectData } from "@/lib/data/projectQuery"; import { getDealList } from "@/app/api/dealApi"; import { sumByKey, toPercentage } from "@/lib/utils"; import { redirect } from "next/navigation"; import { isOwnerOfProject } from "./query"; import { UpdateTab } from "./UpdateTab"; import remarkGfm from "remark-gfm"; import Gallery from "@/components/carousel"; const PHOTO_MATERIAL_ID = 2; export default async function ProjectDealPage({ params }: { params: { id: number } }) { const supabase = createSupabaseClient(); const { data: projectData, error: projectDataError } = await getProjectData(supabase, params.id); const { data: user, error: userError } = await supabase.auth.getUser(); const { data: projectMaterial, error: projectMaterialError } = await supabase .from("project_material") .select("material_url") .eq("project_id", params.id) .eq("material_type_id", PHOTO_MATERIAL_ID); if (projectMaterialError) { console.error("Error while fetching project material" + projectMaterialError); } if (!projectData) { redirect("/deals"); } if (projectDataError) { return (
Error fetching data. Please try again.
Error fetching data. Please try again.
{projectData?.project_short_description}
{toPercentage(totalDealAmount, projectData?.target_investment)}% raised of $ {projectData?.target_investment} max goal
{dealList.length}
Investors
{Math.floor(hourLeft)} hours
Left to invest
> ) : (No deadline
)}{toPercentage(totalDealAmount, projectData?.target_investment)}% raised of $ {projectData?.target_investment} max goal
{dealList.length}
Investors
{Math.floor(hourLeft)} hours
Left to invest
> ) : (No deadline
)}Dataroom
general Content