diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/page.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/page.tsx index a22a48fe..4d540338 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/page.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/page.tsx @@ -4,8 +4,8 @@ import { TeamsCardList } from "@/components/Teams/TeamsCardList"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { getOrganizationTitle } from "@/data/user/organizations"; -import { getProjects } from "@/data/user/projects"; -import { getTeams } from "@/data/user/teams"; +import { getAllProjectsInOrganization } from "@/data/user/projects"; +import { getSlimTeamById, getTeams } from "@/data/user/teams"; import { organizationParamSchema, projectsfilterSchema @@ -27,12 +27,19 @@ async function Projects({ organizationId: string; filters: z.infer; }) { - const projects = await getProjects({ + const projects = await getAllProjectsInOrganization({ organizationId, - teamId: null, ...filters, }); - return ; + const projectWithTeamNames = await Promise.all(projects.map(async (project) => { + if (project.team_id) { + const team = await getSlimTeamById(project.team_id); + const projectWithTeamName = { ...project, teamName: team.name }; + return projectWithTeamName; + } + return project; + })); + return ; } async function Teams({ organizationId, diff --git a/src/components/Projects/ProjectsCardList.tsx b/src/components/Projects/ProjectsCardList.tsx index 852caf1c..4f5d7d82 100644 --- a/src/components/Projects/ProjectsCardList.tsx +++ b/src/components/Projects/ProjectsCardList.tsx @@ -7,6 +7,7 @@ import { format } from "date-fns"; import { motion } from "framer-motion"; import { CalendarDays, Clock, Link as LinkIcon } from "lucide-react"; import Link from "next/link"; +import { Badge } from "../ui/badge"; export enum ProjectStatus { draft = "draft", @@ -40,11 +41,13 @@ const itemVariants = { visible: { opacity: 1, y: 0 }, }; +type ProjectCardsProps = { + projects: (Table<"projects"> & { teamName?: string })[]; +} + export const ProjectsCardList = ({ projects, -}: { - projects: Table<"projects">[]; -}) => { +}: ProjectCardsProps) => { if (projects.length === 0) { return (

@@ -69,6 +72,7 @@ export const ProjectsCardList = ({ ID: {project.id.slice(0, 7)} + {project.teamName} {project.name}