Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,47 +88,54 @@ export function BackgroundCheckAdminActions({
};

return (
<HStack gap="2">
{showRetry && (
<Button type="button" variant="outline" disabled={pending !== null} onClick={handleRetry}>
Retry
</Button>
)}
{showCancel && (
<Button type="button" variant="outline" disabled={pending !== null} onClick={handleCancel}>
Cancel check
</Button>
)}
{showDelete && !confirmingDelete && (
<Button
type="button"
variant="destructive"
disabled={pending !== null}
onClick={() => setConfirmingDelete(true)}
>
Delete
</Button>
)}
{showDelete && confirmingDelete && (
<>
<div className="border-t pt-4">
<HStack gap="2">
{showRetry && (
<Button type="button" variant="outline" disabled={pending !== null} onClick={handleRetry}>
Retry
</Button>
)}
{showCancel && (
<Button
type="button"
variant="destructive"
variant="outline"
disabled={pending !== null}
onClick={handleDelete}
onClick={handleCancel}
>
Confirm delete
Cancel check
</Button>
)}
{showDelete && !confirmingDelete && (
<Button
type="button"
variant="outline"
variant="destructive"
disabled={pending !== null}
onClick={() => setConfirmingDelete(false)}
onClick={() => setConfirmingDelete(true)}
>
Keep
Delete
</Button>
</>
)}
</HStack>
)}
{showDelete && confirmingDelete && (
<>
<Button
type="button"
variant="destructive"
disabled={pending !== null}
onClick={handleDelete}
>
Confirm delete
</Button>
<Button
type="button"
variant="outline"
disabled={pending !== null}
onClick={() => setConfirmingDelete(false)}
>
Keep
</Button>
</>
)}
</HStack>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { apiClient } from '@/lib/api-client';
import { Badge, Button, Grid, HStack, Stack, Text } from '@trycompai/design-system';
import type { ReactNode } from 'react';
import { toast } from 'sonner';
import useSWR from 'swr';
import { BackgroundCheckReport } from './BackgroundCheckReport';
Expand Down Expand Up @@ -33,11 +34,13 @@ export function BackgroundCheckStatusView({
confirmation,
memberId,
organizationId,
actions,
}: {
backgroundCheck: BackgroundCheckRecord;
confirmation?: string | null;
memberId?: string;
organizationId?: string;
actions?: ReactNode;
}) {
const isComplete = isCompletedBackgroundCheck(backgroundCheck.status);
const customAttachmentsKey =
Expand Down Expand Up @@ -107,6 +110,8 @@ export function BackgroundCheckStatusView({
</Grid>

<ComponentStatuses backgroundCheck={backgroundCheck} />

{actions}
</Stack>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,20 @@ export function EmployeeBackgroundCheck({
canUpdate={canRequest}
onToggle={handleToggleExempt}
/>
<BackgroundCheckAdminActions
backgroundCheck={backgroundCheck}
memberId={employee.id}
organizationId={organizationId}
onChange={(next) => {
mutateBackgroundCheck(next, { revalidate: false });
}}
/>
<BackgroundCheckStatusView
backgroundCheck={backgroundCheck}
memberId={employee.id}
organizationId={organizationId}
actions={
<BackgroundCheckAdminActions
backgroundCheck={backgroundCheck}
memberId={employee.id}
organizationId={organizationId}
onChange={(next) => {
mutateBackgroundCheck(next, { revalidate: false });
}}
/>
}
/>
</Stack>
);
Expand Down
Loading