Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
onehanddev committed Nov 21, 2024
1 parent c94e98a commit e6775ca
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 67 deletions.
7 changes: 5 additions & 2 deletions client/src/app/(overview)/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export const popupAtom = atom<{
features: MapMouseEvent["features"];
} | null>(null);

export const projectDetailsAtom = atom<{ isOpen: boolean; projectName: string }>({
export const projectDetailsAtom = atom<{
isOpen: boolean;
projectName: string;
}>({
isOpen: false,
projectName: "",
});
});
117 changes: 66 additions & 51 deletions client/src/containers/overview/project-details/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { ChevronUp, ChevronDown, Plus } from "lucide-react";
import { useAtom } from "jotai";
import { ChevronUp, ChevronDown, Plus } from "lucide-react";

import {
renderCurrency,
formatCurrency,
renderAbatementCurrency,
} from "@/lib/format";

import { projectDetailsAtom } from "@/app/(overview)/store";
import { renderCurrency, formatCurrency, renderAbatementCurrency } from "@/lib/format";

import BarChart from "@/components/ui/bar-chart";
import ParametersProjects from "@/containers/overview/project-details/parameters";

import BarChart from "@/components/ui/bar-chart";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Label } from "@/components/ui/label";
import {
Sheet,
SheetContent,
SheetHeader,
SheetTitle,
} from "@/components/ui/sheet";
import { Label } from "@/components/ui/label";


