Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/frontend/src/components/dashboardCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
formatDate,
getInitials,
ORDER_STATUS_COLORS,
ORDER_STATUS_LABELS,
DONATION_STATUS_COLORS,
USER_ICON_COLORS,
} from '@utils/utils';
Expand Down Expand Up @@ -42,17 +43,17 @@ export interface DashboardCardBadge {

export const ORDER_STATUS_BADGE: Record<OrderStatus, DashboardCardBadge> = {
[OrderStatus.PENDING]: {
label: 'Received',
label: ORDER_STATUS_LABELS[OrderStatus.PENDING],
bg: ORDER_STATUS_COLORS[OrderStatus.PENDING][0],
color: ORDER_STATUS_COLORS[OrderStatus.PENDING][1],
},
[OrderStatus.SHIPPED]: {
label: 'In Progress',
label: ORDER_STATUS_LABELS[OrderStatus.SHIPPED],
bg: ORDER_STATUS_COLORS[OrderStatus.SHIPPED][0],
color: ORDER_STATUS_COLORS[OrderStatus.SHIPPED][1],
},
[OrderStatus.DELIVERED]: {
label: 'Completed',
label: ORDER_STATUS_LABELS[OrderStatus.DELIVERED],
bg: ORDER_STATUS_COLORS[OrderStatus.DELIVERED][0],
color: ORDER_STATUS_COLORS[OrderStatus.DELIVERED][1],
},
Expand Down
5 changes: 3 additions & 2 deletions apps/frontend/src/components/forms/requestDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FoodRequestSummaryDto,
} from 'types/types';
import { OrderStatus } from '../../types/types';
import { ORDER_STATUS_LABELS } from '@utils/utils';
import React, { useState, useEffect } from 'react';
import {
Flex,
Expand Down Expand Up @@ -199,15 +200,15 @@ const RequestDetailsModal: React.FC<RequestDetailsModalProps> = ({
bgColor="#EAEDEF"
color="#2B4E60"
>
Received
{ORDER_STATUS_LABELS[currentOrder.status]}
</Badge>
) : (
<Badge
{...badgeStyles}
bgColor="#FEECD1"
color="#9C5D00"
>
In Progress
{ORDER_STATUS_LABELS[currentOrder.status]}
</Badge>
)}
</Flex>
Expand Down
9 changes: 5 additions & 4 deletions apps/frontend/src/containers/adminOrderManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
Search,
} from 'lucide-react';
import {
capitalize,
formatDate,
getInitials,
ORDER_STATUS_COLORS,
ORDER_STATUS_LABELS,
USER_ICON_COLORS,
} from '@utils/utils';
import ApiClient from '@api/apiClient';
Expand Down Expand Up @@ -345,7 +345,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
fontWeight="semibold"
color="neutral.700"
>
{capitalize(status)}
{ORDER_STATUS_LABELS[status]}
</Box>
</Box>

Expand All @@ -369,7 +369,8 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
No Orders
</Box>
<Box color="neutral.700" fontWeight="400">
You have no {status.toLowerCase()} orders at this time.
You have no {ORDER_STATUS_LABELS[status].toLowerCase()} orders at
this time.
</Box>
</Box>
) : (
Expand Down Expand Up @@ -666,7 +667,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
py={0.5}
px={3}
>
{capitalize(order.status)}
{ORDER_STATUS_LABELS[order.status]}
</Box>
</Table.Cell>
<Table.Cell
Expand Down
13 changes: 9 additions & 4 deletions apps/frontend/src/containers/pantryOrderManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import {
Mail,
CircleCheck,
} from 'lucide-react';
import { capitalize, formatDate, ORDER_STATUS_COLORS } from '@utils/utils';
import {
formatDate,
ORDER_STATUS_COLORS,
ORDER_STATUS_LABELS,
} from '@utils/utils';
import ApiClient from '@api/apiClient';
import { OrderStatus, OrderSummary } from '../types/types';
import OrderReceivedActionModal from '@components/forms/orderReceivedActionModal';
Expand Down Expand Up @@ -307,7 +311,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
fontWeight="semibold"
color="neutral.700"
>
{capitalize(status)}
{ORDER_STATUS_LABELS[status]}
</Box>
</Box>

Expand All @@ -331,7 +335,8 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
No Orders
</Box>
<Box color="neutral.700" fontWeight="400">
You have no {status.toLowerCase()} orders at this time.
You have no {ORDER_STATUS_LABELS[status].toLowerCase()} orders at
this time.
</Box>
</Box>
) : (
Expand Down Expand Up @@ -501,7 +506,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
py={1}
px={3}
>
{capitalize(order.status)}
{ORDER_STATUS_LABELS[order.status]}
</Box>
</Table.Cell>
<Table.Cell
Expand Down
16 changes: 5 additions & 11 deletions apps/frontend/src/containers/volunteerOrderManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import {
Search,
} from 'lucide-react';
import {
capitalize,
formatDate,
getInitials,
ORDER_STATUS_COLORS,
ORDER_STATUS_LABELS,
USER_ICON_COLORS,
} from '@utils/utils';
import ApiClient from '@api/apiClient';
Expand All @@ -45,12 +45,6 @@ import { ROUTES } from '../routes';

type VolunteerOrderWithColor = VolunteerOrder & { assigneeColor?: string };

const STATUS_TITLES: Record<OrderStatus, string> = {
[OrderStatus.SHIPPED]: 'In Progress',
[OrderStatus.PENDING]: 'Received',
[OrderStatus.DELIVERED]: 'Completed',
};

const hasRequiredActions = (order: VolunteerOrder): boolean => {
if (!order.actionCompletion) return false;
if (order.status !== OrderStatus.SHIPPED) return false;
Expand Down Expand Up @@ -412,7 +406,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
fontWeight="semibold"
color="neutral.700"
>
{STATUS_TITLES[status]}
{ORDER_STATUS_LABELS[status]}
</Box>
</Box>

Expand All @@ -436,8 +430,8 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
No Orders
</Box>
<Box color="neutral.700" fontWeight="400">
You have no {STATUS_TITLES[status].toLowerCase()} orders at this
time.
You have no {ORDER_STATUS_LABELS[status].toLowerCase()} orders at
this time.
</Box>
</Box>
) : (
Expand Down Expand Up @@ -734,7 +728,7 @@ const OrderStatusSection: React.FC<OrderStatusSectionProps> = ({
py={0.5}
px={3}
>
{capitalize(STATUS_TITLES[status])}
{ORDER_STATUS_LABELS[status]}
</Box>
</Table.Cell>
<Table.Cell
Expand Down
6 changes: 6 additions & 0 deletions apps/frontend/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export const ORDER_STATUS_COLORS: Record<OrderStatus, [string, string]> = {
[OrderStatus.DELIVERED]: TEAL_STATUS,
};

export const ORDER_STATUS_LABELS: Record<OrderStatus, string> = {
[OrderStatus.PENDING]: 'Received',
[OrderStatus.SHIPPED]: 'In Progress',
[OrderStatus.DELIVERED]: 'Completed',
};

export const DONATION_STATUS_COLORS: Record<DonationStatus, [string, string]> =
{
[DonationStatus.MATCHED]: YELLOW_STATUS,
Expand Down
Loading