MaterialMismatchConfirm.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { useTranslation } from 'react-i18next';
  2. import { ConfirmModal } from './ConfirmModal';
  3. import { materialMismatchMessage, type MaterialMismatch } from '../utils/assignMismatch';
  4. /**
  5. * The question asked before a spool goes into a slot of another material, as
  6. * the Assign Spool dialog and the QR assignment ask it.
  7. */
  8. export function MaterialMismatchConfirm({
  9. mismatch,
  10. location,
  11. isLoading,
  12. onConfirm,
  13. onCancel,
  14. }: {
  15. mismatch: MaterialMismatch;
  16. /** The slot, as the question names it. */
  17. location: string;
  18. isLoading?: boolean;
  19. onConfirm: () => void;
  20. onCancel: () => void;
  21. }) {
  22. const { t } = useTranslation();
  23. return (
  24. <ConfirmModal
  25. title={t('inventory.assignMismatchTitle')}
  26. message={materialMismatchMessage(t, mismatch, location)}
  27. confirmText={t('inventory.assignMismatchConfirm')}
  28. variant="warning"
  29. // Above the assign dialogs' own z-[100] layer (#1336) — without this the
  30. // question is hidden behind the dialog that asks it.
  31. overlayZIndex="z-[110]"
  32. isLoading={isLoading}
  33. onConfirm={onConfirm}
  34. onCancel={onCancel}
  35. />
  36. );
  37. }