//////// ScoreIndicator component ////////
interface ScoreIndicatorProps {
Expand Down Expand Up @@ -151,13 +155,13 @@ export default function ProjectDetails() {
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-2">
<div className="flex items-center gap-2">

<Label
htmlFor="totalProjectCost"
className="font-medium text-md"
className="text-md font-medium"
tooltip={{
title: "Total project cost",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Total project cost</h3>
Expand All @@ -169,7 +173,7 @@ export default function ProjectDetails() {
</div>
</div>
</div>
<div className="flex gap-4 min-h-[160px]">
<div className="flex min-h-[160px] gap-4">
<div className="flex flex-col justify-between">
<div>
<span className="text-xl font-normal">
Expand Down Expand Up @@ -216,10 +220,11 @@ export default function ProjectDetails() {
<div className="flex items-center gap-2">
<Label
htmlFor="totalProjectCost"
className="font-medium text-md"
className="text-md font-medium"
tooltip={{
title: "Total project cost",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Total project cost</h3>
Expand All @@ -231,7 +236,7 @@ export default function ProjectDetails() {
</div>
</div>
</div>
<div className="flex gap-4 min-h-[160px]">
<div className="flex min-h-[160px] gap-4">
<div className="flex flex-col justify-between">
<div>
<span className="text-xl font-normal">
Expand Down Expand Up @@ -277,15 +282,16 @@ export default function ProjectDetails() {
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Label
htmlFor="abatementPotential"
className="font-medium text-md"
tooltip={{
title: "Abatement potential",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
}}
>
<h3 className="text-md">Abatement potential</h3>
</Label>
htmlFor="abatementPotential"
className="text-md font-medium"
tooltip={{
title: "Abatement potential",
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Abatement potential</h3>
</Label>
</div>
<span className="text-xl font-normal">
{renderAbatementCurrency(projectData.abatement)}
Expand All @@ -300,15 +306,16 @@ export default function ProjectDetails() {
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Label
htmlFor="overallScore"
className="font-medium text-md"
tooltip={{
title: "Overall score",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
}}
>
<h3 className="text-md">Overall score</h3>
</Label>
htmlFor="overallScore"
className="text-md font-medium"
tooltip={{
title: "Overall score",
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Overall score</h3>
</Label>
</div>
</div>
<div className="mt-4 space-y-2">
Expand All @@ -323,18 +330,21 @@ export default function ProjectDetails() {
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<Label
htmlFor="scorecardRatings"
className="font-medium text-md"
tooltip={{
title: "Scorecard ratings",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
}}
>
<h3 className="text-md">Scorecard ratings</h3>
</Label>
htmlFor="scorecardRatings"
className="text-md font-medium"
tooltip={{
title: "Scorecard ratings",
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Scorecard ratings</h3>
</Label>
</div>
<div className="flex items-center gap-2">
<Label className="text-xs text-big-stone-200">Compare with a different project</Label>
<Label className="text-xs text-big-stone-200">
Compare with a different project
</Label>
<Button
variant="outline"
className="h-8 w-8 p-0 hover:bg-transparent"
Expand All @@ -354,7 +364,9 @@ export default function ProjectDetails() {
score={item.rating as "High" | "Medium" | "Low"}
/>
</div>
{projectData.scorecard.length !== index + 1 && <hr className="m-0" />}
{projectData.scorecard.length !== index + 1 && (
<hr className="m-0" />
)}
</>
))}
</div>
Expand All @@ -364,18 +376,21 @@ export default function ProjectDetails() {
<div className="flex items-center justify-between p-4 py-2">
<div className="flex items-center gap-2">
<Label
htmlFor="costEstimates"
className="font-medium text-md"
tooltip={{
title: "Cost estimates",
content: 'Refers to the summary of Capital Expenditure and Operating Expenditure',
}}
>
<h3 className="text-md">Cost estimates</h3>
</Label>
htmlFor="costEstimates"
className="text-md font-medium"
tooltip={{
title: "Cost estimates",
content:
"Refers to the summary of Capital Expenditure and Operating Expenditure",
}}
>
<h3 className="text-md">Cost estimates</h3>
</Label>
</div>
<div className="flex items-center gap-2">
<Label className="text-xs text-big-stone-200">Compare with a different project</Label>
<Label className="text-xs text-big-stone-200">
Compare with a different project
</Label>
<Button
variant="outline"
className="h-8 w-8 p-0 hover:bg-transparent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import {
COST_TYPE_SELECTOR,
PROJECT_PRICE_TYPE,
} from "@shared/entities/projects.entity";
import { z } from "zod";
import { parseAsJson, useQueryState } from "nuqs";
import { z } from "zod";

import { FILTER_KEYS, INITIAL_ABATEMENT_POTENTIAL_RANGE, INITIAL_COST_RANGE } from "@/app/(overview)/constants";
import {
FILTER_KEYS,
INITIAL_ABATEMENT_POTENTIAL_RANGE,
INITIAL_COST_RANGE,
} from "@/app/(overview)/constants";
import { filtersSchema } from "@/app/(overview)/url-store";

import { Label } from "@/components/ui/label";
Expand Down
7 changes: 3 additions & 4 deletions client/src/containers/overview/table/view/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ import { useState } from "react";
import { ChevronDownIcon, ChevronUpIcon } from "@radix-ui/react-icons";
import { projectsQuerySchema } from "@shared/contracts/projects.contract";
import { keepPreviousData } from "@tanstack/react-query";
import { useAtom } from "jotai";
import {
flexRender,
getCoreRowModel,
PaginationState,
SortingState,
useReactTable,
} from "@tanstack/react-table";
import { useAtom } from "jotai";
import { ChevronsUpDownIcon } from "lucide-react";
import { z } from "zod";

import { client } from "@/lib/query-client";
import { queryKeys } from "@/lib/query-keys";
import { cn } from "@/lib/utils";

import { projectDetailsAtom } from "@/app/(overview)/store";
import { useGlobalFilters, useTableView } from "@/app/(overview)/url-store";

import { projectDetailsAtom } from "@/app/(overview)/store";
import ProjectDetails from "@/containers/overview/project-details";
import {
filtersToQueryParams,
Expand Down Expand Up @@ -110,8 +110,7 @@ export function OverviewTable() {

return (
<>
<ProjectDetails
/>
<ProjectDetails />
<Table>
<TableHeader className="sticky top-0">
{table.getHeaderGroups().map((headerGroup) => (
Expand Down
15 changes: 7 additions & 8 deletions client/src/lib/format.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ export const renderAbatementCurrency = (
const [, amount] = formatted.match(/^(\D*)(.+)$/)!.slice(1);
return (
<>
<span
className={"inline-block align-top text-xs text-muted-foreground"}
>
tCO2e/yr &nbsp;
</span>
{amount}
</>);
<span className={"inline-block align-top text-xs text-muted-foreground"}>
tCO2e/yr &nbsp;
</span>
{amount}
</>
);
};

export function renderCurrency(
Expand All @@ -57,7 +56,7 @@ export function renderCurrency(
}

/**
* Converts a large numeric value into a compact format with an "M" suffix
* Converts a large numeric value into a compact format with an "M" suffix
* representing millions.
*
* @param {number} value - The numeric value to be converted.
Expand Down

0 comments on commit e6775ca

Please sign in to comment.