Skip to content

Commit 87e705b

Browse files
authored
Merge branch 'development' into Sanjeev-fix-create-new-event-button
2 parents 15f6e67 + e3f32ab commit 87e705b

40 files changed

Lines changed: 2166 additions & 677 deletions

.husky/pre-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/bin/sh
2+
# Load nvm if available
3+
export NVM_DIR="$HOME/.nvm"
4+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
5+
# Use Node 20 if available (or install if needed)
6+
if [ -f .nvmrc ]; then
7+
nvm use 20 2>/dev/null || nvm install 20 && nvm use 20
8+
fi
9+
210
. "$(dirname "$0")/_/husky.sh"
311

412
echo ""

.husky/pre-push

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#!/bin/sh
2+
# Load nvm if available
3+
export NVM_DIR="$HOME/.nvm"
4+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
5+
# Use Node 20 if available (or install if needed)
6+
if [ -f .nvmrc ]; then
7+
nvm use 20 2>/dev/null || nvm install 20 && nvm use 20
8+
fi
9+
210
. "$(dirname "$0")/_/husky.sh"
311

412
echo "🧪 Running tests before push..."

git

Whitespace-only changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,4 @@
210210
"optionalDependencies": {
211211
"@rollup/rollup-darwin-arm64": "^4.54.0"
212212
}
213-
}
213+
}

src/actions/__tests__/authActions.js.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ describe('authActions', () => {
116116

117117
expect(setHeaderData(data)).toEqual(expectedAction); // Assert the action
118118
});
119-
});
119+
});

src/actions/authActions.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export const getHeaderData = userId => {
115115
};
116116
};
117117

