fix: position of cards and reports in dashboard

This commit is contained in:
prafull-opensignlabs
2024-06-06 11:49:06 +05:30
parent 635693b394
commit 454f557d14
3 changed files with 8 additions and 41 deletions
@@ -146,11 +146,11 @@ const GetDashboard = (props) => {
<div className="grid grid-cols-12 w-full gap-x-4">
{props?.dashboard?.columns?.map((col, i) =>
col.widget.data && col.widget.data.tourSection ? (
<div key={i} className={`${col.colxs} ${col.colmd} ${col.collg} `}>
<div key={i} className={col?.colsize}>
{renderSwitchWithTour(col)}
</div>
) : (
<div key={i} className={`${col.colxs} ${col.colmd} ${col.collg} `}>
<div key={i} className={col?.colsize}>
{renderSwitch(col)}
</div>
)
+5 -15
View File
@@ -3,9 +3,7 @@ const dashboardJson = [
id: "35KBoSgoAK",
columns: [
{
colxs: "12",
colmd: "6",
collg: "6",
colsize: "col-span-12 md:col-span-6 lg:col-span-6",
widget: {
type: "Card",
icon: "fas fa-signature",
@@ -28,9 +26,7 @@ const dashboardJson = [
}
},
{
colxs: "12",
colmd: "6",
collg: "6",
colsize: "col-span-12 md:col-span-6 lg:col-span-6",
widget: {
type: "Card",
icon: "fas fa-sign-out-alt",
@@ -53,9 +49,7 @@ const dashboardJson = [
}
},
{
colxs: "12",
colmd: "6",
collg: "6",
colsize: "col-span-12 md:col-span-6 lg:col-span-6",
widget: {
type: "report",
reportId: "5Go51Q7T8r",
@@ -67,9 +61,7 @@ const dashboardJson = [
}
},
{
colxs: "12",
colmd: "6",
collg: "6",
colsize: "col-span-12 md:col-span-6 lg:col-span-6",
widget: {
type: "report",
reportId: "d9k3UfYHBc",
@@ -81,9 +73,7 @@ const dashboardJson = [
}
},
{
colxs: "12",
colmd: "12",
collg: "12",
colsize: "col-span-12 md:col-span-12 lg:col-span-12",
widget: {
type: "report",
reportId: "kC5mfynCi4",
+1 -24
View File
@@ -12,7 +12,6 @@ const Dashboard = () => {
const dispatch = useDispatch();
const { id } = useParams();
const [dashboard, setdashboard] = useState([]);
const [classnameArray, setclassnameArray] = useState([]);
const [loading, setloading] = useState(true);
const [defaultQuery, setDefaultQuery] = useState("");
@@ -32,23 +31,6 @@ const Dashboard = () => {
const getDashboard = async (id) => {
try {
const dashboard = dashboardJson.find((x) => x.id === id);
let classArray = [];
dashboard?.columns?.forEach((row) => {
let item = "";
if (row?.colxs) {
item += " col-span-" + row?.colxs;
}
if (row?.colmd) {
item += " md:col-span-" + row?.colmd;
}
if (row?.collg) {
item += " lg:col-span-" + row?.collg + " ";
}
if (!row?.colxs && !row?.colmd && !row?.collg) {
item += "col-span-12";
}
classArray.push(item);
});
setdashboard(dashboard);
const dashboardTour = dashboard.columns
.filter((col) => {
@@ -65,7 +47,6 @@ const Dashboard = () => {
};
});
dispatch(saveTourSteps(dashboardTour));
setclassnameArray(classArray);
if (localStorage.getItem("DashboardDefaultFilter")) {
setDefaultQuery(localStorage.getItem("DashboardDefaultFilter"));
}
@@ -92,11 +73,7 @@ const Dashboard = () => {
></div>
</div>
) : (
<GetDashboard
dashboard={dashboard}
classnameArray={classnameArray}
DefaultQuery={defaultQuery}
/>
<GetDashboard dashboard={dashboard} DefaultQuery={defaultQuery} />
)}
</React.Fragment>
);