Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components/CustomTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const theme = createTheme({
contrast: "#FFFFFF"
},
background: {
light: "#F7F7F9"
light: "#F7F7F9",
light_gray: "#eaeaea"
},
text: {
primary: "#000000DE",
Expand All @@ -34,10 +35,10 @@ const theme = createTheme({
fontSize: "12px",
fontWeight: 400
},
subtitle2: ({ theme }) => ({
subtitle2: ({ theme: t }) => ({
fontSize: "14px",
fontWeight: 500,
color: theme.palette.text.primary
color: t.palette.text.primary
}),
h4: {
fontSize: "34px",
Expand Down Expand Up @@ -126,8 +127,8 @@ const theme = createTheme({
root: {
fontSize: "12px"
},
standardInfo: ({ theme }) => ({
color: theme.palette.primary.dark
standardInfo: ({ theme: t }) => ({
color: t.palette.primary.dark
})
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@
"refund_amount_emitted": "Amount Refund",
"ticket_types": "Active Tickets per Ticket Types",
"badge_types": "Active Tickets per Badge Types",
"general_dates": "General Dates",
"ordering": "Ordering",
"important_documents": "Important Documents",
"sponsor_levels": "Sponsor Levels",
"pages": "Pages",
"tab_badge_types": "Badge Types",
"media_uploads": "Media Uploads",
"booth_layout_types": "Booth Layout Types",
"expand": "Expand section",
"collapse": "Collapse section",
"badge_features_tickets": "Active Tickets per Badge Features",
Expand Down
40 changes: 40 additions & 0 deletions src/pages/summits/components/dashboard-section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import CardHeader from "@mui/material/CardHeader";
import Divider from "@mui/material/Divider";
import Typography from "@mui/material/Typography";

function DashboardSection({ title, children, variant }) {
if (variant === "card") {
return (
<Card elevation={0}>
<CardHeader title={title} />
<Divider />
{children}
</Card>
);
}

return (
<Box>
<Box sx={{ bgcolor: "background.light_gray", px: 2, py: 2 }}>
<Typography variant="body2">{title}</Typography>
</Box>
{children}
</Box>
);
}

DashboardSection.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node.isRequired,
variant: PropTypes.oneOf(["card"])
};

DashboardSection.defaultProps = {
variant: undefined
};
Comment on lines +30 to +38

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix PropTypes inconsistency for variant.

Line 33 restricts variant to oneOf(["card"]), but Line 37 defaults it to undefined. This creates a PropTypes validation warning since undefined is not in the allowed values. The component logic (Line 10) correctly handles undefined by rendering the non-card variant.

🐛 Proposed fix

Option 1: Remove the oneOf restriction if only "card" is needed as an explicit signal:

 DashboardSection.propTypes = {
   title: PropTypes.string.isRequired,
   children: PropTypes.node.isRequired,
-  variant: PropTypes.oneOf(["card"])
+  variant: PropTypes.string
 };

Option 2: Make the PropTypes match the runtime behavior by allowing both "card" and undefined:

 DashboardSection.propTypes = {
   title: PropTypes.string.isRequired,
   children: PropTypes.node.isRequired,
-  variant: PropTypes.oneOf(["card"])
+  variant: PropTypes.oneOf(["card", undefined])
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
DashboardSection.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node.isRequired,
variant: PropTypes.oneOf(["card"])
};
DashboardSection.defaultProps = {
variant: undefined
};
DashboardSection.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.node.isRequired,
variant: PropTypes.string
};
DashboardSection.defaultProps = {
variant: undefined
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/summits/components/dashboard-section.js` around lines 30 - 38,
DashboardSection.propTypes currently restricts variant to oneOf(["card"]) while
DashboardSection.defaultProps sets variant to undefined, causing PropTypes
warnings; update the prop-type definition for variant to allow both "card" and
undefined (e.g., include null/undefined or make it optional) or remove the oneOf
restriction so runtime behavior matches validation, and ensure
DashboardSection.defaultProps still defines variant as undefined if you want the
non-card default.


export default DashboardSection;
46 changes: 46 additions & 0 deletions src/pages/summits/components/dashboard-stat-section.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";
import PropTypes from "prop-types";
import Divider from "@mui/material/Divider";
import Grid2 from "@mui/material/Grid2";
import DashboardSection from "./dashboard-section";
import SummitDashboardStat from "./summit-dashboard-stat";

const GRID_COLUMNS = 12;

function DashboardStatSection({ title, rows }) {
return (
<DashboardSection title={title} variant="card">
{rows.map((group, i) => {
if (!group.length) return null;
const size = Math.floor(GRID_COLUMNS / group.length);
const key = group[0]?.title ?? `group-${i}`;
return (
<React.Fragment key={key}>
{i > 0 && <Divider />}
<Grid2 container>
{group.map(({ title: label, stat: value }) => (
<Grid2 key={label} size={size}>
<SummitDashboardStat label={label} value={value} />
</Grid2>
))}
</Grid2>
</React.Fragment>
);
})}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</DashboardSection>
);
}

DashboardStatSection.propTypes = {
title: PropTypes.string.isRequired,
rows: PropTypes.arrayOf(
PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string.isRequired,
stat: PropTypes.number
})
)
).isRequired
};

export default DashboardStatSection;
50 changes: 50 additions & 0 deletions src/pages/summits/components/summit-dashboard-date-range.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import RemoveIcon from "@mui/icons-material/Remove";
import { formatDate } from "../../../utils/methods";
import { DATETIME_FORMAT } from "../../../utils/constants";

function SummitDashboardDateRange({ label, startTs, endTs, tzName }) {
if (!startTs || !endTs) return null;

return (
<Box
sx={{
display: "flex",
alignItems: "center",
height: 75,
px: 2,
borderBottom: 1,
borderColor: "divider"
}}
>
<Box sx={{ minWidth: 120 }}>
<Typography variant="body2">{label}</Typography>
</Box>
<Typography variant="body1">
{formatDate(startTs, tzName, DATETIME_FORMAT)}
</Typography>
<RemoveIcon sx={{ mx: 2, fontSize: 16 }} />
<Typography variant="body1">
{formatDate(endTs, tzName, DATETIME_FORMAT)}
</Typography>
</Box>
);
}

SummitDashboardDateRange.propTypes = {
label: PropTypes.string.isRequired,
startTs: PropTypes.number,
endTs: PropTypes.number,
tzName: PropTypes.string
};

SummitDashboardDateRange.defaultProps = {
startTs: null,
endTs: null,
tzName: undefined
};

export default SummitDashboardDateRange;
26 changes: 26 additions & 0 deletions src/pages/summits/components/summit-dashboard-stat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";

function SummitDashboardStat({ label, value }) {
return (
<Box sx={{ p: 2 }}>
<Typography variant="body2" color="text.secondary" gutterBottom>
{label}
</Typography>
<Typography variant="h3">{value}</Typography>
</Box>
);
}

SummitDashboardStat.propTypes = {
label: PropTypes.string.isRequired,
value: PropTypes.number
};

SummitDashboardStat.defaultProps = {
value: 0
};

export default SummitDashboardStat;
Loading
Loading