Compare commits

..

2 Commits

Author SHA1 Message Date
fc699e7890 Merge pull request 'feat: Add a color scheme for the status of orders (#56)' (#57) from feat/colors-status into main
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
Reviewed-on: #57
Reviewed-by: Primakov Alexandr Alexandrovich <primakovpro@gmail.com>
2025-01-11 21:56:00 +03:00
7b24804498 feat: Add a color scheme for the status of orders (#56)
All checks were successful
it-academy/dry-wash-pl/pipeline/head This commit looks good
it-academy/dry-wash-pl/pipeline/pr-main This commit looks good
2024-12-29 22:02:55 +03:00

View File

@ -3,7 +3,7 @@ import { Td, Tr, Link, Select } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import dayjs from 'dayjs';
import { getTimeSlot } from '../../lib/date-helpers';
import { getTimeSlot } from '../../lib';
const statuses = [
'pending' as const,
@ -26,6 +26,16 @@ export type OrderProps = {
location?: string;
};
type Status = (typeof statuses)[number];
const statusColors: Record<Status, string> = {
pending: 'yellow.100',
progress: 'blue.100',
working: 'orange.100',
canceled: 'red.100',
complete: 'green.100',
};
const OrderItem = ({
carNumber,
startWashTime,
@ -40,6 +50,7 @@ const OrderItem = ({
});
const [statusSelect, setStatus] = useState(status);
const bgColor = statusColors[statusSelect];
return (
<Tr>
@ -51,6 +62,7 @@ const OrderItem = ({
value={statusSelect}
onChange={(e) => setStatus(e.target.value as OrderProps['status'])}
placeholder={t(`status.placeholder`)}
bg={bgColor}
>
{statuses.map((status) => (
<option key={status} value={status}>