feat(editor): enable ticket mentions on new-ticket forms and fix @mention popup layering\n\n- New Ticket page/dialog/portal now support @ to link tickets\n- Mention popup uses fixed strategy + high z-index\n- Add minimal Tippy box styling to globals.css\n- Keeps existing server-side permissions for mentions

This commit is contained in:
codex-bot 2025-10-23 09:48:16 -03:00
parent b0f57009ac
commit 904134604c
5 changed files with 25 additions and 2 deletions

View file

@ -28,7 +28,7 @@ import { CategorySelectFields } from "@/components/tickets/category-select"
export default function NewTicketPage() {
const router = useRouter()
const { convexUserId, isStaff } = useAuth()
const { convexUserId, isStaff, role } = useAuth()
const queuesEnabled = Boolean(isStaff && convexUserId)
const queueArgs = queuesEnabled
? { tenantId: DEFAULT_TENANT_ID, viewerId: convexUserId as Id<"users"> }
@ -79,6 +79,11 @@ export default function NewTicketPage() {
if (hasChamados) setQueueName("Chamados")
}, [queueOptions, queueName])
const allowTicketMentions = useMemo(() => {
const normalized = (role ?? "").toLowerCase()
return normalized === "admin" || normalized === "agent" || normalized === "collaborator"
}, [role])
async function submit(event: React.FormEvent) {
event.preventDefault()
if (!convexUserId || loading) return
@ -201,6 +206,7 @@ export default function NewTicketPage() {
}
}}
placeholder="Detalhe o problema, passos para reproduzir, links, etc."
ticketMention={{ enabled: allowTicketMentions }}
/>
{descriptionError ? <p className="text-xs font-medium text-red-500">{descriptionError}</p> : null}
</div>