Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

84 wiersze
2.0 KiB

  1. import useIsMobile from "@/app/utils/useIsMobile";
  2. import React from "react";
  3. import FullscreenModal from "../FullscreenModal";
  4. import {
  5. Box,
  6. Card,
  7. CardContent,
  8. Modal,
  9. SxProps,
  10. Typography,
  11. } from "@mui/material";
  12. import { useTranslation } from "react-i18next";
  13. import TimesheetAmendment, {
  14. Props as TimesheetAmendmentProps,
  15. } from "./TimesheetAmendment";
  16. const modalSx: SxProps = {
  17. position: "absolute",
  18. top: "50%",
  19. left: "50%",
  20. transform: "translate(-50%, -50%)",
  21. width: { xs: "calc(100% - 2rem)", sm: "90%" },
  22. maxHeight: "90%",
  23. maxWidth: 1400,
  24. };
  25. interface Props extends TimesheetAmendmentProps {
  26. open: boolean;
  27. onClose: () => void;
  28. isSaturdayWorker: boolean
  29. }
  30. export const TimesheetAmendmentModal: React.FC<Props> = ({
  31. open,
  32. onClose,
  33. leaveTypes,
  34. teamLeaves,
  35. teamTimesheets,
  36. companyHolidays,
  37. allProjects,
  38. miscTasks,
  39. isSaturdayWorker
  40. }) => {
  41. const { t } = useTranslation("home");
  42. const isMobile = useIsMobile();
  43. const title = t("Timesheet Amendments");
  44. const content = (
  45. <TimesheetAmendment
  46. leaveTypes={leaveTypes}
  47. teamLeaves={teamLeaves}
  48. companyHolidays={companyHolidays}
  49. teamTimesheets={teamTimesheets}
  50. allProjects={allProjects}
  51. miscTasks={miscTasks}
  52. isSaturdayWorker={isSaturdayWorker}
  53. />
  54. );
  55. return isMobile ? (
  56. <FullscreenModal open={open} onClose={onClose} closeModal={onClose}>
  57. <Box display="flex" flexDirection="column" gap={2} height="100%">
  58. <Typography variant="h6" flex="none" padding={2}>
  59. {title}
  60. </Typography>
  61. <Box paddingInline={2}>{content}</Box>
  62. </Box>
  63. </FullscreenModal>
  64. ) : (
  65. <Modal open={open} onClose={onClose}>
  66. <Card sx={modalSx}>
  67. <CardContent>
  68. <Typography variant="overline" display="block" marginBlockEnd={1}>
  69. {title}
  70. </Typography>
  71. <Box maxHeight={900} overflow="scroll">
  72. {content}
  73. </Box>
  74. </CardContent>
  75. </Card>
  76. </Modal>
  77. );
  78. };