Substitui alertas por painel de SLA
This commit is contained in:
parent
e1ec0de7a4
commit
967d4bf1c6
3 changed files with 46 additions and 8 deletions
|
|
@ -8,6 +8,7 @@ import { MyTicketsPanel } from "@/components/tickets/my-tickets-panel"
|
|||
import { ChartOpenedResolved } from "@/components/charts/chart-opened-resolved"
|
||||
import { ChartOpenByPriority } from "@/components/charts/chart-open-priority"
|
||||
import { requireAuthenticatedSession } from "@/lib/auth-server"
|
||||
import { DashboardSlaRiskPanel } from "@/components/dashboard/dashboard-sla-risk-panel"
|
||||
|
||||
export default async function Dashboard() {
|
||||
// Garante redirecionamento para /login quando sem sessão (aba anônima, etc.)
|
||||
|
|
@ -26,8 +27,13 @@ export default async function Dashboard() {
|
|||
</div>
|
||||
<div className="flex flex-col gap-6">
|
||||
<MyTicketsPanel />
|
||||
<RecentTicketsPanel />
|
||||
<DashboardAlertsPanel />
|
||||
<div className="hidden" aria-hidden="true">
|
||||
<RecentTicketsPanel />
|
||||
</div>
|
||||
<div className="hidden" aria-hidden="true">
|
||||
<DashboardAlertsPanel />
|
||||
</div>
|
||||
<DashboardSlaRiskPanel />
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 lg:px-6">
|
||||
|
|
|
|||
|
|
@ -301,10 +301,6 @@ export function DashboardQueueInsights() {
|
|||
data={queueTrend?.queues}
|
||||
isLoading={dashboardEnabled && queueTrend === undefined}
|
||||
/>
|
||||
<SlaAtRiskCard
|
||||
data={overview?.awaitingAction}
|
||||
isLoading={dashboardEnabled && overview === undefined}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -323,7 +319,10 @@ function QueueSparklineRow({
|
|||
<CardTitle className="text-base font-semibold">Filas com maior volume</CardTitle>
|
||||
<CardDescription>Comparativo diário de entradas x resolvidos</CardDescription>
|
||||
</div>
|
||||
<Link href="/queues/overview" className="text-sm font-semibold text-neutral-900 underline-offset-4 hover:underline">
|
||||
<Link
|
||||
href="/queues/overview"
|
||||
className="text-sm font-semibold text-[#006879] underline-offset-4 transition-colors hover:text-[#004d5a] hover:underline"
|
||||
>
|
||||
Abrir painel de filas
|
||||
</Link>
|
||||
</CardHeader>
|
||||
|
|
@ -441,7 +440,7 @@ function QueueSparklineCard({
|
|||
)
|
||||
}
|
||||
|
||||
function SlaAtRiskCard({
|
||||
export function SlaAtRiskCard({
|
||||
data,
|
||||
isLoading,
|
||||
}: {
|
||||
|
|
|
|||
33
src/components/dashboard/dashboard-sla-risk-panel.tsx
Normal file
33
src/components/dashboard/dashboard-sla-risk-panel.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"use client"
|
||||
|
||||
import { useQuery } from "convex/react"
|
||||
|
||||
import { api } from "@/convex/_generated/api"
|
||||
import type { Id } from "@/convex/_generated/dataModel"
|
||||
import { SlaAtRiskCard } from "@/components/dashboard/dashboard-hero"
|
||||
import { useAuth } from "@/lib/auth-client"
|
||||
import { DEFAULT_TENANT_ID } from "@/lib/constants"
|
||||
|
||||
type AwaitingAction = {
|
||||
total: number
|
||||
atRisk: number
|
||||
}
|
||||
|
||||
export function DashboardSlaRiskPanel() {
|
||||
const { session, convexUserId, isStaff } = useAuth()
|
||||
const tenantId = session?.user.tenantId ?? DEFAULT_TENANT_ID
|
||||
const enabled = Boolean(isStaff && convexUserId)
|
||||
|
||||
const overview = useQuery(
|
||||
api.reports.dashboardOverview,
|
||||
enabled ? { tenantId, viewerId: convexUserId as Id<"users"> } : "skip"
|
||||
) as { awaitingAction?: AwaitingAction } | undefined
|
||||
|
||||
return (
|
||||
<SlaAtRiskCard
|
||||
data={overview?.awaitingAction}
|
||||
isLoading={enabled && overview === undefined}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue