diff --git a/frontend/src/grant-info/components/GrantItem.tsx b/frontend/src/grant-info/components/GrantItem.tsx index 6dfb797c..841c59f8 100644 --- a/frontend/src/grant-info/components/GrantItem.tsx +++ b/frontend/src/grant-info/components/GrantItem.tsx @@ -2,6 +2,12 @@ import React, {useState } from 'react'; import './styles/GrantItem.css'; import { GrantAttributes } from './GrantAttributes'; import GrantDetails from './GrantDetails'; +import StatusIndicator from "./StatusIndicator"; // import the new component + +function isActiveStatus(status: string) { + return ["Pending", "In Review", "Awaiting Submission"].includes(status); + } + import {Grant} from "@/external/bcanSatchel/store.ts"; interface GrantItemProps { @@ -20,6 +26,8 @@ const GrantItem: React.FC = ({ grant }) => { const toggleExpand = () => { setIsExpanded(!isExpanded); }; + + const active = isActiveStatus(curGrant.status); // when toggle edit turns off, sends curGrant to backend to be saved const toggleEdit = async () => { @@ -54,6 +62,7 @@ const GrantItem: React.FC = ({ grant }) => {
  • {curGrant.status}
  • ${curGrant.amount}
  • {curGrant.restrictions}
  • +
  • {isExpanded && ( diff --git a/frontend/src/grant-info/components/GrantStatus.tsx b/frontend/src/grant-info/components/GrantStatus.tsx new file mode 100644 index 00000000..dd630444 --- /dev/null +++ b/frontend/src/grant-info/components/GrantStatus.tsx @@ -0,0 +1,5 @@ +export function isActiveStatus(status: string): boolean { + return ["Pending", "In Review", "Awaiting Submission"].includes(status); +} + + diff --git a/frontend/src/grant-info/components/StatusBadge.tsx b/frontend/src/grant-info/components/StatusBadge.tsx new file mode 100644 index 00000000..9683344d --- /dev/null +++ b/frontend/src/grant-info/components/StatusBadge.tsx @@ -0,0 +1,42 @@ +import { Badge, Box } from "@chakra-ui/react"; +import { isActiveStatus } from "./GrantStatus"; + +export function StatusBadge({ status }: { status: string }) { + let colorScheme: string; + switch (status) { + case "Pending": + colorScheme = "orange"; + break; + case "In Review": + colorScheme = "yellow"; + break; + case "Awaiting Submission": + colorScheme = "teal"; + break; + case "Approved": + colorScheme = "green"; + break; + case "Rejected": + colorScheme = "red"; + break; + case "Cancelled": + colorScheme = "red"; + break; + default: + colorScheme = "gray"; + } + + return ( + + + {isActiveStatus(status) ? "Active" : "Inactive"} + + ); +} diff --git a/frontend/src/grant-info/components/StatusIndicator.tsx b/frontend/src/grant-info/components/StatusIndicator.tsx new file mode 100644 index 00000000..a60bcbc0 --- /dev/null +++ b/frontend/src/grant-info/components/StatusIndicator.tsx @@ -0,0 +1,46 @@ +// StatusIndicator.tsx + +import React from "react"; +import { Box, Text } from "@chakra-ui/react"; + +interface StatusIndicatorProps { + isActive: boolean; +} + +const StatusIndicator: React.FC = ({ isActive }) => { + const circleColor = isActive ? "#5AB911" : "#A9A9A9"; // #5AB911 = bright green from Figma + const labelText = isActive ? "Active" : "Inactive"; + + return ( + + + + + + {/* The text label: #000, "Helvetica Neue", 28px */} + + {labelText} + + + ); +}; + +export default StatusIndicator;