118-
export const logoutUser = () => dispatch => {
118+
export const logoutUser = () => (dispatch) => {
119119
// Clear any active force-logout timer before logging out
120120
dispatch(stopForceLogout());
121121
localStorage.removeItem(tokenKey);
@@ -135,18 +135,18 @@ export const startForceLogout = (delayMs = 20000) => (dispatch, getState) => {
135135
const timerId = setTimeout(async () => {
136136
try {
137137
const { userProfile } = getState();
138-
138+
139139
if (userProfile && userProfile._id) {
140140
const { firstName: name, lastName, personalLinks, adminLinks, _id } = userProfile;
141-
141+
142142
await axios.put(ENDPOINTS.USER_PROFILE(_id), {
143143
firstName: name,
144144
lastName,
145145
personalLinks,
146146
adminLinks,
147147
isAcknowledged: true,
148148
});
149-
149+
150150
// eslint-disable-next-line no-console
151151
console.log('Permission changes acknowledged during force logout');
152152
}

src/components/Auth/PermissionWatcher.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect, useState, useRef } from 'react';
22
import { useSelector, useDispatch } from 'react-redux';
33
import axios from 'axios';
44
import { ENDPOINTS } from '~/utils/URL';

src/components/BMDashboard/BMDashboard.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,17 @@ export function BMDashboard() {
6666
}
6767
});
6868

69-
// Handle containers
69+
// Handle containers - only target containers within BMDashboard, not ProjectDetails
7070
const containers = bmContainer.querySelectorAll(
71-
'.container, .projects-list, .project-summary, .log-bar, .log-bar-dark',
71+
'.container, .projects-list, .project-summary',
7272
);
7373
containers.forEach(container => {
74+
// Skip if it's inside ProjectDetails (has project-details class in parent)
75+
const isInProjectDetails = container.closest('.project-details, .project-details-dark');
76+
if (isInProjectDetails) {
77+
return; // Don't override ProjectDetails styles
78+
}
79+
7480
if (darkMode) {
7581
container.style.setProperty('background-color', '#1b2a41', 'important');
7682
container.style.setProperty('color', '#ffffff', 'important');
@@ -80,11 +86,17 @@ export function BMDashboard() {
8086
}
8187
});
8288

83-
// Handle LogBar headings specifically
89+
// Handle LogBar headings specifically - only within BMDashboard, not ProjectDetails
8490
const logBarHeadings = bmContainer.querySelectorAll(
8591
'.log-bar h2, .log-bar-dark h2, .log-bar__section h2',
8692
);
8793
logBarHeadings.forEach(heading => {
94+
// Skip if it's inside ProjectDetails (has project-details class in parent)
95+
const isInProjectDetails = heading.closest('.project-details, .project-details-dark');
96+
if (isInProjectDetails) {
97+
return; // Don't override ProjectDetails LogBar styles
98+
}
99+
88100
if (darkMode) {
89101
heading.style.setProperty('color', '#ffffff', 'important');
90102
heading.style.setProperty('text-shadow', '0 1px 2px rgba(0, 0, 0, 0.5)', 'important');

src/components/BMDashboard/Equipment/Add/AddTypeForm.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useState, useEffect } from 'react';
2+
import { useDispatch } from 'react-redux';
23
import { Form, FormGroup, FormFeedback, Label, Input, Button } from 'reactstrap';
34
import Joi from 'joi-browser';
45
import { toast } from 'react-toastify';
56
import { useHistory } from 'react-router-dom';
67

7-
import { addEquipmentType } from '~/actions/bmdashboard/equipmentActions';
8+
import { addEquipmentType, fetchAllEquipments } from '~/actions/bmdashboard/equipmentActions';
89

910
const FuelTypes = {
1011
dies: 'Diesel',
@@ -25,6 +26,7 @@ const schema = Joi.object({
2526

2627
export default function AddTypeForm() {
2728
const history = useHistory();
29+
const dispatch = useDispatch();
2830
const [name, setName] = useState('');
2931
const [desc, setDesc] = useState('');
3032
const [fuel, setFuel] = useState(FuelTypes.dies);
@@ -62,6 +64,8 @@ export default function AddTypeForm() {
6264
const response = await addEquipmentType({ name, desc, fuel });
6365
if (response.status === 201) {
6466
toast.success('Success: new equipment type added.');
67+
// Refresh the equipment list to show the newly added item
68+
dispatch(fetchAllEquipments());
6569
setIsRedirected(true);
6670
} else if (response.status === 409) {
6771
toast.error(`Error: that type already exists.`);

src/components/BMDashboard/Issues/IssueDashboard.jsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export default function IssueDashboard() {
106106
</div>
107107
<Row className="mb-3">
108108
<Col>
109-
<h4 className="fw-semibold">Issue Dashboard</h4>
109+
<h4 className={`fw-semibold ${darkMode ? 'text-light' : ''}`}>Issue Dashboard</h4>
110110
</Col>
111111
</Row>
112112

@@ -135,13 +135,13 @@ export default function IssueDashboard() {
135135

136136
return (
137137
<tr key={issue._id}>
138-
<td className="fw-medium">{issue.name}</td>
139-
<td>{openSince}</td>
138+
<td className={`fw-medium ${darkMode ? 'text-light' : ''}`}>{issue.name}</td>
139+
<td className={darkMode ? 'text-light' : ''}>{openSince}</td>
140140
<td>
141141
<span className={`${styles.badge} ${styles.bgInfo} text-dark`}>{category}</span>
142142
</td>
143-
<td>{assignedTo}</td>
144-
<td>{cost}</td>
143+
<td className={darkMode ? 'text-light' : ''}>{assignedTo}</td>
144+
<td className={darkMode ? 'text-light' : ''}>{cost}</td>
145145
<td className={`${styles.textEnd} position-relative`}>
146146
<div className={`issue-dashboard-dropdown ${darkMode ? 'bg-oxide-blue' : ''}`}>
147147
<button
@@ -155,7 +155,9 @@ export default function IssueDashboard() {
155155

156156
{menuOpen === issue._id && (
157157
<div
158-
className={`issue-dashboard-dropdown-menu show action-menu${
158+
className={`issue-dashboard-dropdown-menu show ${styles.actionMenu} ${
159+
darkMode ? styles.actionMenuDark : ''
160+
} ${
159161
currentItems.indexOf(issue) === currentItems.length - 1
160162
? ' last-row-menu'
161163
: ''
@@ -204,7 +206,10 @@ export default function IssueDashboard() {
204206

205207
{issues.length === 0 && (
206208
<tr>
207-
<td colSpan="6" className="text-center py-4 text-muted">
209+
<td
210+
colSpan="6"
211+
className={`text-center py-4 ${darkMode ? 'text-light' : 'text-muted'}`}
212+
>
208213
No issues found. Create one to get started.
209214
</td>
210215
</tr>
@@ -215,10 +220,10 @@ export default function IssueDashboard() {
215220

216221
<div
217222
className={`card-footer d-flex justify-content-between align-items-center ${
218-
darkMode ? 'bg-dark text-light' : 'bg-light text-muted'
223+
darkMode ? 'bg-space-cadet text-light' : 'bg-light text-muted'
219224
}`}
220225
>
221-
<div className="small">
226+
<div className={`small ${darkMode ? 'text-light' : ''}`}>
222227
Showing {currentItems.length} of {issues.length} issues
223228
</div>
224229
<nav aria-label="Issue pagination">

0 commit comments

Comments
 (0)