diff --git a/frontend/src/main-page/Footer.tsx b/frontend/src/main-page/Footer.tsx index 9a029dab..44b05ceb 100644 --- a/frontend/src/main-page/Footer.tsx +++ b/frontend/src/main-page/Footer.tsx @@ -9,11 +9,11 @@ const Footer: React.FC = () => { {FooterText.C4C_Motto} - + {FooterText.C4C} {" "} for{" "} - + {FooterText.Org} diff --git a/frontend/src/main-page/grants/grant-details/CostBenefitAnalysis.tsx b/frontend/src/main-page/grants/grant-details/CostBenefitAnalysis.tsx deleted file mode 100644 index 9e6ab6c1..00000000 --- a/frontend/src/main-page/grants/grant-details/CostBenefitAnalysis.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, { useState } from 'react'; -import { Grant } from '../../../../../middle-layer/types/Grant'; -import '../styles/CostBenefitAnalysis.css'; - -interface CostBenefitAnalysisProps { - grant: Grant; -} - -export const CostBenefitAnalysis: React.FC = ({ grant }) => { - const [hourlyRate, setHourlyRate] = useState(''); - const [timePerReport, setTimePerReport] = useState(''); - const [netBenefit, setNetBenefit] = useState(null); - - const calculateNetBenefit = () => { - console.log('Called calculate') - console.log('hourlyRate state:', hourlyRate) - console.log('timePerReport state:', timePerReport) - const rate = parseFloat(hourlyRate); - const timeReport = parseFloat(timePerReport); - - console.log('Parsed rate:', rate) - console.log('Parsed timeReport:', timeReport) - - // Validation - if (isNaN(rate) || isNaN(timeReport) || rate <= 0 || timeReport <= 0) { - alert('Please enter valid positive numbers for hourly rate and time per report.'); - return; - } - - const reportCount = grant.report_deadlines?.length ?? 0; - const grantAmount = grant.amount; - const estimatedTime = grant.estimated_completion_time | 5; - - console.log('Grant values - Amount:', grantAmount, 'EstTime:', estimatedTime, 'ReportCount:', reportCount); - - // Formula: NetBenefit = GrantAmount - ((EstimatedCompletionTime + ReportCount * TimePerReport) * StaffHourlyRate) - const result = grantAmount - ((estimatedTime + reportCount * timeReport) * rate); - - console.log('Final result:', result); - - setNetBenefit(result); - }; - - const formatCurrency = (amount: number): string => { - return new Intl.NumberFormat('en-US', { - style: 'currency', - currency: 'USD', - maximumFractionDigits: 2 - }).format(amount); - }; - - return ( -
- - -
- {/* Hourly Rate Input */} -
- - setHourlyRate(e.target.value)} - className="w-full h-[42px] px-3 py-4 border border-gray-400 rounded-md bg-grey-150" - /> -
- - {/* Time Per Report Input */} -
- - { - console.log('Time per report changed to:', e.target.value); - setTimePerReport(e.target.value); - }} - className="w-full h-[42px] px-3 py-4 border border-gray-400 rounded-md bg-grey-150" - /> -
- - {/* Calculate Button */} - - - {/* Analysis Button - Shows the net benefit result */} -
- Net Benefit: -
- {netBenefit !== null ? formatCurrency(netBenefit) : 'Analysis'} -
-
-
-
- ); -}; \ No newline at end of file diff --git a/frontend/src/main-page/grants/grant-details/GrantAttributes.tsx b/frontend/src/main-page/grants/grant-details/GrantAttributes.tsx deleted file mode 100644 index b1a3c516..00000000 --- a/frontend/src/main-page/grants/grant-details/GrantAttributes.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import React from 'react'; -import '../styles/GrantAttributes.css'; -import { Grant } from '../../../../../middle-layer/types/Grant'; - -interface GrantAttributesProps { - isEditing: boolean; - curGrant: Grant; - setCurGrant: React.Dispatch>; -} - -export const GrantAttributes: React.FC = ({curGrant, setCurGrant, isEditing}) => { - - // placeholder for now before reworking, will remove redundant useState() - - const handleChange = (event: React.ChangeEvent) => { - const {name, value} = event.target; - - // only modifies the changed field - setCurGrant(curGrant => ({ - ...curGrant, - [name]: value - })); - }; - - return ( -
-
-
Status
- -
-
-
Does BCAN qualify?
- -
-
-
Deadline
- -
-
-
Notification Date
- -
-
-
Report Due:
- -
-
-
Estimated Completion Time:
- -
-
-
Scope Document:
- -
-
-
Grantmaker POC:
- -
-
-
Timeline:
- -
-
- ); -}; diff --git a/frontend/src/main-page/grants/grant-list/GrantItem.tsx b/frontend/src/main-page/grants/grant-list/GrantItem.tsx index 427bec67..3960fd1f 100644 --- a/frontend/src/main-page/grants/grant-list/GrantItem.tsx +++ b/frontend/src/main-page/grants/grant-list/GrantItem.tsx @@ -9,7 +9,7 @@ import { api } from "../../../api"; import { MdOutlinePerson2 } from "react-icons/md"; import Attachment from "../../../../../middle-layer/types/Attachment"; import NewGrantModal from "../new-grant/NewGrantModal"; -import { CostBenefitAnalysis } from "../grant-details/CostBenefitAnalysis"; +import { CostBenefitAnalysis } from "../grant-view/CostBenefitAnalysis"; import ActionConfirmation from "../../../custom/ActionConfirmation"; import { observer } from "mobx-react-lite"; import { fetchGrants } from "../filter-bar/processGrantData"; diff --git a/frontend/src/main-page/grants/grant-list/GrantList.tsx b/frontend/src/main-page/grants/grant-list/GrantList.tsx index be350d1a..b0808215 100644 --- a/frontend/src/main-page/grants/grant-list/GrantList.tsx +++ b/frontend/src/main-page/grants/grant-list/GrantList.tsx @@ -8,7 +8,8 @@ import { HiChevronLeft, HiChevronRight } from "react-icons/hi"; import { ProcessGrantData } from "../filter-bar/processGrantData"; import NewGrantModal from "../new-grant/NewGrantModal"; import { Grant } from "../../../../../middle-layer/types/Grant"; -import { getAppStore } from '../../../external/bcanSatchel/store'; +import { getAppStore } from "../../../external/bcanSatchel/store"; +import GrantView from "../grant-view/GrantView"; const ITEMS_PER_PAGE = 6; @@ -27,24 +28,24 @@ const GrantList: React.FC = observer( currentUserEmail, }) => { const { grants } = ProcessGrantData(); - const {filterStatus} = getAppStore(); + const { filterStatus } = getAppStore(); const [currentPage, setPage] = useState(1); const [showNewGrantModal, setShowNewGrantModal] = useState(false); - // @ts-ignore + // @ts-ignore const [wasGrantSubmitted, setWasGrantSubmitted] = useState(false); const displayedGrants = showOnlyMyGrants ? grants.filter( (grant: Grant) => grant.bcan_poc?.POC_email?.toLowerCase() === - currentUserEmail?.toLowerCase() + currentUserEmail?.toLowerCase(), ) : grants; useEffect(() => { if (selectedGrantId !== undefined && grants.length > 0) { const index = grants.findIndex( - (grant) => grant.grantId === Number(selectedGrantId) + (grant) => grant.grantId === Number(selectedGrantId), ); if (index !== -1) { const targetPage = Math.floor(index / ITEMS_PER_PAGE) + 1; @@ -56,8 +57,8 @@ const GrantList: React.FC = observer( }, [selectedGrantId, grants, currentPage]); useEffect(() => { - setPage(1); - },[filterStatus, showOnlyMyGrants]); + setPage(1); + }, [filterStatus, showOnlyMyGrants]); const count = displayedGrants.length; const startRange = (currentPage - 1) * ITEMS_PER_PAGE; @@ -65,72 +66,93 @@ const GrantList: React.FC = observer( const visibleItems = displayedGrants.slice(startRange, endRange); return ( -
-
- -
- {visibleItems.map((grant) => ( - - ))} - {visibleItems.length === 0 && ( -

- {showOnlyMyGrants - ? "You currently have no grants assigned as BCAN POC." - : "No grants found :("} -

- )} -
-
- { - if (onClearSelectedGrant) { onClearSelectedGrant();}}} - onPageChange={(e) => { - setPage(e.page);}} - > - - - - - - - - {({ pages }) => - pages.map((page, index) => - page.type === "page" ? ( - setPage(page.value)} - aria-label={`Go to page ${page.value}`} - > - {page.value} - - ) : ( - "..." - ) - ) - } - - - - - - - - - {showNewGrantModal && ( - {setShowNewGrantModal(false); setWasGrantSubmitted(true); }} isOpen={showNewGrantModal} /> +
+
+ +
+ {visibleItems.map((grant) => ( +
+ + +
+ ))} + {visibleItems.length === 0 && ( +

+ {showOnlyMyGrants + ? "You currently have no grants assigned as BCAN POC." + : "No grants found :("} +

)} +
- + { + if (onClearSelectedGrant) { + onClearSelectedGrant(); + } + }} + onPageChange={(e) => { + setPage(e.page); + }} + > + + + + + + + + {({ pages }) => + pages.map((page, index) => + page.type === "page" ? ( + setPage(page.value)} + aria-label={`Go to page ${page.value}`} + > + {page.value} + + ) : ( + "..." + ), + ) + } + + + + + + + + + {showNewGrantModal && ( + { + setShowNewGrantModal(false); + setWasGrantSubmitted(true); + }} + isOpen={showNewGrantModal} + /> + )} +
); - } + }, ); export default GrantList; diff --git a/frontend/src/main-page/grants/grant-list/GrantStatus.tsx b/frontend/src/main-page/grants/grant-list/GrantStatus.tsx deleted file mode 100644 index dd630444..00000000 --- a/frontend/src/main-page/grants/grant-list/GrantStatus.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export function isActiveStatus(status: string): boolean { - return ["Pending", "In Review", "Awaiting Submission"].includes(status); -} - - diff --git a/frontend/src/main-page/grants/grant-list/StatusIndicator.tsx b/frontend/src/main-page/grants/grant-list/StatusIndicator.tsx index 5344a319..884176a2 100644 --- a/frontend/src/main-page/grants/grant-list/StatusIndicator.tsx +++ b/frontend/src/main-page/grants/grant-list/StatusIndicator.tsx @@ -1,23 +1,26 @@ // StatusIndicator.tsx import React from "react"; -import { FaCircle } from "react-icons/fa"; -import { Status, getColorStatus } from "../../../../../middle-layer/types/Status.ts"; +import { + Status, + getColorStatus, +} from "../../../../../middle-layer/types/Status.ts"; interface StatusIndicatorProps { curStatus: Status; } const StatusIndicator: React.FC = ({ curStatus }) => { - const circleColor = getColorStatus(curStatus.toString()) + const lightColor = getColorStatus(curStatus.toString(), "light"); + const darkColor = getColorStatus(curStatus.toString(), "dark"); const labelText = curStatus; // curStatus from the json is stored as a string, so can directly use return ( -
- - - {labelText} - +
+ {labelText}
); }; diff --git a/frontend/src/main-page/grants/grant-view/ContactCard.tsx b/frontend/src/main-page/grants/grant-view/ContactCard.tsx new file mode 100644 index 00000000..843b2549 --- /dev/null +++ b/frontend/src/main-page/grants/grant-view/ContactCard.tsx @@ -0,0 +1,41 @@ +import POC from "../../../../../middle-layer/types/POC"; +import logo from "../../../images/logo.svg"; + +type ContactCardProps = { + contact?: POC; + type?: "BCAN" | "Granter"; +}; + +export default function ContactCard({ contact, type }: ContactCardProps) { + return ( +
+ Profile +
+

+ {contact?.POC_name || "N/A"} +

+

+ + {contact?.POC_email} + +

+
+
+
+ {type} +
+
+
+ ); +} diff --git a/frontend/src/main-page/grants/grant-view/CostBenefitAnalysis.tsx b/frontend/src/main-page/grants/grant-view/CostBenefitAnalysis.tsx new file mode 100644 index 00000000..5fc6fd57 --- /dev/null +++ b/frontend/src/main-page/grants/grant-view/CostBenefitAnalysis.tsx @@ -0,0 +1,153 @@ +import React, { useState } from "react"; +import { Grant } from "../../../../../middle-layer/types/Grant"; +import InputField from "../../../sign-up/InputField"; +import Button from "../../../main-page/settings/components/Button"; + +interface CostBenefitAnalysisProps { + grant: Grant; +} + +interface CostBenefitResult { + totalReportingCost: number; + totalReportingTime: number; + overhead: number; + costPerReport: number; + grantAmount: number; +} + +export const CostBenefitAnalysis: React.FC = ({ + grant, +}) => { + const [hourlyRate, setHourlyRate] = useState(""); + const [timePerReport, setTimePerReport] = useState(""); + const [costBenefitResult, setCostBenefitResult] = + useState(null); + + const calculateCostBenefit = () => { + console.log("Called calculate"); + console.log("hourlyRate state:", hourlyRate); + console.log("timePerReport state:", timePerReport); + const rate = parseFloat(hourlyRate); + const timeReport = parseFloat(timePerReport); + + console.log("Parsed rate:", rate); + console.log("Parsed timeReport:", timeReport); + + // Validation + if (isNaN(rate) || isNaN(timeReport) || rate <= 0 || timeReport <= 0) { + alert( + "Please enter valid positive numbers for hourly rate and time per report.", + ); + return; + } + + const reportCount = grant.report_deadlines?.length ?? 0; + const grantAmount = grant.amount; + const estimatedTime = grant.estimated_completion_time | 5; + + console.log( + "Grant values - Amount:", + grantAmount, + "EstTime:", + estimatedTime, + "ReportCount:", + reportCount, + ); + + // Formula: NetBenefit = GrantAmount - ((EstimatedCompletionTime + ReportCount * TimePerReport) * StaffHourlyRate) + const totalReportingCost = reportCount * timeReport * rate; + + const resultObj = { + totalReportingCost: totalReportingCost, + totalReportingTime: reportCount * timeReport, + overhead: (totalReportingCost / grantAmount) * 100 || 0, + costPerReport: totalReportingCost / reportCount || 0, + grantAmount: grantAmount, + }; + + setCostBenefitResult(resultObj); + }; + + const formatCurrency = (amount: number): string => { + return new Intl.NumberFormat("en-US", { + style: "currency", + currency: "USD", + maximumFractionDigits: 0, + }).format(amount); + }; + + return ( +
+ + {/* Input form */} +
+ {/* Hourly Rate Input */} +
+ setHourlyRate(e.target.value)} + /> +
+ + {/* Time Per Report Input */} +
+ setTimePerReport(e.target.value)} + /> +
+ + {/* Calculate Button */} +
+ + {/* Shows the net benefit result */} +
+ {costBenefitResult && ( +
+
+

+ {formatCurrency(costBenefitResult.costPerReport)} +

+

Cost per report

+
+
+
+ Total reporting cost: + + {formatCurrency(costBenefitResult.totalReportingCost)} + +
+
+ Total reporting time: + + {new Intl.NumberFormat("en-US").format( + costBenefitResult.totalReportingTime, + )}{" "} + hours + +
+
+ Overhead: + + {costBenefitResult.overhead.toFixed(1)}% of{" "} + {formatCurrency(costBenefitResult.grantAmount)} grant + +
+
+
+ )} +
+
+ ); +}; diff --git a/frontend/src/main-page/grants/grant-view/GrantFieldCol.tsx b/frontend/src/main-page/grants/grant-view/GrantFieldCol.tsx new file mode 100644 index 00000000..efdb2c96 --- /dev/null +++ b/frontend/src/main-page/grants/grant-view/GrantFieldCol.tsx @@ -0,0 +1,36 @@ +import React from "react"; + +type InfoField = { + label: string; + value?: string | number | boolean; + item?: React.ReactNode; + important?: boolean; +}; + +type GrantFieldColProps = { + fields: InfoField[]; + colspan?: 1 | 2; +}; + +export default function GrantFieldCol({ + fields, + colspan = 1, +}: GrantFieldColProps) { + return ( +
+ {fields.map((field) => ( +
+

{field.label}

+
+ {field.item ? field.item : field.value || "N/A"} +
+
+ ))} +
+ ); +} diff --git a/frontend/src/main-page/grants/grant-view/GrantView.tsx b/frontend/src/main-page/grants/grant-view/GrantView.tsx new file mode 100644 index 00000000..534f01bd --- /dev/null +++ b/frontend/src/main-page/grants/grant-view/GrantView.tsx @@ -0,0 +1,293 @@ +import React, { useEffect, useState, useLayoutEffect } from "react"; +import { Grant } from "../../../../../middle-layer/types/Grant"; +import { api } from "../../../api"; +import { observer } from "mobx-react-lite"; +import StatusIndicator from "../../grants/grant-list/StatusIndicator"; +import { + faPenToSquare, + faCheckSquare, + faXmarkSquare, +} from "@fortawesome/free-solid-svg-icons"; +import Button from "../../settings/components/Button"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import ContactCard from "./ContactCard"; +import GrantFieldCol from "./GrantFieldCol"; +import { CostBenefitAnalysis } from "./CostBenefitAnalysis"; + +interface GrantItemProps { + grant: Grant; +} + +const GrantItem: React.FC = observer(({ grant }) => { + const [curGrant, setCurGrant] = useState(grant); + const [wasGrantSubmitted, setWasGrantSubmitted] = useState(false); + + const useTruncatedElement = ({ + ref, + }: { + ref: React.RefObject; + }) => { + const [isTruncated, setIsTruncated] = useState(false); + const [isShowingMore, setIsShowingMore] = useState(false); + + useLayoutEffect(() => { + const { offsetHeight, scrollHeight } = ref.current || {}; + + if (offsetHeight && scrollHeight && offsetHeight < scrollHeight) { + setIsTruncated(true); + } else { + setIsTruncated(false); + } + }, [ref]); + + const toggleIsShowingMore = () => setIsShowingMore((prev) => !prev); + + return { + isTruncated, + isShowingMore, + toggleIsShowingMore, + }; + }; + const ref = React.useRef(null); + const { isTruncated, isShowingMore, toggleIsShowingMore } = + useTruncatedElement({ + ref, + }); + + // If the NewGrantModal has been closed and a new grant submitted (or existing grant edited), + // fetch the grant at this index so that all new changes are immediately reflected + useEffect(() => { + const updateGrant = async () => { + if (wasGrantSubmitted) { + try { + const response = await api(`/grant/${grant.grantId}`, { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + }); + + if (response.ok) { + const updatedGrant = await response.json(); + setCurGrant(updatedGrant); + console.log("✅ Grant refreshed:", updatedGrant); + } else { + console.error("❌ Failed to fetch updated grant"); + } + } catch (err) { + console.error("Error fetching updated grant:", err); + } + setWasGrantSubmitted(false); + } + }; + + updateGrant(); + }, [wasGrantSubmitted]); + + function formatDate(isoString: string): string { + if (!isoString) return "N/A"; + const date = new Date(isoString); + const month = String(date.getMonth() + 1).padStart(2, "0"); + const day = String(date.getDate()).padStart(2, "0"); + const year = date.getFullYear(); + return `${month}/${day}/${year}`; + } + + function formatCurrency(amount: number): string { + const formattedCurrency = new Intl.NumberFormat().format(amount); + return formattedCurrency; + } + + return ( +
+ {/* Top header part */} +
+ {/* Left side */} +
+

{curGrant.organization}

+ +
+ {/* Right side */} +
+
+
+
+ + {/* Middle info part */} +
+ {/* Description */} + +

+ {curGrant?.description || "N/A"} +

+ {isTruncated && ( + + )} +
+ ), + }, + ]} + /> + {/* Other details */} +
+ + Yes + + ) : ( + + No + + ), + }, + ]} + /> + + 0 ? ( + curGrant.report_deadlines.map( + (deadline: string, index: number) => ( +
+ {formatDate(deadline)} +
+ ), + ) + ) : ( +
N/A
+ ), + }, + ]} + /> + +
+
+
+ + {/* Bottom info */} +
+ {/* Contacts */} + + + +
+ ), + }, + ]} + /> + {/* Documents */} + 0 ? ( +
+ {curGrant.attachments.map((attachment, index) => ( +

+ + {attachment.attachment_name || attachment.url} + +

+ ))} +
+ ) : ( +
N/A
+ ), + }, + ]} + /> +
+
+ + {/* Cost Benefit */} +
+ + ), + }, + ]} + /> +
+
+ ); +}); + +export default GrantItem; diff --git a/frontend/src/main-page/settings/Settings.tsx b/frontend/src/main-page/settings/Settings.tsx index 61fe0a47..1bf0b6dd 100644 --- a/frontend/src/main-page/settings/Settings.tsx +++ b/frontend/src/main-page/settings/Settings.tsx @@ -1,6 +1,7 @@ import Button from "./components/Button"; import InfoCard from "./components/InfoCard"; import logo from "../../images/logo.svg"; +import { faPenToSquare } from "@fortawesome/free-solid-svg-icons"; export default function Settings() { return ( @@ -45,10 +46,11 @@ export default function Settings() { title="Personal Information" action={ ); diff --git a/frontend/src/sign-up/InputField.tsx b/frontend/src/sign-up/InputField.tsx index 490438e6..1fdaa467 100644 --- a/frontend/src/sign-up/InputField.tsx +++ b/frontend/src/sign-up/InputField.tsx @@ -28,7 +28,7 @@ export default function InputField({ diff --git a/frontend/src/styles/index.css b/frontend/src/styles/index.css index ab168ff4..4501a0d7 100644 --- a/frontend/src/styles/index.css +++ b/frontend/src/styles/index.css @@ -86,7 +86,6 @@ } a { - font-weight: 500; color: var(--color-secondary-500); text-decoration: inherit; } diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts index 0d38fbc6..bec42b29 100644 --- a/frontend/tailwind.config.ts +++ b/frontend/tailwind.config.ts @@ -88,10 +88,15 @@ export default { "8xl": "96rem", "9xl": "128rem", }, + borderWidth: { + DEFAULT: "1.5px", + 0: "0", + }, borderRadius: { - "4xl": "2rem", + sm: "0.5rem", md: "0.75rem", DEFAULT: "0.75rem", + "4xl": "2rem", }, }, }, diff --git a/middle-layer/types/Status.ts b/middle-layer/types/Status.ts index 34833450..c5d8ac9b 100644 --- a/middle-layer/types/Status.ts +++ b/middle-layer/types/Status.ts @@ -5,57 +5,96 @@ * (3) Inactive: Grant earnings are used up */ export enum Status { - Potential = "Potential", - Active = "Active", - Inactive = "Inactive", - Rejected = "Rejected", - Pending = "Pending" + Potential = "Potential", + Active = "Active", + Inactive = "Inactive", + Rejected = "Rejected", + Pending = "Pending", } // TODO: 1) override stringify behavior of status enum 2) stringify, and then go back and modify enum (create helper function to generalize) // 3) turn enums to string // string rep of status -export function stringToStatus(status: string): Status | null{ - switch (status) { - case 'All': return null; // no filter - case 'Active': return Status.Active; - case 'Inactive': return Status.Inactive; - case 'Potential': return Status.Potential; - case 'Rejected': return Status.Rejected; - case 'Pending': return Status.Pending; - default: throw new Error(`Unknown status: ${status}`); - } +export function stringToStatus(status: string): Status | null { + switch (status) { + case "All": + return null; // no filter + case "Active": + return Status.Active; + case "Inactive": + return Status.Inactive; + case "Potential": + return Status.Potential; + case "Rejected": + return Status.Rejected; + case "Pending": + return Status.Pending; + default: + throw new Error(`Unknown status: ${status}`); + } } -export function statusToString(status : Status): string { - switch (status) { - case Status.Active : return 'Active'; - case Status.Inactive : return "Inactive"; - case Status.Potential : return "Potential"; - case Status.Rejected : return "Rejected"; - case Status.Pending : return "Pending"; - } +export function statusToString(status: Status): string { + switch (status) { + case Status.Active: + return "Active"; + case Status.Inactive: + return "Inactive"; + case Status.Potential: + return "Potential"; + case Status.Rejected: + return "Rejected"; + case Status.Pending: + return "Pending"; + } } // color associated with status on UI, represented as a string -export function getColorStatus(status: string) { +export function getColorStatus( + status: string, + variant: "light" | "dark" = "dark", +): string { + if (variant === "light") { switch (status) { - case "Active": return "var(--color-green)"; // green - case "Inactive": return "var(--color-grey-500)" // gray - case "Potential": return "var(--color-blue-dark)" // blue - // TODO add colors for rejected and pending - case "Rejected": return "var(--color-red)" // red - case "Pending": return "var(--color-yellow-dark)" // yellow - default: return 'gray'; + case "Active": + return "var(--color-green-light)"; // green + case "Inactive": + return "var(--color-grey-400)"; // gray + case "Potential": + return "var(--color-blue-light)"; // blue + // TODO add colors for rejected and pending + case "Rejected": + return "var(--color-red-light)"; // red + case "Pending": + return "var(--color-yellow-light)"; // yellow + default: + return "gray"; } + } else { + switch (status) { + case "Active": + return "var(--color-green-dark)"; // green + case "Inactive": + return "var(--color-grey-700)"; // gray + case "Potential": + return "var(--color-blue-dark)"; // blue + // TODO add colors for rejected and pending + case "Rejected": + return "var(--color-red-dark)"; // red + case "Pending": + return "var(--color-yellow-dark)"; // yellow + default: + return "gray"; + } + } } // Get list of status types for received and unreceived grants -export function getListApplied(received: boolean){ - if(received){ - return ["Active", "Inactive"] - } else{ - return ["Pending", "Rejected"] - } -} \ No newline at end of file +export function getListApplied(received: boolean) { + if (received) { + return ["Active", "Inactive"]; + } else { + return ["Pending", "Rejected"]; + } +}