Mark the message (and a request's name) as required on the forms
The send button waits for 10 characters of message; the field now says Required, and a note under it counts down what's still needed. The request form's name field is marked too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f983ecf26c
commit
110b655d5e
2 changed files with 29 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ import { ApiError, upload } from "../../lib/api.ts";
|
|||
import { accentText, BRAND } from "../../lib/color.ts";
|
||||
import { REQUEST_FILES } from "../../lib/site.ts";
|
||||
import { REQUEST_TYPES, type RequestAction } from "../../data/requestTypes.ts";
|
||||
import { FieldError, OptionalTag, TilePicker, errorFieldClass, fieldClass } from "./FeedbackForm.tsx";
|
||||
import { FieldError, MinimumNote, OptionalTag, RequiredTag, TilePicker, errorFieldClass, fieldClass } from "./FeedbackForm.tsx";
|
||||
|
||||
const MUTED = "var(--color-muted)";
|
||||
const MAX_CHARS = 5000;
|
||||
|
|
@ -206,6 +206,7 @@ export default function RequestForm() {
|
|||
<div className="mt-8">
|
||||
<label htmlFor="request-subject" className="text-base font-semibold text-body">
|
||||
{action === "update" && type.actions.length > 1 ? `Which ${type.label.toLowerCase()}?` : type.subject}
|
||||
<RequiredTag />
|
||||
</label>
|
||||
<input
|
||||
id="request-subject"
|
||||
|
|
@ -262,6 +263,7 @@ export default function RequestForm() {
|
|||
<div className="mt-8">
|
||||
<label htmlFor="request-message" className="text-base font-semibold text-body">
|
||||
{action === "update" ? "What should change?" : "Tell us about it"}
|
||||
<RequiredTag />
|
||||
</label>
|
||||
<textarea
|
||||
id="request-message"
|
||||
|
|
@ -280,6 +282,7 @@ export default function RequestForm() {
|
|||
/>
|
||||
<div className="mt-2 flex items-start justify-between gap-4">
|
||||
<FieldError id="request-message-error">{fieldErrors.message}</FieldError>
|
||||
{!fieldErrors.message && <MinimumNote length={message.trim().length} min={MIN_MESSAGE} />}
|
||||
<span className="ml-auto shrink-0 text-xs tabular-nums" style={{ color: MUTED }}>
|
||||
{message.length} / {MAX_CHARS}
|
||||
</span>
|
||||
|
|
@ -382,7 +385,7 @@ export default function RequestForm() {
|
|||
</button>
|
||||
{!ready && !sending && (
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
Choose what it's about, give it a name, write at least a sentence and give an email address to send.
|
||||
Choose what it's about, give it a name, write at least {MIN_MESSAGE} characters and give an email address to send.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue