diff --git a/apps/client/pages/ticket/[id].tsx b/apps/client/pages/ticket/[id].tsx
index b61c53672..999888531 100644
--- a/apps/client/pages/ticket/[id].tsx
+++ b/apps/client/pages/ticket/[id].tsx
@@ -30,6 +30,13 @@ function classNames(...classes: any) {
return classes.filter(Boolean).join(" ");
}
+const ticketStatusMapping = {
+ needs_support: "Needs Support",
+ in_progress: "In Progress",
+ in_review: "In Review",
+ done: "Done",
+};
+
export default function Ticket() {
const router = useRouter();
const { t } = useTranslation("peppermint");
@@ -456,18 +463,7 @@ export default function Ticket() {
/>
- {data.ticket.status === "needs_support" && (
- Needs Support
- )}
- {data.ticket.status === "in_progress" && (
- In Progress
- )}
- {data.ticket.status === "in_review" && (
- In Review
- )}
- {data.ticket.status === "done" && (
- Done
- )}
+ {ticketStatusMapping[data.ticket.status]}
@@ -928,25 +924,14 @@ export default function Ticket() {
/>
- {data.ticket.status === "needs_support" && (
- Needs Support
- )}
- {data.ticket.status === "in_progress" && (
- In Progress
- )}
- {data.ticket.status === "in_review" && (
- In Review
- )}
- {data.ticket.status === "done" && (
- Done
- )}
+ {ticketStatusMapping[data.ticket.status]}
)}
) : (
- <>
+
{({ open }) => (
<>
@@ -1110,8 +1095,8 @@ export default function Ticket() {
{ticketStatus
- ? ticketStatus
- : data.ticket.status}
+ ? ticketStatusMapping[ticketStatus]
+ : ticketStatusMapping[data.ticket.status]}
-
- classNames(
- active
- ? "bg-indigo-600 text-white"
- : "text-gray-900",
- "relative cursor-default select-none py-2 pl-3 pr-9"
- )
- }
- value="needs_support"
- >
- {({ selected, active }) => (
- <>
-
- Needs Support
-
-
- {selected ? (
-
-
-
- ) : null}
- >
- )}
-
-
- classNames(
- active
- ? "bg-indigo-600 text-white"
- : "text-gray-900",
- "relative cursor-default select-none py-2 pl-3 pr-9"
- )
- }
- value="in_progress"
- >
- {({ selected, active }) => (
- <>
-
- In Progress
-
-
- {selected ? (
-
-
-
- ) : null}
- >
- )}
-
-
- classNames(
- active
- ? "bg-indigo-600 text-white"
- : "text-gray-900",
- "relative cursor-default select-none py-2 pl-3 pr-9"
- )
- }
- value="in_review"
- >
- {({ selected, active }) => (
- <>
-
- In Review
-
-
- {selected ? (
+ {Object.keys(ticketStatusMapping).map((status) => (
+
+ classNames(
+ active
+ ? "bg-indigo-600 text-white"
+ : "text-gray-900",
+ "relative cursor-default select-none py-2 pl-3 pr-9"
+ )
+ }
+ value={status}
+ >
+ {({ selected, active }) => (
+ <>
-
+ {ticketStatusMapping[status]}
- ) : null}
- >
- )}
-
-
- classNames(
- active
- ? "bg-indigo-600 text-white"
- : "text-gray-900",
- "relative cursor-default select-none py-2 pl-3 pr-9"
- )
- }
- value="done"
- >
- {({ selected, active }) => (
- <>
-
- Done
-
- {selected ? (
-
-
-
- ) : null}
- >
- )}
-
+ {selected ? (
+
+
+
+ ) : null}
+ >
+ )}
+
+ ))}
>
)}
- >
+
)}