Skip to content
Merged
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
14 changes: 13 additions & 1 deletion components/crudContainers/BulkFixTimezoneShiftButton.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import Typography from '@mui/material/Typography';
import { useListContext } from 'react-admin';
import { useIsAdmin } from '@shared/utils/permissionsUtil';
import { BulkActionButton } from './BulkActionButton';

// Admin-only: corrects createdAt/updatedAt on the selected rows for records
// written before the mysql connection was pinned to UTC (nra-server#44).
// Confirms first: running this on rows that were already written correctly
// (after that fix) would shift them the wrong way.
export const BulkFixTimezoneShiftButton = ({ label = 'תיקון שעון (UTC)' }) => {
const isAdmin = useIsAdmin();
const { selectedIds } = useListContext();
if (!isAdmin) return null;

return <BulkActionButton name="fixTimezoneShift" label={label} reloadOnEnd />;
return (
<BulkActionButton name="fixTimezoneShift" label={label} reloadOnEnd>
<Typography>
הפעולה תתקן את השעה השמורה ב-{selectedIds?.length ?? 0} הרשומות שנבחרו, בהנחה שנכתבו
לפני תיקון אזור הזמן. הפעלה על רשומות שכבר תקינות תזיז את השעה שלהן בטעות. להמשיך?
</Typography>
</BulkActionButton>
);
};