Skip to content

Commit

Permalink
ran linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeessh committed Nov 16, 2024
1 parent 700f6c2 commit 06fc4f4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
45 changes: 23 additions & 22 deletions frontend/src/components/common/CommonTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ import KeyboardArrowUpOutlinedIcon from "@mui/icons-material/KeyboardArrowUpOutl
import KeyboardArrowDownOutlinedIcon from "@mui/icons-material/KeyboardArrowDownOutlined";
import ModalContainer from "./ModalContainer";


type TableTypes = string | number | boolean | Date;

export type ColumnInfoTypes = { header: string; key: string };

export interface TableData {
[key: string]: TableTypes;
}

type Props = {
data: TableData[];
columnInfo: ColumnInfoTypes[];
Expand All @@ -43,8 +42,6 @@ type SortState = {
[key: string]: number;
};



const CommonTable = ({
columnInfo,
data,
Expand Down Expand Up @@ -80,15 +77,15 @@ const CommonTable = ({
const handleRowClick = (row: TableData) => {
setSelectedRow(row);
setIsPreviewModalOpen(true);
}
};

interface ColumnInfo {
header: string;
value: string;
}

const colData: ColumnInfo[] = columnInfo.map((col, index) => {
const value = Object.entries(selectedRow)[index]?.[1] || " ";
const value = Object.entries(selectedRow)[index]?.[1] || " ";
return {
header: String(col.header),
value: String(value),
Expand Down Expand Up @@ -248,7 +245,7 @@ const CommonTable = ({
.slice((page - 1) * maxResults, page * maxResults)
.map((row, index) => {
return (
<Tr key={index} >
<Tr key={index}>
{isSelectable ? (
<Td p="0px 0px 0px 20px" w="16px">
<Checkbox
Expand All @@ -265,21 +262,24 @@ const CommonTable = ({
</Td>
) : null}
{columnInfo.map((column, i) => (
<Td
onClick={() => {
handleRowClick(row);
}}
key={i}
>{String(row[column.key])}</Td>
<Td
onClick={() => {
handleRowClick(row);
}}
key={i}
>
{String(row[column.key])}
</Td>
))}
<Td onClick={(e) => {
e.stopPropagation();
onEdit(row);
}}>
<Td
onClick={(e) => {
e.stopPropagation();
onEdit(row);
}}
>
<Icon
as={EditOutlinedIcon}
_hover={{ cursor: "pointer" }}

/>
</Td>
</Tr>
Expand All @@ -296,13 +296,14 @@ const CommonTable = ({
setIsOpen={setIsPreviewModalOpen}
>
<Flex flexDir="column" gap="5px" mt="10px">
{colData.slice(1).map((column, index) => (
{colData.slice(1).map((column, index) => (
<Text key={index}>
<Text as="span" fontWeight="700">
{column.header}: {' '}
</Text> {column.value}
{column.header}:{" "}
</Text>{" "}
{column.value}
</Text>
))}
))}
</Flex>
</ModalContainer>
)}
Expand Down
11 changes: 8 additions & 3 deletions frontend/src/components/common/ModalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Button,
} from "@chakra-ui/react";
import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined";
import CloseIcon from '@mui/icons-material/Close';
import CloseIcon from "@mui/icons-material/Close";

type Props = {
title: string;
Expand Down Expand Up @@ -41,8 +41,13 @@ const ModalContainer = ({
Delete
</Button>
) : (
<Button bg="transparent" h="auto" _hover={{ bg: "transparent" }} onClick={() => setIsOpen(false)}>
<CloseIcon/>
<Button
bg="transparent"
h="auto"
_hover={{ bg: "transparent" }}
onClick={() => setIsOpen(false)}
>
<CloseIcon />
</Button>
)}
</ModalHeader>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/pages/tasks/TasksPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const TasksPage = (): React.ReactElement => {
// const tasksByAssigneeId = React.useMemo(() => {
// return tasksByAssigneeIdData;
// }, [tasksByAssigneeIdData]);

// const {
// loading: tasksByAssignerIdLoading,
// error: tasksByAssignerIdError,
Expand All @@ -151,7 +151,7 @@ const TasksPage = (): React.ReactElement => {
// const tasksByStartDate = React.useMemo(() => {
// return taskByStartDateData;
// }, [taskByStartDateData]);

// const {
// loading: tasksByStatusLoading,
// error: tasksByStatusError,
Expand Down

0 comments on commit 06fc4f4

Please sign in to comment.