Skip to content

Commit 6d9e8bc

Browse files
committed
better looking spending bar and shared datagrid
1 parent 4abc205 commit 6d9e8bc

4 files changed

Lines changed: 211 additions & 194 deletions

File tree

src/frontend/src/components/NERDataGrid.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface NERDataGridProps<T> {
1313
columns: GridColDef[];
1414
pageSizeDefault?: number;
1515
rowsPerPageOptions?: number[];
16-
onAdd: () => void;
16+
onAdd?: () => void;
1717
addLabel?: string; // optional label for the add/create button (defaults to 'Add')
1818
onRowClick?: (item: T) => void;
1919
// optional simple search fields (keys of mapped row) or a custom filter function
@@ -97,9 +97,11 @@ function NERDataGrid<T>({
9797
placeholder="Search"
9898
sx={{ flex: 1 }}
9999
/>
100-
<Button variant="contained" size="small" onClick={onAdd} sx={{ ml: 1 }}>
101-
{addLabel}
102-
</Button>
100+
{onAdd && (
101+
<Button variant="contained" size="small" onClick={onAdd} sx={{ ml: 1 }}>
102+
{addLabel}
103+
</Button>
104+
)}
103105
</Box>
104106

105107
<Box sx={{ flex: 1, minHeight: 0 }}>

src/frontend/src/pages/FinancePage/FinanceComponents/PieChart.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ const FinancePieChart: React.FC<FinancePieChartProps> = ({
2525
}) => {
2626
const [isLegendOpen, setIsLegendOpen] = useState(true);
2727

28-
const pendingReimbursement = pendingLeadership + pendingFinance + submittedToSABO;
29-
3028
const [sectionStates, setSectionStates] = useState([
3129
{ title: 'Pending Approval', color: '#562016', expanded: false },
3230
{ title: 'Approved', color: '#8e3c2d', expanded: false },

src/frontend/src/pages/FinancePage/FinanceComponents/ReimbursementRequestInfo.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Box } from '@mui/material';
2-
import { useLocation, useHistory } from 'react-router-dom';
3-
import { useState } from 'react';
2+
import { useLocation, useHistory, useParams } from 'react-router-dom';
3+
import { useState, useEffect } from 'react';
44
import { isGuest, ReimbursementRequest } from 'shared';
55
import { ReimbursementProduct, ReimbursementStatusType } from 'shared';
66
import {
@@ -48,7 +48,12 @@ const ReimbursementRequestInfo = ({
4848
const user = useCurrentUser();
4949
const history = useHistory();
5050
const { pathname } = useLocation();
51-
const [showSidePage, setShowSidePage] = useState(false);
51+
const { id } = useParams<{ id?: string }>();
52+
const [showSidePage, setShowSidePage] = useState(!!id);
53+
54+
useEffect(() => {
55+
if (id) setShowSidePage(true);
56+
}, [id]);
5257

5358
const displayedReimbursementRequests =
5459
canViewAllReimbursementRequests && currentTab === 1 && allReimbursementRequests

0 commit comments

Comments
 (0)