mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
adding missing feature table columns
This commit is contained in:
parent
13c2fb5ac1
commit
e762584a66
1 changed files with 50 additions and 0 deletions
50
src/app/components/building-passport/FeatureTableColumns.tsx
Normal file
50
src/app/components/building-passport/FeatureTableColumns.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use client";
|
||||
|
||||
import { Feature, GeneralFeature, Rating } from "@/app/db/schema/property";
|
||||
import { Badge } from "@/app/shadcn_components/ui/badge";
|
||||
import { ColumnDef } from "@tanstack/react-table";
|
||||
|
||||
function RatingBadge({ rating }: { rating: Rating }) {
|
||||
const colourMap = {
|
||||
"Very good": "bg-green-500 hover:bg-green-600",
|
||||
Good: "bg-green-300 hover:bg-green-400",
|
||||
Poor: "bg-yellow-300 hover:bg-yellow-400",
|
||||
"Very poor": "bg-red-500 hover:bg-red-600",
|
||||
"N/A": "bg-gray-500 hover:bg-gray-600",
|
||||
};
|
||||
const ratingConfig = colourMap[rating];
|
||||
return <Badge className={ratingConfig}>{rating}</Badge>;
|
||||
}
|
||||
|
||||
export const retrofitColumns: ColumnDef<Feature>[] = [
|
||||
{
|
||||
accessorKey: "feature",
|
||||
header: "Feature",
|
||||
},
|
||||
{
|
||||
accessorKey: "description",
|
||||
header: "Description",
|
||||
},
|
||||
{
|
||||
accessorKey: "rating",
|
||||
header: "Rating",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<div className="">
|
||||
<RatingBadge rating={row.getValue("rating")} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const generalColumns: ColumnDef<GeneralFeature>[] = [
|
||||
{
|
||||
accessorKey: "feature",
|
||||
header: "Feature",
|
||||
},
|
||||
{
|
||||
accessorKey: "description",
|
||||
header: "Description",
|
||||
},
|
||||
];
|
||||
Loading…
Add table
Reference in a new issue