Skip to content

Commit

Permalink
Set Minimum ticket description length 200 characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Dec 21, 2024
1 parent b759406 commit 8a4d4a9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/components/CreateTicketModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export function CreateTicketModal(props: {
{ id: "OTHER", label: "Other" },
];

const hasProblem = () =>
["ABUSE", "OTHER", "ACCOUNT", "QUESTION"].includes(selectedCategoryId());

const createTicketClick = async () => {
if (requestSent()) return;

Expand All @@ -64,6 +67,13 @@ export function CreateTicketModal(props: {
return;
}

if (hasProblem()) {
if (body().length < 100) {
setError("Description must be at least 200 characters.");
return;
}
}

if (selectedCategoryId() !== "ABUSE") {
setUserIds("");
setMessageIds("");
Expand Down Expand Up @@ -173,11 +183,7 @@ export function CreateTicketModal(props: {
/>
</Show>

<Show
when={["ABUSE", "OTHER", "ACCOUNT", "QUESTION"].includes(
selectedCategoryId()
)}
>
<Show when={hasProblem()}>
<Input
label="In one short sentence, what is the problem?"
value={title()}
Expand Down

0 comments on commit 8a4d4a9

Please sign in to comment.