Fix apps/console lint issues
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -60,7 +60,7 @@ export function DeleteTrustCenterReferenceDialog({
|
||||
<p className="text-txt-secondary">
|
||||
{sprintf(
|
||||
__("Are you sure you want to delete the reference \"%s\"?"),
|
||||
referenceName
|
||||
referenceName,
|
||||
)}
|
||||
</p>
|
||||
<p className="text-txt-secondary mt-2">
|
||||
@@ -71,7 +71,7 @@ export function DeleteTrustCenterReferenceDialog({
|
||||
<DialogFooter>
|
||||
<Button
|
||||
variant="danger"
|
||||
onClick={handleDelete}
|
||||
onClick={() => void handleDelete()}
|
||||
disabled={isDeleting}
|
||||
icon={isDeleting ? Spinner : IconTrashCan}
|
||||
>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useFragment } from "react-relay";
|
||||
import { useMemo, useState, useCallback, useEffect } from "react";
|
||||
import { useMemo, useState, useCallback } from "react";
|
||||
import {
|
||||
sprintf,
|
||||
getAuditStateVariant,
|
||||
@@ -47,7 +47,7 @@ type Mutation<Params> = (p: {
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
||||
} & Params;
|
||||
};
|
||||
}) => void;
|
||||
}) => Promise<void>;
|
||||
|
||||
type Props<Params> = {
|
||||
audits: TrustCenterAuditsCardFragment$key[];
|
||||
@@ -65,11 +65,11 @@ export function TrustCenterAuditsCard<Params>(props: Props<Params>) {
|
||||
}, [props.audits, limit]);
|
||||
const showMoreButton = limit !== null && props.audits.length > limit;
|
||||
|
||||
const onChangeVisibility = (
|
||||
const onChangeVisibility = async (
|
||||
auditId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => {
|
||||
props.onChangeVisibility({
|
||||
await props.onChangeVisibility({
|
||||
variables: {
|
||||
input: {
|
||||
id: auditId,
|
||||
@@ -130,7 +130,7 @@ function AuditRow(props: {
|
||||
onChangeVisibility: (
|
||||
auditId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => void;
|
||||
) => Promise<void>;
|
||||
disabled?: boolean;
|
||||
canUpdate: boolean;
|
||||
}) {
|
||||
@@ -138,26 +138,16 @@ function AuditRow(props: {
|
||||
const audit = useFragment(trustCenterAuditFragment, auditFragmentRef);
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
const [optimisticValue, setOptimisticValue] = useState<string | null>(null);
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(value: string) => {
|
||||
async (value: string) => {
|
||||
const stringValue = typeof value === "string" ? value : "";
|
||||
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||
setOptimisticValue(typedValue);
|
||||
onChangeVisibility(audit.id, typedValue);
|
||||
await onChangeVisibility(audit.id, typedValue);
|
||||
},
|
||||
[audit.id, onChangeVisibility],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (optimisticValue && audit.trustCenterVisibility === optimisticValue) {
|
||||
setOptimisticValue(null);
|
||||
}
|
||||
}, [audit.trustCenterVisibility, optimisticValue]);
|
||||
|
||||
const currentValue = optimisticValue || audit.trustCenterVisibility;
|
||||
|
||||
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||
|
||||
const validUntilFormatted = audit.validUntil
|
||||
@@ -179,12 +169,12 @@ function AuditRow(props: {
|
||||
<Td noLink width={130} className="pr-0">
|
||||
<Field
|
||||
type="select"
|
||||
value={currentValue}
|
||||
onValueChange={handleValueChange}
|
||||
value={audit.trustCenterVisibility}
|
||||
onValueChange={value => void handleValueChange(value)}
|
||||
disabled={disabled || !canUpdate}
|
||||
className="w-[105px]"
|
||||
>
|
||||
{visibilityOptions.map((option) => (
|
||||
{visibilityOptions.map(option => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
<div className="flex items-center justify-between w-full">
|
||||
<Badge variant={option.variant}>{option.label}</Badge>
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import type { TrustCenterDocumentsCardFragment$key } from "/__generated__/core/TrustCenterDocumentsCardFragment.graphql";
|
||||
import { useFragment } from "react-relay";
|
||||
import { useMemo, useState, useCallback, useEffect } from "react";
|
||||
import { useMemo, useState, useCallback } from "react";
|
||||
import { sprintf, getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
|
||||
@@ -46,7 +46,7 @@ type Mutation<Params> = (p: {
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
||||
} & Params;
|
||||
};
|
||||
}) => void;
|
||||
}) => Promise<void>;
|
||||
|
||||
type Props<Params> = {
|
||||
documents: TrustCenterDocumentsCardFragment$key[];
|
||||
@@ -64,11 +64,11 @@ export function TrustCenterDocumentsCard<Params>(props: Props<Params>) {
|
||||
}, [props.documents, limit]);
|
||||
const showMoreButton = limit !== null && props.documents.length > limit;
|
||||
|
||||
const onChangeVisibility = (
|
||||
const onChangeVisibility = async (
|
||||
documentId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => {
|
||||
props.onChangeVisibility({
|
||||
await props.onChangeVisibility({
|
||||
variables: {
|
||||
input: {
|
||||
id: documentId,
|
||||
@@ -128,38 +128,28 @@ function DocumentRow(props: {
|
||||
onChangeVisibility: (
|
||||
documentId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => void;
|
||||
) => Promise<void>;
|
||||
disabled?: boolean;
|
||||
canUpdate: boolean;
|
||||
}) {
|
||||
const { documentFragmentRef, onChangeVisibility, disabled, canUpdate } =
|
||||
props;
|
||||
const { documentFragmentRef, onChangeVisibility, disabled, canUpdate }
|
||||
= props;
|
||||
const document = useFragment(
|
||||
trustCenterDocumentFragment,
|
||||
documentFragmentRef,
|
||||
);
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
const [optimisticValue, setOptimisticValue] = useState<string | null>(null);
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(value: string) => {
|
||||
async (value: string) => {
|
||||
const stringValue = typeof value === "string" ? value : "";
|
||||
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||
setOptimisticValue(typedValue);
|
||||
onChangeVisibility(document.id, typedValue);
|
||||
await onChangeVisibility(document.id, typedValue);
|
||||
},
|
||||
[document.id, onChangeVisibility],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (optimisticValue && document.trustCenterVisibility === optimisticValue) {
|
||||
setOptimisticValue(null);
|
||||
}
|
||||
}, [document.trustCenterVisibility, optimisticValue]);
|
||||
|
||||
const currentValue = optimisticValue || document.trustCenterVisibility;
|
||||
|
||||
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||
|
||||
return (
|
||||
@@ -178,12 +168,12 @@ function DocumentRow(props: {
|
||||
<Td noLink width={130} className="pr-0">
|
||||
<Field
|
||||
type="select"
|
||||
value={currentValue}
|
||||
onValueChange={handleValueChange}
|
||||
value={document.trustCenterVisibility}
|
||||
onValueChange={value => void handleValueChange(value)}
|
||||
disabled={disabled || !canUpdate}
|
||||
className="w-[105px]"
|
||||
>
|
||||
{visibilityOptions.map((option) => (
|
||||
{visibilityOptions.map(option => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
<div className="flex items-center justify-between w-full">
|
||||
<Badge variant={option.variant}>{option.label}</Badge>
|
||||
|
||||
@@ -21,7 +21,7 @@ import type {
|
||||
TrustCenterFilesCardFragment$data,
|
||||
} from "/__generated__/core/TrustCenterFilesCardFragment.graphql";
|
||||
import { useFragment } from "react-relay";
|
||||
import { useMemo, useState, useCallback, useEffect } from "react";
|
||||
import { useMemo, useState, useCallback } from "react";
|
||||
import { sprintf, getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||
import { formatDate } from "@probo/helpers";
|
||||
|
||||
@@ -46,7 +46,7 @@ type Mutation<Params> = (p: {
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
||||
} & Params;
|
||||
};
|
||||
}) => void;
|
||||
}) => Promise<void>;
|
||||
|
||||
type Props<Params> = {
|
||||
files: TrustCenterFilesCardFragment$key[];
|
||||
@@ -66,11 +66,11 @@ export function TrustCenterFilesCard<Params>(props: Props<Params>) {
|
||||
}, [props.files, limit]);
|
||||
const showMoreButton = limit !== null && props.files.length > limit;
|
||||
|
||||
const onChangeVisibility = (
|
||||
const onChangeVisibility = async (
|
||||
fileId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => {
|
||||
props.onChangeVisibility({
|
||||
await props.onChangeVisibility({
|
||||
variables: {
|
||||
input: {
|
||||
id: fileId,
|
||||
@@ -133,7 +133,7 @@ function FileRowWrapper(props: {
|
||||
onChangeVisibility: (
|
||||
fileId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => void;
|
||||
) => Promise<void>;
|
||||
onEdit: (file: { id: string; name: string; category: string }) => void;
|
||||
onDelete: (id: string) => void;
|
||||
disabled?: boolean;
|
||||
@@ -157,35 +157,25 @@ function FileRow(props: {
|
||||
onChangeVisibility: (
|
||||
fileId: string,
|
||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
||||
) => void;
|
||||
) => Promise<void>;
|
||||
onEdit: (file: { id: string; name: string; category: string }) => void;
|
||||
onDelete: (id: string) => void;
|
||||
disabled?: boolean;
|
||||
canUpdate: boolean;
|
||||
}) {
|
||||
const { file, onChangeVisibility, onEdit, onDelete, disabled, canUpdate } =
|
||||
props;
|
||||
const { file, onChangeVisibility, onEdit, onDelete, disabled, canUpdate }
|
||||
= props;
|
||||
const { __ } = useTranslate();
|
||||
const [optimisticValue, setOptimisticValue] = useState<string | null>(null);
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(value: string) => {
|
||||
async (value: string) => {
|
||||
const stringValue = typeof value === "string" ? value : "";
|
||||
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||
setOptimisticValue(typedValue);
|
||||
onChangeVisibility(file.id, typedValue);
|
||||
await onChangeVisibility(file.id, typedValue);
|
||||
},
|
||||
[file.id, onChangeVisibility],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (optimisticValue && file.trustCenterVisibility === optimisticValue) {
|
||||
setOptimisticValue(null);
|
||||
}
|
||||
}, [file.trustCenterVisibility, optimisticValue]);
|
||||
|
||||
const currentValue = optimisticValue || file.trustCenterVisibility;
|
||||
|
||||
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||
|
||||
return (
|
||||
@@ -198,12 +188,12 @@ function FileRow(props: {
|
||||
<Td noLink width={130} className="pr-0">
|
||||
<Field
|
||||
type="select"
|
||||
value={currentValue}
|
||||
onValueChange={handleValueChange}
|
||||
value={file.trustCenterVisibility}
|
||||
onValueChange={value => void handleValueChange(value)}
|
||||
disabled={disabled || !canUpdate}
|
||||
className="w-[105px]"
|
||||
>
|
||||
{visibilityOptions.map((option) => (
|
||||
{visibilityOptions.map(option => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
<div className="flex items-center justify-between w-full">
|
||||
<Badge variant={option.variant}>{option.label}</Badge>
|
||||
@@ -218,8 +208,7 @@ function FileRow(props: {
|
||||
variant="secondary"
|
||||
icon={IconArrowLink}
|
||||
onClick={() =>
|
||||
window.open(file.fileUrl, "_blank", "noopener,noreferrer")
|
||||
}
|
||||
window.open(file.fileUrl, "_blank", "noopener,noreferrer")}
|
||||
title={__("Download")}
|
||||
/>
|
||||
{file.canUpdate && (
|
||||
@@ -231,8 +220,7 @@ function FileRow(props: {
|
||||
id: file.id,
|
||||
name: file.name,
|
||||
category: file.category,
|
||||
})
|
||||
}
|
||||
})}
|
||||
disabled={disabled}
|
||||
title={__("Edit")}
|
||||
/>
|
||||
|
||||
@@ -15,7 +15,7 @@ import { z } from "zod";
|
||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||
import {
|
||||
useCreateTrustCenterReferenceMutation,
|
||||
useUpdateTrustCenterReferenceMutation
|
||||
useUpdateTrustCenterReferenceMutation,
|
||||
} from "/hooks/graph/TrustCenterReferenceGraph";
|
||||
|
||||
const referenceSchema = z.object({
|
||||
@@ -44,7 +44,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
function TrustCenterReferenceDialog({ children }, ref) {
|
||||
const { __ } = useTranslate();
|
||||
const dialogRef = useDialogRef();
|
||||
const [mode, setMode] = useState<'create' | 'edit'>('create');
|
||||
const [mode, setMode] = useState<"create" | "edit">("create");
|
||||
const [trustCenterId, setTrustCenterId] = useState<string>("");
|
||||
const [connectionId, setConnectionId] = useState<string>("");
|
||||
const [editReference, setEditReference] = useState<Reference | null>(null);
|
||||
@@ -61,12 +61,12 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
description: "",
|
||||
websiteUrl: "",
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
openCreate: (tId: string, cId: string) => {
|
||||
setMode('create');
|
||||
setMode("create");
|
||||
setTrustCenterId(tId);
|
||||
setConnectionId(cId);
|
||||
setEditReference(null);
|
||||
@@ -79,7 +79,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
dialogRef.current?.open();
|
||||
},
|
||||
openEdit: (reference: Reference) => {
|
||||
setMode('edit');
|
||||
setMode("edit");
|
||||
setEditReference(reference);
|
||||
setUploadedFile(null);
|
||||
reset({
|
||||
@@ -99,8 +99,8 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = handleSubmit(async (data: ReferenceFormData) => {
|
||||
if (mode === 'create') {
|
||||
const onSubmit = async (data: ReferenceFormData) => {
|
||||
if (mode === "create") {
|
||||
if (!uploadedFile) {
|
||||
return;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
reset();
|
||||
@@ -169,12 +169,12 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
};
|
||||
|
||||
const isSubmitting = isCreating || isUpdating;
|
||||
const title = mode === 'create' ? __("Add Reference") : __("Edit Reference");
|
||||
const title = mode === "create" ? __("Add Reference") : __("Edit Reference");
|
||||
|
||||
return (
|
||||
<>
|
||||
{children && (
|
||||
<span onClick={() => mode === 'create' && dialogRef.current?.open()}>
|
||||
<span onClick={() => mode === "create" && dialogRef.current?.open()}>
|
||||
{children}
|
||||
</span>
|
||||
)}
|
||||
@@ -185,7 +185,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
className="max-w-2xl"
|
||||
onClose={handleClose}
|
||||
>
|
||||
<form onSubmit={onSubmit}>
|
||||
<form onSubmit={e => void handleSubmit(onSubmit)(e)}>
|
||||
<DialogContent padded className="space-y-6">
|
||||
<Field
|
||||
{...register("name")}
|
||||
@@ -213,7 +213,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
placeholder={__("https://example.com")}
|
||||
/>
|
||||
|
||||
{mode === 'edit' && (
|
||||
{mode === "edit" && (
|
||||
<Field
|
||||
{...register("rank", { valueAsNumber: true })}
|
||||
label={__("Rank")}
|
||||
@@ -239,18 +239,21 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
/>
|
||||
{uploadedFile && (
|
||||
<div className="mt-2 p-3 bg-tertiary-subtle rounded-lg">
|
||||
<p className="text-sm font-medium">{__("Selected file")}:</p>
|
||||
<p className="text-sm font-medium">
|
||||
{__("Selected file")}
|
||||
:
|
||||
</p>
|
||||
<p className="text-sm text-txt-secondary">{uploadedFile.name}</p>
|
||||
</div>
|
||||
)}
|
||||
{mode === 'edit' && !uploadedFile && (
|
||||
{mode === "edit" && !uploadedFile && (
|
||||
<div className="mt-2 p-3 bg-tertiary-subtle rounded-lg">
|
||||
<p className="text-sm text-txt-secondary">
|
||||
{__("Current logo will be kept if no new file is uploaded")}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{mode === 'create' && !uploadedFile && (
|
||||
{mode === "create" && !uploadedFile && (
|
||||
<div className="mt-2 p-3 bg-warning-subtle rounded-lg">
|
||||
<p className="text-sm">
|
||||
{__("Logo is required for new references")}
|
||||
@@ -263,15 +266,15 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={isSubmitting || (mode === 'create' && !uploadedFile)}
|
||||
disabled={isSubmitting || (mode === "create" && !uploadedFile)}
|
||||
icon={isSubmitting ? Spinner : undefined}
|
||||
>
|
||||
{mode === 'create' ? __("Add Reference") : __("Update Reference")}
|
||||
{mode === "create" ? __("Add Reference") : __("Update Reference")}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -49,8 +49,8 @@ export function TrustCenterReferencesSection({
|
||||
const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
|
||||
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
|
||||
const [refetchKey, setRefetchKey] = useState(0);
|
||||
const { node: trustCenterNode } =
|
||||
useLazyLoadQuery<TrustCenterReferenceGraphQuery>(
|
||||
const { node: trustCenterNode }
|
||||
= useLazyLoadQuery<TrustCenterReferenceGraphQuery>(
|
||||
trustCenterReferencesQuery,
|
||||
{ trustCenterId: trustCenterId || "" },
|
||||
{ fetchPolicy: "network-only", fetchKey: refetchKey },
|
||||
@@ -60,8 +60,8 @@ export function TrustCenterReferencesSection({
|
||||
}
|
||||
const [updateRank] = useUpdateTrustCenterReferenceRankMutation();
|
||||
|
||||
const references =
|
||||
trustCenterNode?.references?.edges?.map((edge) => edge.node) || [];
|
||||
const references
|
||||
= trustCenterNode?.references?.edges?.map(edge => edge.node) || [];
|
||||
const referencesConnectionId = trustCenterNode?.references?.__id || "";
|
||||
|
||||
const handleCreate = () => {
|
||||
@@ -89,7 +89,7 @@ export function TrustCenterReferencesSection({
|
||||
}
|
||||
};
|
||||
|
||||
const handleDrop = (targetIndex: number) => {
|
||||
const handleDrop = async (targetIndex: number) => {
|
||||
if (draggedIndex === null || draggedIndex === targetIndex) {
|
||||
setDraggedIndex(null);
|
||||
setDragOverIndex(null);
|
||||
@@ -99,7 +99,7 @@ export function TrustCenterReferencesSection({
|
||||
const draggedRef = references[draggedIndex];
|
||||
const targetRank = references[targetIndex].rank;
|
||||
|
||||
updateRank({
|
||||
await updateRank({
|
||||
variables: {
|
||||
input: {
|
||||
id: draggedRef.id,
|
||||
@@ -107,7 +107,7 @@ export function TrustCenterReferencesSection({
|
||||
},
|
||||
},
|
||||
onCompleted: () => {
|
||||
setRefetchKey((prev) => prev + 1);
|
||||
setRefetchKey(prev => prev + 1);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -158,8 +158,8 @@ export function TrustCenterReferencesSection({
|
||||
connectionId={referencesConnectionId}
|
||||
onVisitWebsite={() => handleVisitWebsite(reference.websiteUrl)}
|
||||
onDragStart={() => handleDragStart(index)}
|
||||
onDragOver={(e) => handleDragOver(e, index)}
|
||||
onDrop={() => handleDrop(index)}
|
||||
onDragOver={e => handleDragOver(e, index)}
|
||||
onDrop={() => void handleDrop(index)}
|
||||
/>
|
||||
))}
|
||||
</Tbody>
|
||||
|
||||
@@ -38,7 +38,7 @@ type Mutation<Params> = (p: {
|
||||
showOnTrustCenter: boolean;
|
||||
} & Params;
|
||||
};
|
||||
}) => void;
|
||||
}) => Promise<void>;
|
||||
|
||||
type Props<Params> = {
|
||||
vendors: TrustCenterVendorsCardFragment$key[];
|
||||
@@ -55,8 +55,8 @@ export function TrustCenterVendorsCard<Params>(props: Props<Params>) {
|
||||
}, [props.vendors, limit]);
|
||||
const showMoreButton = limit !== null && props.vendors.length > limit;
|
||||
|
||||
const onToggleVisibility = (vendorId: string, showOnTrustCenter: boolean) => {
|
||||
props.onToggleVisibility({
|
||||
const onToggleVisibility = async (vendorId: string, showOnTrustCenter: boolean) => {
|
||||
await props.onToggleVisibility({
|
||||
variables: {
|
||||
input: {
|
||||
id: vendorId,
|
||||
@@ -112,7 +112,7 @@ export function TrustCenterVendorsCard<Params>(props: Props<Params>) {
|
||||
|
||||
function VendorRow(props: {
|
||||
vendor: TrustCenterVendorsCardFragment$key;
|
||||
onToggleVisibility: (vendorId: string, showOnTrustCenter: boolean) => void;
|
||||
onToggleVisibility: (vendorId: string, showOnTrustCenter: boolean) => Promise<void>;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
const vendor = useFragment(trustCenterVendorFragment, props.vendor);
|
||||
@@ -137,8 +137,7 @@ function VendorRow(props: {
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() =>
|
||||
props.onToggleVisibility(vendor.id, !vendor.showOnTrustCenter)
|
||||
}
|
||||
void props.onToggleVisibility(vendor.id, !vendor.showOnTrustCenter)}
|
||||
icon={vendor.showOnTrustCenter ? IconCrossLargeX : IconCheckmark1}
|
||||
disabled={props.disabled}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user