The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { useLingui } from '@lingui/react/macro';
import { RESET_RECORD_PAGE_LAYOUT_MODAL_ID } from '@/layout-customization/constants/ResetRecordPageLayoutModalId';
import { useRefreshPageLayoutAfterReset } from '@/page-layout/hooks/useRefreshPageLayoutAfterReset';
import { useResetPageLayoutToDefault } from '@/page-layout/hooks/useResetPageLayoutToDefault';
import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';
type LayoutCustomizationBarResetConfirmationModalProps = {
pageLayoutId: string;
};
export const LayoutCustomizationBarResetConfirmationModal = ({
pageLayoutId,
}: LayoutCustomizationBarResetConfirmationModalProps) => {
const { t } = useLingui();
const { resetPageLayoutToDefault } = useResetPageLayoutToDefault();
const { refreshPageLayoutAfterReset } =
useRefreshPageLayoutAfterReset(pageLayoutId);
const handleConfirmReset = async () => {
await resetPageLayoutToDefault({ pageLayoutId });
await refreshPageLayoutAfterReset();
};
return (
<ConfirmationDialog
dialogId={RESET_RECORD_PAGE_LAYOUT_MODAL_ID}
title={t`Reset to default`}
subtitle={t`This action cannot be undone.`}
onConfirmClick={handleConfirmReset}
confirmButtonText={t`Reset`}
confirmButtonColor="danger"
/>
);
};