Compare commits
8 Commits
47697b4421
...
global-ass
| Author | SHA1 | Date | |
|---|---|---|---|
| c13afa7554 | |||
| 8033450321 | |||
| 98de8e948b | |||
| 3697119656 | |||
| e268b55392 | |||
| da5b1009e3 | |||
| 3d04995f97 | |||
| d3069e1f25 |
@@ -68,13 +68,13 @@ export function useExtensionRequestColumns(): ColumnDef<TicketExtensionRequest>[
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
accessorKey: 'ticket_name',
|
accessorKey: 'ticket_name',
|
||||||
header: 'Ticket / Lot',
|
header: 'Ticket / Assignment',
|
||||||
size: 170,
|
size: 170,
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium">{row.original.ticket_name}</p>
|
<p className="font-medium">{row.original.ticket_name}</p>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Lot #{row.original.assignment_id}
|
Assignment #{row.original.assignment_id}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ export function ExtensionRequestDecisionDialog({
|
|||||||
: 'Reject extension request'}
|
: 'Reject extension request'}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Review {request.ticket_name}, Lot #{request.assignment_id} before
|
Review {request.ticket_name}, Assignment #{request.assignment_id}{' '}
|
||||||
confirming this decision.
|
before confirming this decision.
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
@@ -205,8 +205,8 @@ export function ExtensionRequestDecisionDialog({
|
|||||||
<AlertDialogTitle>Reject extension request?</AlertDialogTitle>
|
<AlertDialogTitle>Reject extension request?</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
Are you sure you want to reject the extension request for{' '}
|
Are you sure you want to reject the extension request for{' '}
|
||||||
{request.ticket_name}, Lot #{request.assignment_id}? This decision
|
{request.ticket_name}, Assignment #{request.assignment_id}? This
|
||||||
cannot be undone.
|
decision cannot be undone.
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export default function ExtensionRequestsPage() {
|
|||||||
<main className="relative z-10 space-y-5">
|
<main className="relative z-10 space-y-5">
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title="Extension Requests"
|
title="Extension Requests"
|
||||||
description="Track deadline extension requests across all ticket lots."
|
description="Track deadline extension requests across all ticket assignments."
|
||||||
icon={CalendarClock}
|
icon={CalendarClock}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const ModulesLayout = ({
|
|||||||
}>) => {
|
}>) => {
|
||||||
return (
|
return (
|
||||||
<AuthGuard>
|
<AuthGuard>
|
||||||
<SidebarProvider>
|
<SidebarProvider defaultOpen={false}>
|
||||||
<AppSidebar />
|
<AppSidebar />
|
||||||
<main className="flex h-screen min-w-0 flex-1 flex-col overflow-hidden">
|
<main className="flex h-screen min-w-0 flex-1 flex-col overflow-hidden">
|
||||||
<div className="scroll-stable min-w-0 flex-1 overflow-auto">
|
<div className="scroll-stable min-w-0 flex-1 overflow-auto">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import type { ColumnDef, SortingState } from '@tanstack/react-table';
|
import type { ColumnDef, SortingState } from '@tanstack/react-table';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { Edit, RotateCcw } from 'lucide-react';
|
import { Edit, ShieldCheck, ShieldX } from 'lucide-react';
|
||||||
|
|
||||||
import { DataTable } from '@/components/data-table';
|
import { DataTable } from '@/components/data-table';
|
||||||
import { PERMISSIONS } from '@/constants/permissions';
|
import { PERMISSIONS } from '@/constants/permissions';
|
||||||
@@ -58,7 +58,12 @@ export function RoleTable({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: (role) => (role.effective_status ? 'Deactivate' : 'Activate'),
|
label: (role) => (role.effective_status ? 'Deactivate' : 'Activate'),
|
||||||
icon: <RotateCcw className="size-4" />,
|
icon: (role) =>
|
||||||
|
role.effective_status ? (
|
||||||
|
<ShieldX className="size-4 text-destructive" />
|
||||||
|
) : (
|
||||||
|
<ShieldCheck className="size-4 text-emerald-600" />
|
||||||
|
),
|
||||||
permission: PERMISSIONS.ROLE.DELETE,
|
permission: PERMISSIONS.ROLE.DELETE,
|
||||||
disabled: () => isStatusPending,
|
disabled: () => isStatusPending,
|
||||||
onClick: onToggleStatus,
|
onClick: onToggleStatus,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useState } from 'react';
|
|||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import { AlertTriangle, ArrowLeft, LockKeyhole } from 'lucide-react';
|
import { AlertTriangle, ArrowLeft, LockKeyhole } from 'lucide-react';
|
||||||
|
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
@@ -78,7 +79,7 @@ export default function TicketAssignmentPage() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const ticketLabel = overview.ticket_name || overview.id;
|
const ticketName = overview.ticket_name || 'Unnamed ticket';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="relative z-10 space-y-5 xl:flex xl:h-[calc(100vh-6.5rem)] xl:min-h-0 xl:flex-col xl:gap-5 xl:space-y-0 xl:overflow-hidden">
|
<main className="relative z-10 space-y-5 xl:flex xl:h-[calc(100vh-6.5rem)] xl:min-h-0 xl:flex-col xl:gap-5 xl:space-y-0 xl:overflow-hidden">
|
||||||
@@ -93,13 +94,17 @@ export default function TicketAssignmentPage() {
|
|||||||
>
|
>
|
||||||
<ArrowLeft />
|
<ArrowLeft />
|
||||||
</Button>
|
</Button>
|
||||||
<div className="min-w-0 space-y-1">
|
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">
|
<h1 className="text-2xl font-semibold tracking-tight">
|
||||||
Assign ticket
|
Assign Ticket
|
||||||
</h1>
|
</h1>
|
||||||
<p className="truncate text-sm text-muted-foreground">
|
<Badge
|
||||||
Ticket: {ticketLabel}
|
variant="secondary"
|
||||||
</p>
|
className="max-w-full font-mono text-xs"
|
||||||
|
title={ticketName}
|
||||||
|
>
|
||||||
|
<span className="truncate">{ticketName}</span>
|
||||||
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,22 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { BriefcaseBusiness, CalendarClock, ListChecks } from 'lucide-react';
|
import {
|
||||||
|
BriefcaseBusiness,
|
||||||
|
CalendarClock,
|
||||||
|
ChevronDown,
|
||||||
|
Images,
|
||||||
|
ListChecks,
|
||||||
|
} from 'lucide-react';
|
||||||
|
|
||||||
import { PersonInfo } from '@/components/person-avatar';
|
import { PersonInfo } from '@/components/person-avatar';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import {
|
||||||
|
Collapsible,
|
||||||
|
CollapsibleContent,
|
||||||
|
CollapsibleTrigger,
|
||||||
|
} from '@/components/ui/collapsible';
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -260,13 +271,34 @@ export function TicketAssignmentsCard({
|
|||||||
>
|
>
|
||||||
<AssignmentOverview assignment={selectedAssignment} />
|
<AssignmentOverview assignment={selectedAssignment} />
|
||||||
{videoId ? (
|
{videoId ? (
|
||||||
<div className={'mt-4 border-t pt-4'}>
|
<Collapsible
|
||||||
|
key={selectedAssignment.id}
|
||||||
|
className="group mt-4 overflow-hidden rounded-lg border"
|
||||||
|
>
|
||||||
|
<CollapsibleTrigger asChild>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="ghost"
|
||||||
|
className="h-auto w-full justify-between rounded-none px-4 py-3"
|
||||||
|
>
|
||||||
|
<span className="flex items-center gap-2 font-medium">
|
||||||
|
<Images className="size-4 text-primary" />
|
||||||
|
Assigned issue images
|
||||||
|
</span>
|
||||||
|
<ChevronDown className="size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" />
|
||||||
|
</Button>
|
||||||
|
</CollapsibleTrigger>
|
||||||
|
<CollapsibleContent>
|
||||||
|
<div className="border-t p-4">
|
||||||
<TicketDetectionPreview
|
<TicketDetectionPreview
|
||||||
|
key={`${videoId}:${selectedAssignment.id}`}
|
||||||
ticketId={ticketId}
|
ticketId={ticketId}
|
||||||
videoId={videoId}
|
videoId={videoId}
|
||||||
assignmentId={selectedAssignment.id}
|
assignmentId={selectedAssignment.id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</CollapsibleContent>
|
||||||
|
</Collapsible>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ import { OpenRepairReviewAction } from './actions/OpenRepairReviewAction';
|
|||||||
|
|
||||||
export function TicketDetailHeader({
|
export function TicketDetailHeader({
|
||||||
ticket,
|
ticket,
|
||||||
|
backHref,
|
||||||
}: {
|
}: {
|
||||||
ticket: TicketOverviewDetail;
|
ticket: TicketOverviewDetail;
|
||||||
|
backHref: string;
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const ticketName = ticket.ticket_name || 'Unnamed ticket';
|
const ticketName = ticket.ticket_name || 'Unnamed ticket';
|
||||||
@@ -27,7 +29,7 @@ export function TicketDetailHeader({
|
|||||||
type="button"
|
type="button"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={() => router.push('/ticket')}
|
onClick={() => router.push(backHref)}
|
||||||
aria-label="Back to ticket list"
|
aria-label="Back to ticket list"
|
||||||
className="shrink-0"
|
className="shrink-0"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ interface TicketDetectionPreviewProps {
|
|||||||
onDetectionCountChange?: (count: number | undefined) => void;
|
onDetectionCountChange?: (count: number | undefined) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DETECTION_PAGE_SIZE = 10;
|
||||||
|
|
||||||
function DetectionMetadataBar({
|
function DetectionMetadataBar({
|
||||||
items,
|
items,
|
||||||
}: {
|
}: {
|
||||||
@@ -102,6 +104,8 @@ export function TicketDetectionPreview({
|
|||||||
const [currentIndex, setCurrentIndex] = useState(0);
|
const [currentIndex, setCurrentIndex] = useState(0);
|
||||||
const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
|
const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
|
||||||
const isUnassignedPreview = assignmentStatus === 'unassigned';
|
const isUnassignedPreview = assignmentStatus === 'unassigned';
|
||||||
|
const pageStart =
|
||||||
|
Math.floor(currentIndex / DETECTION_PAGE_SIZE) * DETECTION_PAGE_SIZE;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentIndex(0);
|
setCurrentIndex(0);
|
||||||
@@ -109,23 +113,26 @@ export function TicketDetectionPreview({
|
|||||||
|
|
||||||
const queryParams = useMemo(
|
const queryParams = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
skip: currentIndex,
|
skip: pageStart,
|
||||||
limit: 1,
|
limit: DETECTION_PAGE_SIZE,
|
||||||
assignment_id: isUnassignedPreview ? undefined : assignmentId,
|
assignment_id: isUnassignedPreview ? undefined : assignmentId,
|
||||||
assignment_status: isUnassignedPreview
|
assignment_status: isUnassignedPreview
|
||||||
? ('unassigned' as const)
|
? ('unassigned' as const)
|
||||||
: undefined,
|
: undefined,
|
||||||
sort: 'timestamp_asc',
|
sort: 'timestamp_asc',
|
||||||
}),
|
}),
|
||||||
[assignmentId, currentIndex, isUnassignedPreview],
|
[assignmentId, isUnassignedPreview, pageStart],
|
||||||
);
|
);
|
||||||
|
|
||||||
const detectionsQuery = useTicketDetectionsQuery(
|
const detectionsQuery = useTicketDetectionsQuery(
|
||||||
videoId ?? undefined,
|
videoId ?? undefined,
|
||||||
queryParams,
|
queryParams,
|
||||||
|
{ keepPreviousPage: true },
|
||||||
);
|
);
|
||||||
const detectionResult = detectionsQuery.data;
|
const detectionResult = detectionsQuery.data;
|
||||||
const activeDetection = detectionResult?.items[0];
|
const activeDetection = detectionsQuery.isPlaceholderData
|
||||||
|
? undefined
|
||||||
|
: detectionResult?.items[currentIndex - pageStart];
|
||||||
const confirmedDetectionCount = detectionResult?.total;
|
const confirmedDetectionCount = detectionResult?.total;
|
||||||
const detectionCount = confirmedDetectionCount ?? 0;
|
const detectionCount = confirmedDetectionCount ?? 0;
|
||||||
const activeVisual = getDefectVisual(
|
const activeVisual = getDefectVisual(
|
||||||
@@ -156,12 +163,15 @@ export function TicketDetectionPreview({
|
|||||||
}, [confirmedDetectionCount, currentIndex]);
|
}, [confirmedDetectionCount, currentIndex]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onDetectionCountChange?.(confirmedDetectionCount);
|
onDetectionCountChange?.(detectionCount);
|
||||||
}, [confirmedDetectionCount, onDetectionCountChange]);
|
}, [detectionCount, onDetectionCountChange]);
|
||||||
|
|
||||||
const isNavigationDisabled =
|
const isNavigationDisabled =
|
||||||
detectionCount === 0 || detectionsQuery.isLoading;
|
detectionCount === 0 ||
|
||||||
const isInitialLoading = detectionsQuery.isLoading;
|
detectionsQuery.isLoading ||
|
||||||
|
detectionsQuery.isPlaceholderData;
|
||||||
|
const isInitialLoading =
|
||||||
|
detectionsQuery.isLoading || detectionsQuery.isPlaceholderData;
|
||||||
const isError = detectionsQuery.isError;
|
const isError = detectionsQuery.isError;
|
||||||
const retry = () => void detectionsQuery.refetch();
|
const retry = () => void detectionsQuery.refetch();
|
||||||
|
|
||||||
@@ -221,7 +231,7 @@ export function TicketDetectionPreview({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isInitialLoading && !activeDetection ? (
|
{isInitialLoading ? (
|
||||||
<TicketDetectionPreviewSkeleton />
|
<TicketDetectionPreviewSkeleton />
|
||||||
) : isError ? (
|
) : isError ? (
|
||||||
<div className="rounded-lg border border-dashed border-destructive/40 bg-destructive/5 px-4 py-8 text-center">
|
<div className="rounded-lg border border-dashed border-destructive/40 bg-destructive/5 px-4 py-8 text-center">
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export function TicketDetectionPreviewCard({
|
|||||||
<CardContent className="p-5">
|
<CardContent className="p-5">
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<TicketDetectionPreview
|
<TicketDetectionPreview
|
||||||
|
key={`${videoId}:${assignmentId}`}
|
||||||
ticketId={ticketId}
|
ticketId={ticketId}
|
||||||
videoId={videoId}
|
videoId={videoId}
|
||||||
assignmentId={assignmentId}
|
assignmentId={assignmentId}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export function TicketUnassignedIssuesCard({
|
|||||||
<CardContent className={'p-5'}>
|
<CardContent className={'p-5'}>
|
||||||
<div className={'min-w-0'}>
|
<div className={'min-w-0'}>
|
||||||
<TicketDetectionPreview
|
<TicketDetectionPreview
|
||||||
|
key={`${videoId}:unassigned`}
|
||||||
ticketId={ticketId}
|
ticketId={ticketId}
|
||||||
videoId={videoId}
|
videoId={videoId}
|
||||||
assignmentStatus={'unassigned'}
|
assignmentStatus={'unassigned'}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ export function ExtensionRequestHistoryDialog({
|
|||||||
<DialogTitle>Extension Request History</DialogTitle>
|
<DialogTitle>Extension Request History</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Review every deadline extension request and manager decision for
|
Review every deadline extension request and manager decision for
|
||||||
this ticket lot.
|
this ticket assignment.
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<DialogBody className="space-y-3">
|
<DialogBody className="space-y-3">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export function RequestExtensionAction({
|
|||||||
<TicketActionCard
|
<TicketActionCard
|
||||||
icon={Clock3}
|
icon={Clock3}
|
||||||
title={canRequest ? 'Request Extension' : 'Extension Request History'}
|
title={canRequest ? 'Request Extension' : 'Extension Request History'}
|
||||||
contextLabel={`Lot ${assignmentId}`}
|
contextLabel={`Assignment ${assignmentId}`}
|
||||||
>
|
>
|
||||||
<TicketExtensionRequestPanel
|
<TicketExtensionRequestPanel
|
||||||
ticketId={ticketId}
|
ticketId={ticketId}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ function ExtensionReviewForm({
|
|||||||
<TicketActionCard
|
<TicketActionCard
|
||||||
icon={CalendarClock}
|
icon={CalendarClock}
|
||||||
title="Extension Request Details"
|
title="Extension Request Details"
|
||||||
contextLabel={`Lot ${assignmentId}`}
|
contextLabel={`Assignment ${assignmentId}`}
|
||||||
>
|
>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<Requester request={request} />
|
<Requester request={request} />
|
||||||
@@ -271,7 +271,7 @@ export function ReviewExtensionRequestAction({
|
|||||||
<TicketActionCard
|
<TicketActionCard
|
||||||
icon={Clock3}
|
icon={Clock3}
|
||||||
title="Extension Request"
|
title="Extension Request"
|
||||||
contextLabel={`Lot ${assignmentId}`}
|
contextLabel={`Assignment ${assignmentId}`}
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-center py-8 text-muted-foreground">
|
<div className="flex items-center justify-center py-8 text-muted-foreground">
|
||||||
<Loader2 className="mr-2 size-4 animate-spin" />
|
<Loader2 className="mr-2 size-4 animate-spin" />
|
||||||
@@ -298,7 +298,7 @@ export function ReviewExtensionRequestAction({
|
|||||||
<TicketActionCard
|
<TicketActionCard
|
||||||
icon={CalendarClock}
|
icon={CalendarClock}
|
||||||
title="Extension Request"
|
title="Extension Request"
|
||||||
contextLabel={`Lot ${assignmentId}`}
|
contextLabel={`Assignment ${assignmentId}`}
|
||||||
>
|
>
|
||||||
<ExtensionRequestDetails request={latestRequest} requests={requests} />
|
<ExtensionRequestDetails request={latestRequest} requests={requests} />
|
||||||
</TicketActionCard>
|
</TicketActionCard>
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ export function TicketExtensionRequestPanel({
|
|||||||
if (!canRequest) {
|
if (!canRequest) {
|
||||||
return (
|
return (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
No extension request history is available for this ticket lot.
|
No extension request history is available for this ticket assignment.
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { ArrowLeft } from 'lucide-react';
|
import { ArrowLeft } from 'lucide-react';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { PERMISSIONS } from '@/constants/permissions';
|
import { PERMISSIONS } from '@/constants/permissions';
|
||||||
import { PermissionGuard } from '@/guards';
|
import { PermissionGuard } from '@/guards';
|
||||||
|
import { ROUTES } from '@/utils/routes';
|
||||||
|
|
||||||
import { TicketDetailHeader } from './components/TicketDetailHeader';
|
import { TicketDetailHeader } from './components/TicketDetailHeader';
|
||||||
import {
|
import {
|
||||||
@@ -26,8 +27,20 @@ import {
|
|||||||
|
|
||||||
export default function TicketDetailPage() {
|
export default function TicketDetailPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
const { ticketId } = useParams() as { ticketId: string };
|
const { ticketId } = useParams() as { ticketId: string };
|
||||||
const [selectedAssignmentId, setSelectedAssignmentId] = useState<number>();
|
const [selectedAssignmentId, setSelectedAssignmentId] = useState<number>();
|
||||||
|
const listParams = new URLSearchParams();
|
||||||
|
|
||||||
|
for (const key of ['page', 'limit', 'segment']) {
|
||||||
|
const value = searchParams.get(key);
|
||||||
|
if (value) listParams.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const listSearch = listParams.toString();
|
||||||
|
const ticketListHref = listSearch
|
||||||
|
? `${ROUTES.TICKET}?${listSearch}`
|
||||||
|
: ROUTES.TICKET;
|
||||||
|
|
||||||
const overviewQuery = useTicketOverviewQuery(ticketId);
|
const overviewQuery = useTicketOverviewQuery(ticketId);
|
||||||
const overview = overviewQuery.data;
|
const overview = overviewQuery.data;
|
||||||
@@ -52,7 +65,7 @@ export default function TicketDetailPage() {
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => router.push('/ticket')}
|
onClick={() => router.push(ticketListHref)}
|
||||||
>
|
>
|
||||||
<ArrowLeft />
|
<ArrowLeft />
|
||||||
Back to Tickets
|
Back to Tickets
|
||||||
@@ -65,7 +78,7 @@ export default function TicketDetailPage() {
|
|||||||
<main className="relative z-10 min-w-0 max-w-full space-y-5 xl:flex xl:h-[calc(100vh-6.5rem)] xl:min-h-0 xl:flex-col xl:gap-5 xl:space-y-0 xl:overflow-hidden">
|
<main className="relative z-10 min-w-0 max-w-full space-y-5 xl:flex xl:h-[calc(100vh-6.5rem)] xl:min-h-0 xl:flex-col xl:gap-5 xl:space-y-0 xl:overflow-hidden">
|
||||||
<div className="xl:shrink-0">
|
<div className="xl:shrink-0">
|
||||||
{overview ? (
|
{overview ? (
|
||||||
<TicketDetailHeader ticket={overview} />
|
<TicketDetailHeader ticket={overview} backHref={ticketListHref} />
|
||||||
) : (
|
) : (
|
||||||
<TicketOverviewHeaderSkeleton />
|
<TicketOverviewHeaderSkeleton />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -176,13 +176,9 @@ export function IssueReviewAction({
|
|||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="default"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
onClick={() => void submitDecision('approve')}
|
onClick={() => void submitDecision('approve')}
|
||||||
className={cn(
|
|
||||||
decision === 'approve' &&
|
|
||||||
'border-emerald-500 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/15 dark:text-emerald-300',
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isPending && decision === 'approve' ? (
|
{isPending && decision === 'approve' ? (
|
||||||
<Loader2 className="animate-spin" />
|
<Loader2 className="animate-spin" />
|
||||||
@@ -193,13 +189,9 @@ export function IssueReviewAction({
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="destructive"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
onClick={() => void submitDecision('reject')}
|
onClick={() => void submitDecision('reject')}
|
||||||
className={cn(
|
|
||||||
decision === 'reject' &&
|
|
||||||
'border-destructive bg-destructive/10 text-destructive hover:bg-destructive/15',
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{isPending && decision === 'reject' ? (
|
{isPending && decision === 'reject' ? (
|
||||||
<Loader2 className="animate-spin" />
|
<Loader2 className="animate-spin" />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
|
keepPreviousData,
|
||||||
useInfiniteQuery,
|
useInfiniteQuery,
|
||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
@@ -28,6 +29,11 @@ import { extensionRequestKeys } from '../../extension-requests/queries/extension
|
|||||||
|
|
||||||
const TICKET_TABLE_REFRESH_MS = 5 * 60 * 1000;
|
const TICKET_TABLE_REFRESH_MS = 5 * 60 * 1000;
|
||||||
|
|
||||||
|
interface TicketDetectionsQueryOptions {
|
||||||
|
enabled?: boolean;
|
||||||
|
keepPreviousPage?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface UseTicketsQueryParams {
|
interface UseTicketsQueryParams {
|
||||||
skip: number;
|
skip: number;
|
||||||
limit: number;
|
limit: number;
|
||||||
@@ -113,8 +119,9 @@ export function useTicketAssignmentsQuery(
|
|||||||
export function useTicketDetectionsQuery(
|
export function useTicketDetectionsQuery(
|
||||||
videoId: string | undefined,
|
videoId: string | undefined,
|
||||||
params: VideoDetectionsParams,
|
params: VideoDetectionsParams,
|
||||||
enabled = true,
|
options: TicketDetectionsQueryOptions = {},
|
||||||
) {
|
) {
|
||||||
|
const { enabled = true, keepPreviousPage = false } = options;
|
||||||
const queryParams = useMemo(
|
const queryParams = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
skip: params.skip ?? 0,
|
skip: params.skip ?? 0,
|
||||||
@@ -143,6 +150,7 @@ export function useTicketDetectionsQuery(
|
|||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
videoService.getVideoDetections(videoId as string, queryParams),
|
videoService.getVideoDetections(videoId as string, queryParams),
|
||||||
enabled: Boolean(enabled && videoId),
|
enabled: Boolean(enabled && videoId),
|
||||||
|
placeholderData: keepPreviousPage ? keepPreviousData : undefined,
|
||||||
staleTime: Infinity,
|
staleTime: Infinity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { PageHeader } from '@/components/page-header';
|
import { PageHeader } from '@/components/page-header';
|
||||||
import { Ticket } from 'lucide-react';
|
import { Ticket } from 'lucide-react';
|
||||||
import type { TicketListItem } from '@/types';
|
import type { TicketListItem } from '@/types';
|
||||||
@@ -17,11 +17,48 @@ import {
|
|||||||
useTicketSummaryQuery,
|
useTicketSummaryQuery,
|
||||||
} from './hooks/useTicketQueries';
|
} from './hooks/useTicketQueries';
|
||||||
|
|
||||||
|
const DEFAULT_PAGE = 1;
|
||||||
|
const DEFAULT_LIMIT = 10;
|
||||||
|
const PAGE_SIZE_OPTIONS = new Set([10, 20, 40, 50, 100]);
|
||||||
|
|
||||||
|
function parsePage(value: string | null) {
|
||||||
|
const page = Number(value);
|
||||||
|
return Number.isInteger(page) && page > 0 ? page : DEFAULT_PAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseLimit(value: string | null) {
|
||||||
|
const limit = Number(value);
|
||||||
|
return PAGE_SIZE_OPTIONS.has(limit) ? limit : DEFAULT_LIMIT;
|
||||||
|
}
|
||||||
|
|
||||||
export default function TicketPage() {
|
export default function TicketPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [skip, setSkip] = useState(0);
|
const pathname = usePathname();
|
||||||
const [limit, setLimit] = useState(10);
|
const searchParams = useSearchParams();
|
||||||
const [segmentId, setSegmentId] = useState('');
|
const searchParamsString = searchParams.toString();
|
||||||
|
const latestSearchParamsRef = useRef(searchParamsString);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
latestSearchParamsRef.current = searchParamsString;
|
||||||
|
}, [searchParamsString]);
|
||||||
|
|
||||||
|
const page = parsePage(searchParams.get('page'));
|
||||||
|
const limit = parseLimit(searchParams.get('limit'));
|
||||||
|
const segmentId = searchParams.get('segment') ?? '';
|
||||||
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
|
const replaceListParams = useCallback(
|
||||||
|
(update: (params: URLSearchParams) => void) => {
|
||||||
|
const nextParams = new URLSearchParams(latestSearchParamsRef.current);
|
||||||
|
update(nextParams);
|
||||||
|
const nextSearch = nextParams.toString();
|
||||||
|
latestSearchParamsRef.current = nextSearch;
|
||||||
|
router.replace(nextSearch ? `${pathname}?${nextSearch}` : pathname, {
|
||||||
|
scroll: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[pathname, router],
|
||||||
|
);
|
||||||
|
|
||||||
useTenantTicketTableEvents();
|
useTenantTicketTableEvents();
|
||||||
|
|
||||||
@@ -36,16 +73,56 @@ export default function TicketPage() {
|
|||||||
const tickets = ticketsQuery.data?.items ?? [];
|
const tickets = ticketsQuery.data?.items ?? [];
|
||||||
const total = ticketsQuery.data?.total ?? 0;
|
const total = ticketsQuery.data?.total ?? 0;
|
||||||
|
|
||||||
const handleSegmentChange = useCallback((nextSegmentId: string) => {
|
const handleSegmentChange = useCallback(
|
||||||
setSegmentId(nextSegmentId);
|
(nextSegmentId: string) => {
|
||||||
setSkip(0);
|
replaceListParams((params) => {
|
||||||
}, []);
|
params.delete('page');
|
||||||
|
if (nextSegmentId) {
|
||||||
|
params.set('segment', nextSegmentId);
|
||||||
|
} else {
|
||||||
|
params.delete('segment');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[replaceListParams],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handlePageChange = useCallback(
|
||||||
|
(nextSkip: number) => {
|
||||||
|
const nextPage = Math.floor(nextSkip / limit) + 1;
|
||||||
|
replaceListParams((params) => {
|
||||||
|
if (nextPage === DEFAULT_PAGE) {
|
||||||
|
params.delete('page');
|
||||||
|
} else {
|
||||||
|
params.set('page', String(nextPage));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[limit, replaceListParams],
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleLimitChange = useCallback(
|
||||||
|
(nextLimit: number) => {
|
||||||
|
replaceListParams((params) => {
|
||||||
|
params.delete('page');
|
||||||
|
if (nextLimit === DEFAULT_LIMIT) {
|
||||||
|
params.delete('limit');
|
||||||
|
} else {
|
||||||
|
params.set('limit', String(nextLimit));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[replaceListParams],
|
||||||
|
);
|
||||||
|
|
||||||
const handleView = useCallback(
|
const handleView = useCallback(
|
||||||
(ticket: TicketListItem) => {
|
(ticket: TicketListItem) => {
|
||||||
router.push(ROUTES.TICKET_DETAIL(ticket.id));
|
const detailPath = ROUTES.TICKET_DETAIL(ticket.id);
|
||||||
|
router.push(
|
||||||
|
searchParamsString ? `${detailPath}?${searchParamsString}` : detailPath,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
[router],
|
[router, searchParamsString],
|
||||||
);
|
);
|
||||||
|
|
||||||
const toolbar = useMemo(
|
const toolbar = useMemo(
|
||||||
@@ -81,8 +158,8 @@ export default function TicketPage() {
|
|||||||
skip={skip}
|
skip={skip}
|
||||||
limit={limit}
|
limit={limit}
|
||||||
total={total}
|
total={total}
|
||||||
onPageChange={setSkip}
|
onPageChange={handlePageChange}
|
||||||
onLimitChange={setLimit}
|
onLimitChange={handleLimitChange}
|
||||||
onView={handleView}
|
onView={handleView}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import type { ColumnDef, SortingState } from '@tanstack/react-table';
|
import type { ColumnDef, SortingState } from '@tanstack/react-table';
|
||||||
import { Edit, RotateCcw } from 'lucide-react';
|
import { Edit, UserCheck, UserX } from 'lucide-react';
|
||||||
|
|
||||||
import { DataTable } from '@/components/data-table';
|
import { DataTable } from '@/components/data-table';
|
||||||
import { PERMISSIONS } from '@/constants/permissions';
|
import { PERMISSIONS } from '@/constants/permissions';
|
||||||
@@ -59,7 +59,12 @@ export function UserTable({
|
|||||||
{
|
{
|
||||||
label: (user) =>
|
label: (user) =>
|
||||||
user.effective_status === 'active' ? 'Deactivate' : 'Activate',
|
user.effective_status === 'active' ? 'Deactivate' : 'Activate',
|
||||||
icon: <RotateCcw className="size-4" />,
|
icon: (user) =>
|
||||||
|
user.effective_status === 'active' ? (
|
||||||
|
<UserX className="size-4 text-destructive" />
|
||||||
|
) : (
|
||||||
|
<UserCheck className="size-4 text-emerald-600" />
|
||||||
|
),
|
||||||
permission: PERMISSIONS.USER.DELETE,
|
permission: PERMISSIONS.USER.DELETE,
|
||||||
disabled: (user) =>
|
disabled: (user) =>
|
||||||
pendingUserId === user.id || user.effective_status === 'pending',
|
pendingUserId === user.id || user.effective_status === 'pending',
|
||||||
|
|||||||
@@ -140,6 +140,40 @@
|
|||||||
|
|
||||||
* {
|
* {
|
||||||
@apply outline-none border-border outline-ring/50;
|
@apply outline-none border-border outline-ring/50;
|
||||||
|
scrollbar-color: color-mix(
|
||||||
|
in oklab,
|
||||||
|
var(--muted-foreground) 45%,
|
||||||
|
transparent
|
||||||
|
)
|
||||||
|
transparent;
|
||||||
|
scrollbar-width: thin;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-track,
|
||||||
|
*::-webkit-scrollbar-corner {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
border-radius: 9999px;
|
||||||
|
background-color: color-mix(
|
||||||
|
in oklab,
|
||||||
|
var(--muted-foreground) 45%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: color-mix(
|
||||||
|
in oklab,
|
||||||
|
var(--muted-foreground) 70%,
|
||||||
|
transparent
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ import {
|
|||||||
CollapsibleContent,
|
CollapsibleContent,
|
||||||
CollapsibleTrigger,
|
CollapsibleTrigger,
|
||||||
} from '@/components/ui/collapsible';
|
} from '@/components/ui/collapsible';
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuLabel,
|
||||||
|
DropdownMenuSeparator,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from '@/components/ui/dropdown-menu';
|
||||||
import {
|
import {
|
||||||
Sidebar,
|
Sidebar,
|
||||||
SidebarContent,
|
SidebarContent,
|
||||||
@@ -124,6 +132,7 @@ function SidebarNavItem({
|
|||||||
item: MenuItem;
|
item: MenuItem;
|
||||||
pathname: string;
|
pathname: string;
|
||||||
}) {
|
}) {
|
||||||
|
const { isMobile, state } = useSidebar();
|
||||||
const isActive = isRouteActive(pathname, item.path);
|
const isActive = isRouteActive(pathname, item.path);
|
||||||
const isChildActive =
|
const isChildActive =
|
||||||
item.children?.some((child) => isRouteActive(pathname, child.path)) ??
|
item.children?.some((child) => isRouteActive(pathname, child.path)) ??
|
||||||
@@ -136,6 +145,52 @@ function SidebarNavItem({
|
|||||||
}, [isChildActive]);
|
}, [isChildActive]);
|
||||||
|
|
||||||
if (hasChildren) {
|
if (hasChildren) {
|
||||||
|
if (state === 'collapsed' && !isMobile) {
|
||||||
|
return (
|
||||||
|
<SidebarMenuItem>
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<SidebarMenuButton
|
||||||
|
isActive={isChildActive}
|
||||||
|
aria-label={item.title}
|
||||||
|
>
|
||||||
|
<item.icon />
|
||||||
|
<span>{item.title}</span>
|
||||||
|
<ChevronRight className="ml-auto" />
|
||||||
|
</SidebarMenuButton>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent
|
||||||
|
side="right"
|
||||||
|
align="start"
|
||||||
|
sideOffset={8}
|
||||||
|
className="min-w-48"
|
||||||
|
>
|
||||||
|
<DropdownMenuLabel>{item.title}</DropdownMenuLabel>
|
||||||
|
<DropdownMenuSeparator />
|
||||||
|
{item.children?.map((child) =>
|
||||||
|
child.path ? (
|
||||||
|
<DropdownMenuItem
|
||||||
|
key={child.title}
|
||||||
|
asChild
|
||||||
|
className={
|
||||||
|
isRouteActive(pathname, child.path)
|
||||||
|
? 'bg-accent text-accent-foreground'
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Link href={child.path}>
|
||||||
|
<child.icon />
|
||||||
|
<span>{child.title}</span>
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
) : null,
|
||||||
|
)}
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
</SidebarMenuItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Collapsible
|
<Collapsible
|
||||||
asChild
|
asChild
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { getPinnedColumnStyles } from './columnStyles';
|
|||||||
|
|
||||||
const TableHeader = <TData, _>({ table }: { table: Table<TData> }) => {
|
const TableHeader = <TData, _>({ table }: { table: Table<TData> }) => {
|
||||||
return (
|
return (
|
||||||
<ShadTableHeader className="sticky top-0 z-20 bg-muted/70 backdrop-blur supports-backdrop-filter:bg-muted/60">
|
<ShadTableHeader className="sticky top-0 z-20 bg-muted">
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
<TableRow key={headerGroup.id}>
|
<TableRow key={headerGroup.id}>
|
||||||
{headerGroup.headers.map((header) => {
|
{headerGroup.headers.map((header) => {
|
||||||
@@ -39,7 +39,7 @@ const TableHeader = <TData, _>({ table }: { table: Table<TData> }) => {
|
|||||||
canSort ? header.column.getToggleSortingHandler() : undefined
|
canSort ? header.column.getToggleSortingHandler() : undefined
|
||||||
}
|
}
|
||||||
className={cn(
|
className={cn(
|
||||||
'h-11 max-w-0 overflow-hidden border-b border-border bg-muted/70 px-4 text-sm font-semibold text-foreground transition-colors',
|
'h-11 max-w-0 overflow-hidden border-b border-border bg-muted px-4 text-sm font-semibold text-foreground transition-colors',
|
||||||
canSort && 'cursor-pointer select-none hover:bg-muted',
|
canSort && 'cursor-pointer select-none hover:bg-muted',
|
||||||
sortDirection && 'bg-muted',
|
sortDirection && 'bg-muted',
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export type ColumnAlign = 'left' | 'right';
|
|||||||
|
|
||||||
export interface DataTableAction<TData> {
|
export interface DataTableAction<TData> {
|
||||||
label: string | ((item: TData) => string);
|
label: string | ((item: TData) => string);
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode | ((item: TData) => React.ReactNode);
|
||||||
onClick: (item: TData) => void;
|
onClick: (item: TData) => void;
|
||||||
permission?: PermissionInput;
|
permission?: PermissionInput;
|
||||||
disabled?: (item: TData) => boolean;
|
disabled?: (item: TData) => boolean;
|
||||||
@@ -163,6 +163,10 @@ function DataTableContent<TData, TValue>({
|
|||||||
typeof action.label === 'function'
|
typeof action.label === 'function'
|
||||||
? action.label(item)
|
? action.label(item)
|
||||||
: action.label;
|
: action.label;
|
||||||
|
const icon =
|
||||||
|
typeof action.icon === 'function'
|
||||||
|
? action.icon(item)
|
||||||
|
: action.icon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableActionButton
|
<TableActionButton
|
||||||
@@ -176,7 +180,7 @@ function DataTableContent<TData, TValue>({
|
|||||||
action.onClick(item);
|
action.onClick(item);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{action.icon}
|
{icon}
|
||||||
</TableActionButton>
|
</TableActionButton>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -41,11 +41,7 @@ export default function AnnotatedDetectionImage({
|
|||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const aspectRatio =
|
const aspectRatio = aspectRatioOverride ?? '16 / 9';
|
||||||
aspectRatioOverride ??
|
|
||||||
(videoWidth > 0 && videoHeight > 0
|
|
||||||
? `${videoWidth} / ${videoHeight}`
|
|
||||||
: '16 / 9');
|
|
||||||
|
|
||||||
const annotatedMedia = objectUrl ? (
|
const annotatedMedia = objectUrl ? (
|
||||||
<>
|
<>
|
||||||
@@ -75,14 +71,7 @@ export default function AnnotatedDetectionImage({
|
|||||||
className="group relative flex w-full cursor-zoom-in items-center justify-center overflow-hidden rounded-lg border bg-black focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
className="group relative flex w-full cursor-zoom-in items-center justify-center overflow-hidden rounded-lg border bg-black focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||||
style={{ aspectRatio }}
|
style={{ aspectRatio }}
|
||||||
>
|
>
|
||||||
<Image
|
{annotatedMedia}
|
||||||
src={objectUrl}
|
|
||||||
alt={`${detection.detection.display_name} detection`}
|
|
||||||
fill
|
|
||||||
unoptimized
|
|
||||||
sizes="(min-width: 1280px) 18rem, (min-width: 640px) 50vw, 100vw"
|
|
||||||
className="object-contain"
|
|
||||||
/>
|
|
||||||
<span className="pointer-events-none absolute inset-x-0 bottom-0 z-[3] bg-gradient-to-t from-black/70 to-transparent px-3 pb-2 pt-8 text-center text-xs font-medium text-white opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100">
|
<span className="pointer-events-none absolute inset-x-0 bottom-0 z-[3] bg-gradient-to-t from-black/70 to-transparent px-3 pb-2 pt-8 text-center text-xs font-medium text-white opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100">
|
||||||
Click to view annotated image
|
Click to view annotated image
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user