Skip to content

Commit

Permalink
fix(ui-tablemode): style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Jun 18, 2024
1 parent e999243 commit b3a6be0
Showing 1 changed file with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react";
import { Box, MenuItem } from "@mui/material";
import { MenuItem } from "@mui/material";
import { useOutletContext } from "react-router";
import { useUpdateEffect } from "react-use";
import { useTranslation } from "react-i18next";
Expand All @@ -17,6 +17,7 @@ import UpdateTemplateTableDialog from "./dialogs/UpdateTemplateTableDialog";
import ConfirmationDialog from "../../../../common/dialogs/ConfirmationDialog";
import TableMode from "../../../../common/TableMode";
import SplitView from "../../../../common/SplitView";
import ViewWrapper from "../../../../common/page/ViewWrapper";

function TableModeList() {
const { t } = useTranslation();
Expand Down Expand Up @@ -73,60 +74,59 @@ function TableModeList() {
////////////////////////////////////////////////////////////////

return (
<Box sx={{ width: 1, height: 1, py: 1 }}>
<>
<SplitView id="tablemode" sizes={[10, 90]}>
<Box>
<PropertiesView
mainContent={
<ListElement
list={templates}
currentElement={selectedTemplate?.id}
currentElementKeyToTest="id"
setSelectedItem={({ id }) => setSelectedTemplateId(id)}
contextMenuContent={({ element, close }) => (
<>
<MenuItem
onClick={(event) => {
event.stopPropagation();
setDialog({
type: "edit",
templateId: element.id,
});
close();
}}
>
Edit
</MenuItem>
<MenuItem
onClick={(event) => {
event.stopPropagation();
setDialog({
type: "delete",
templateId: element.id,
});
close();
}}
>
Delete
</MenuItem>
</>
)}
/>
}
onAdd={() => setDialog({ type: "add", templateId: "" })}
/>
</Box>
<Box>
{/* Left */}
<PropertiesView
mainContent={
<ListElement
list={templates}
currentElement={selectedTemplate?.id}
currentElementKeyToTest="id"
setSelectedItem={({ id }) => setSelectedTemplateId(id)}
contextMenuContent={({ element, close }) => (
<>
<MenuItem
onClick={(event) => {
event.stopPropagation();
setDialog({
type: "edit",
templateId: element.id,
});
close();
}}
>
Edit
</MenuItem>
<MenuItem
onClick={(event) => {
event.stopPropagation();
setDialog({
type: "delete",
templateId: element.id,
});
close();
}}
>
Delete
</MenuItem>
</>
)}
/>
}
onAdd={() => setDialog({ type: "add", templateId: "" })}
/>
{/* Right */}
<ViewWrapper>
{selectedTemplate && (
<TableMode
studyId={study.id}
type={selectedTemplate.type}
columns={selectedTemplate.columns}
/>
)}
</Box>
</ViewWrapper>
</SplitView>

{dialog?.type === "add" && (
<CreateTemplateTableDialog
templates={templates}
Expand Down Expand Up @@ -157,7 +157,7 @@ function TableModeList() {
})}
</ConfirmationDialog>
)}
</Box>
</>
);
}

Expand Down

0 comments on commit b3a6be0

Please sign in to comment.