refactor: link to real deals data

This commit is contained in:
sirin 2024-10-09 07:47:12 +07:00
parent e78e62dbe5
commit 5bdeef67e0
4 changed files with 18 additions and 15 deletions

View File

@ -102,7 +102,7 @@ export default async function ProjectDealPage({ params }: { params: { id: number
<p> Left to invest</p> <p> Left to invest</p>
</span> </span>
<Button className="mt-5 w-3/4 h-12"> <Button className="mt-5 w-3/4 h-12">
<Link href="/invest">Invest in NVIDIA</Link> <Link href={`/invest/${params.id}`}>Invest in {projectData?.project_name}</Link>
</Button> </Button>
</div> </div>
</div> </div>

View File

@ -11,6 +11,7 @@ import { useQuery } from "@supabase-cache-helpers/postgrest-react-query";
import { searchProjectsQuery, FilterParams, FilterProjectQueryParams } from "@/lib/data/projectQuery"; import { searchProjectsQuery, FilterParams, FilterProjectQueryParams } from "@/lib/data/projectQuery";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import Link from "next/link";
const ProjectSection = ({ filteredProjects }) => { const ProjectSection = ({ filteredProjects }) => {
interface Tags { interface Tags {
@ -31,18 +32,20 @@ const ProjectSection = ({ filteredProjects }) => {
{/* Block for all the deals */} {/* Block for all the deals */}
<div className="mt-10 grid grid-cols-3 gap-4"> <div className="mt-10 grid grid-cols-3 gap-4">
{filteredProjects.map((item, index) => ( {filteredProjects.map((item, index) => (
<ProjectCard <Link key={index} href={`/deals/${item.project_id}`}>
key={index} <ProjectCard
name={item.project_name} key={index}
description={item.project_short_description} name={item.project_name}
joinDate={item.published_time} description={item.project_short_description}
imageUri={item.card_image_url} joinDate={item.published_time}
location={item.business_location} imageUri={item.card_image_url}
minInvestment={item.min_investment} location={item.business_location}
totalInvestor={item.total_investment} minInvestment={item.min_investment}
totalRaised={item.target_investment} totalInvestor={item.total_investment}
tags={item.tags.map((tag: Tags) => tag.tag_name)} totalRaised={item.target_investment}
/> tags={item.tags.map((tag: Tags) => tag.tag_name)}
/>
</Link>
))} ))}
</div> </div>
</div> </div>

View File

@ -23,7 +23,7 @@ const TopProjects = async () => {
return ( return (
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4"> <div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
{topProjectsData.map((project) => ( {topProjectsData.map((project) => (
<Link href={`/overview/${project.id}`} key={project.id}> <Link href={`/deals/${project.id}`} key={project.id}>
<ProjectCard <ProjectCard
name={project.projectName} name={project.projectName}
description={project.projectShortDescription} description={project.projectShortDescription}

View File

@ -89,7 +89,7 @@ function searchProjectsQuery(client: SupabaseClient, {searchTerm, tagsFilter, pr
let query = client.from("Project").select( let query = client.from("Project").select(
` `
id, project_id:id,
project_name:projectName, project_name:projectName,
published_time:publishedTime, published_time:publishedTime,
project_short_description:projectShortDescription, project_short_description:projectShortDescription,