Skip to content

feat(ai-create): show character counter under the AI prompt field#127

Open
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:feat/ai-prompt-char-counter
Open

feat(ai-create): show character counter under the AI prompt field#127
dantaspaulo wants to merge 1 commit into
trypostit:mainfrom
dantaspaulo:feat/ai-prompt-char-counter

Conversation

@dantaspaulo

Copy link
Copy Markdown

Problem

The AI post prompt is validated with max:2000 on the backend
(StartPostCreationRequest), but the create form gives no hint of that limit.
Users can type well past 2000 characters and only discover the cap through a
validation error when they hit generate.

Change

A live character counter below the "What is this post about?" textarea in
AiPostWizard.vue:

  • Shows length/2000, right-aligned under the field.
  • Turns red (text-destructive) once the prompt exceeds the limit.
  • The generate button is disabled while over the limit — canSubmit now also
    checks promptText.length <= PROMPT_MAX — so the limit is enforced in the UI
    before the request is sent.

PROMPT_MAX mirrors the backend max:2000 rule so the two stay in sync.

Frontend-only, single file: resources/js/components/posts/create/AiPostWizard.vue.

The AI post prompt is validated with `max:2000` on the backend, but the
create form gave no hint of the limit — users could write past it and only
find out via a validation error on submit.

Add a live `X/2000` counter below the "What is this post about?" textarea.
It turns red (`text-destructive`) once the prompt exceeds the limit, and the
generate button is disabled while over it (`canSubmit` now checks
`length <= PROMPT_MAX`), so the limit is caught before the request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant