Skip to content

Commit

Permalink
[#1106] Make the Administration list more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-p-s committed Jan 31, 2024
1 parent fa0759f commit f7b699a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion frontend/src/pages/mobile-assignment/MobileAssignment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const MobileAssignment = () => {
const [dataset, setDataset] = useState([]);
const [totalCount, setTotalCount] = useState(0);
const [currentPage, setCurrentPage] = useState(1);
const [expanded, setExpanded] = useState(false);

const navigate = useNavigate();
const { language } = store.useState((s) => s);
Expand All @@ -44,7 +45,12 @@ const MobileAssignment = () => {
navigate(`/control-center/mobile-assignment/form/${record?.id}`);
};

const handleMoreLinkClick = () => {
setExpanded(!expanded);
};

const descriptionData = <div>{text.mobilePanelText}</div>;

const columns = [
{
title: "#",
Expand All @@ -62,7 +68,17 @@ const MobileAssignment = () => {
dataIndex: "administrations",
key: "administrations",
render: (record) => {
return <>{record?.map((r) => r?.name || r?.label)?.join(" | ")}</>;
const displayedItems = expanded ? record : record?.slice(0, 4);
return (
<>
{displayedItems?.map((r) => r?.name || r?.label)?.join(" , ")}
{record?.length > 4 && (
<a onClick={handleMoreLinkClick}>
{expanded ? `- Less` : `+ ${record?.slice(4).length} More`}
</a>
)}
</>
);
},
},
{
Expand All @@ -72,6 +88,7 @@ const MobileAssignment = () => {
render: (record) => {
return <>{record?.map((r) => r?.name || r?.label)?.join(" | ")}</>;
},
width: 500,
},
{
title: "Action",
Expand Down

0 comments on commit f7b699a

Please # to comment.