Skip to content

Commit

Permalink
Merge pull request #1129 from akvo/feature/1127-margin-between-submis…
Browse files Browse the repository at this point in the history
…sion-and-approval-panel

[#1127] Add margin between Submission and Approval Panel in Control P…
  • Loading branch information
ifirmawan authored Feb 6, 2024
2 parents 880c2db + e16d16e commit 4c590be
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
.table-wrapper {
background-color: white;
padding: 24px;

width: 100%;
.ant-form {
&.ant-form-horizontal {
.ant-form-item {
Expand Down
87 changes: 44 additions & 43 deletions frontend/src/pages/control-center/ControlCenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,22 @@ const ControlCenter = () => {
key: "approvals",
access: "approvals",
render: (
<Col key="approvals-panel" span={24}>
<PanelApprovals />
</Col>
<div className="table-wrapper">
<Col key="approvals-panel" span={24}>
<PanelApprovals />
</Col>
</div>
),
},
{
key: "submission",
access: "form",
render: (
<Col key="submission-panel" span={24}>
<PanelSubmissions />
</Col>
<div className="table-wrapper">
<Col key="submission-panel" span={24}>
<PanelSubmissions />
</Col>
</div>
),
},
];
Expand All @@ -46,7 +50,6 @@ const ControlCenter = () => {
if (!authUser?.role_detail) {
return [];
}

const panelOrder = roles.find(
(r) => r.id === authUser.role_detail.id
)?.control_center_order;
Expand Down Expand Up @@ -107,44 +110,42 @@ const ControlCenter = () => {
</div>
</div>
<div className="table-section">
<div className="table-wrapper">
<Row gutter={[16, 32]}>
{selectedPanels.map((panel, index) => {
if (panel?.render) {
return panel.render;
}
const cardOnly = selectedPanels.filter((x) => !x?.render);
const isFullWidth =
cardOnly.length === 1 ||
(selectedPanels.length % 2 === 1 &&
selectedPanels.length - 1 === index);
return (
<Col
className="card-wrapper"
span={isFullWidth ? 24 : 12}
key={index}
>
<div hoverable>
<div className="row">
<div className="flex-1">
<h2>{panel?.title}</h2>
<span>{panel?.description}</span>
<Link to={panel?.link} className="explore">
<Button type="primary" shape="round">
{panel?.buttonLabel}
</Button>
</Link>
</div>
<div>
<img src={panel?.image} width={100} height={100} />
</div>
<Row gutter={[16, 32]}>
{selectedPanels.map((panel, index) => {
if (panel?.render) {
return panel.render;
}
const cardOnly = selectedPanels.filter((x) => !x?.render);
const isFullWidth =
cardOnly.length === 1 ||
(selectedPanels.length % 2 === 1 &&
selectedPanels.length - 1 === index);
return (
<Col
className="card-wrapper"
span={isFullWidth ? 24 : 12}
key={index}
>
<div hoverable>
<div className="row">
<div className="flex-1">
<h2>{panel?.title}</h2>
<span>{panel?.description}</span>
<Link to={panel?.link} className="explore">
<Button type="primary" shape="round">
{panel?.buttonLabel}
</Button>
</Link>
</div>
<div>
<img src={panel?.image} width={100} height={100} />
</div>
</div>
</Col>
);
})}
</Row>
</div>
</div>
</Col>
);
})}
</Row>
</div>
</>
);
Expand Down

0 comments on commit 4c590be

Please sign in to comment.