Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SILVA-575): fixing modal on recent openings #515

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("TableRowComponent", () => {
fireEvent.click(tableRow);

// Verify that setOpeningDetails was called with true
expect(setOpeningDetails).toHaveBeenCalledWith(true);
expect(setOpeningDetails).toHaveBeenCalledWith("1");
});

it("renders TableCell components only for selected headers", () => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/ActionButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ActionButtons: React.FC<ActionButtonsProps> = ({ rowId }) => (
renderIcon={Icons.DocumentDownload}
onClick={() => null}
size="md"
disabled
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import {
TableContainer,
TableHead,
TableHeader,
TableRow,
Modal,
TableRow
} from "@carbon/react";
import EmptySection from "../../../EmptySection";
import PaginationContext from "../../../../contexts/PaginationContext";
import { OpeningsSearch } from "../../../../types/OpeningsSearch";
import { ITableHeader } from "../../../../types/TableHeader";
import { useNavigate } from "react-router-dom";
import TableRowComponent from "../../../TableRowComponent";
import ComingSoonModal from "../../../ComingSoonModal";

interface IRecentOpeningsDataTable {
rows: OpeningsSearch[];
Expand All @@ -38,7 +38,7 @@ const RecentOpeningsDataTable: React.FC<IRecentOpeningsDataTable> = ({
setInitialItemsPerPage,
} = useContext(PaginationContext);
const [selectedRows, setSelectedRows] = useState<string[]>([]);
const [openingDetails, setOpeningDetails] = useState(false);
const [openingDetails, setOpeningDetails] = useState("");
const navigate = useNavigate();

useEffect(() => {
Expand Down Expand Up @@ -95,13 +95,9 @@ const RecentOpeningsDataTable: React.FC<IRecentOpeningsDataTable> = ({
fill="#0073E6"
/>
)}

<Modal
open={openingDetails}
onRequestClose={() => setOpeningDetails(false)}
passiveModal
modalHeading="Feature coming soon"
modalLabel="Opening Details"
<ComingSoonModal
openingDetails={openingDetails}
setOpeningDetails={setOpeningDetails}
/>
</TableContainer>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ import { useNotification } from "../../../../contexts/NotificationProvider";
import TruncatedText from "../../../TruncatedText";
import FriendlyDate from "../../../FriendlyDate";
import ComingSoonModal from "../../../ComingSoonModal";
import { Icon } from "@carbon/icons-react";
import { set } from "date-fns";

interface ISearchScreenDataTable {
rows: OpeningsSearch[];
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/TableRowComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface TableRowComponentProps {
showSpatial: boolean;
selectedRows: string[];
handleRowSelectionChanged: (rowId: string) => void;
setOpeningDetails: (show: boolean) => void;
setOpeningDetails: (openingId: string) => void;
}

const TableRowComponent: React.FC<TableRowComponentProps> = ({
Expand All @@ -21,9 +21,9 @@ const TableRowComponent: React.FC<TableRowComponentProps> = ({
showSpatial,
selectedRows,
handleRowSelectionChanged,
setOpeningDetails,
setOpeningDetails
}) => (
<TableRow onClick={() => setOpeningDetails(true)}>
<TableRow onClick={() => setOpeningDetails(row.openingId.toString())}>
{headers.map((header) =>
header.selected ? (
<TableCell key={header.key}>
Expand Down
Loading