feat(ai-create): show character counter under the AI prompt field#127
Open
dantaspaulo wants to merge 1 commit into
Open
feat(ai-create): show character counter under the AI prompt field#127dantaspaulo wants to merge 1 commit into
dantaspaulo wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The AI post prompt is validated with
max:2000on 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:length/2000, right-aligned under the field.text-destructive) once the prompt exceeds the limit.canSubmitnow alsochecks
promptText.length <= PROMPT_MAX— so the limit is enforced in the UIbefore the request is sent.
PROMPT_MAXmirrors the backendmax:2000rule so the two stay in sync.Frontend-only, single file:
resources/js/components/posts/create/AiPostWizard.vue.