fix(checklist): corrige acentuação e adiciona modal de exclusão
- Corrige acentuações: Opções, Não, Descrição, Obrigatório, máx - Adiciona modal de confirmação para exclusão de itens do checklist - Remove uso de confirm() nativo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f1833be1ea
commit
10078c7aa7
6 changed files with 82 additions and 27 deletions
|
|
@ -67,11 +67,11 @@ function normalizeTemplateItems(items: DraftItem[]) {
|
|||
}
|
||||
const invalid = normalized.find((item) => item.text.length > 240)
|
||||
if (invalid) {
|
||||
throw new Error("Item do checklist muito longo (max. 240 caracteres).")
|
||||
throw new Error("Item do checklist muito longo (máx. 240 caracteres).")
|
||||
}
|
||||
const invalidQuestion = normalized.find((item) => item.type === "question" && item.options.length < 2)
|
||||
if (invalidQuestion) {
|
||||
throw new Error(`A pergunta "${invalidQuestion.text}" precisa ter pelo menos 2 opcoes.`)
|
||||
throw new Error(`A pergunta "${invalidQuestion.text}" precisa ter pelo menos 2 opções.`)
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ function TemplateEditorDialog({
|
|||
<div className="flex items-center justify-between gap-2">
|
||||
<div className="space-y-0.5">
|
||||
<p className="text-sm font-semibold text-neutral-900">Itens</p>
|
||||
<p className="text-xs text-muted-foreground">Defina o que precisa ser feito. Itens obrigatorios bloqueiam o encerramento.</p>
|
||||
<p className="text-xs text-muted-foreground">Defina o que precisa ser feito. Itens obrigatórios bloqueiam o encerramento.</p>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
|
|
@ -260,7 +260,7 @@ function TemplateEditorDialog({
|
|||
setItems((prev) => prev.map((row) => (row.id === item.id ? { ...row, required: Boolean(checked) } : row)))
|
||||
}
|
||||
/>
|
||||
Obrigatorio
|
||||
Obrigatório
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-sm text-neutral-700">
|
||||
<Checkbox
|
||||
|
|
@ -272,7 +272,7 @@ function TemplateEditorDialog({
|
|||
? {
|
||||
...row,
|
||||
type: checked ? "question" : "checkbox",
|
||||
options: checked ? (row.options.length > 0 ? row.options : ["Sim", "Nao"]) : [],
|
||||
options: checked ? (row.options.length > 0 ? row.options : ["Sim", "Não"]) : [],
|
||||
}
|
||||
: row
|
||||
)
|
||||
|
|
@ -299,14 +299,14 @@ function TemplateEditorDialog({
|
|||
onChange={(e) =>
|
||||
setItems((prev) => prev.map((row) => (row.id === item.id ? { ...row, description: e.target.value } : row)))
|
||||
}
|
||||
placeholder="Descricao (opcional)"
|
||||
placeholder="Descrição (opcional)"
|
||||
className="h-8 text-xs"
|
||||
/>
|
||||
|
||||
{item.type === "question" && (
|
||||
<div className="space-y-2 rounded-lg border border-dashed border-cyan-200 bg-cyan-50/50 p-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<p className="text-xs font-medium text-cyan-700">Opcoes de resposta</p>
|
||||
<p className="text-xs font-medium text-cyan-700">Opções de resposta</p>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue