File size: 1,358 Bytes
b24b684
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Chip } from "@mui/material";
import type { BookingStatus, KycStatus } from "@/api/types";

const BOOKING: Record<
  BookingStatus,
  { label: string; color: "default" | "warning" | "info" | "success" | "error" }
> = {
  pending_approval: { label: "Needs approval", color: "warning" },
  open: { label: "Open (finding worker)", color: "info" },
  pending: { label: "Pending", color: "warning" },
  accepted: { label: "Accepted", color: "info" },
  completed: { label: "Completed", color: "success" },
  rejected: { label: "Rejected", color: "error" },
  cancelled: { label: "Cancelled", color: "default" },
};

const KYC: Record<
  KycStatus,
  { label: string; color: "default" | "warning" | "success" | "error" }
> = {
  not_submitted: { label: "Not submitted", color: "default" },
  pending: { label: "Under review", color: "warning" },
  verified: { label: "Verified", color: "success" },
  rejected: { label: "Rejected", color: "error" },
};

export function BookingStatusChip({ status }: { status: BookingStatus }) {
  const s = BOOKING[status];
  return <Chip size="small" variant="outlined" label={s.label} color={s.color} />;
}

export function KycStatusChip({ status }: { status: KycStatus }) {
  const s = KYC[status];
  return <Chip size="small" variant="outlined" label={s.label} color={s.color} />;
}