Skip to content

Commit 16704d8

Browse files
Merge pull request #5011 from OneCommunityGlobal/aseem-application-jobposting-avghours
Aseem-Application/Job Posting Avg Weekly hours UI changes
2 parents 8ca88ac + f22dd72 commit 16704d8

3 files changed

Lines changed: 84 additions & 22 deletions

File tree

.husky/pre-commit

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/bin/sh
22
# Load nvm if available
3+
# Try to load nvm (non-blocking)
34
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
5+
6+
if [ -s "$NVM_DIR/nvm.sh" ]; then
7+
. "$NVM_DIR/nvm.sh"
8+
nvm use >/dev/null 2>&1
9+
echo "Using Node via nvm"
10+
else
11+
echo "nvm not available, using system Node"
812
fi
913

1014
echo ""

src/components/JobAnalytics/HoursPledgedChart/HoursPledgedChart.jsx

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ function HoursPledgedChart() {
8181

8282
const processedData = Object.values(roleMap).map(roleData => ({
8383
role: roleData.role,
84-
avgHours: roleData.totalHours / roleData.count,
84+
avgHours: (roleData.totalHours / roleData.count).toFixed(2),
8585
}));
8686

87-
processedData.sort((a, b) => b.avgHours - a.avgHours);
87+
processedData.sort((a, b) => Number(b.avgHours) - Number(a.avgHours));
8888
setChartData(processedData);
8989
}, [rawData, startDate, endDate, selectedRoles]);
9090

@@ -124,9 +124,48 @@ function HoursPledgedChart() {
124124
onChange={setSelectedRoles}
125125
placeholder="Select Roles"
126126
styles={{
127+
control: base => ({
128+
...base,
129+
backgroundColor: darkMode ? '#1c2541' : base.backgroundColor,
130+
}),
131+
menu: base => ({
132+
...base,
133+
backgroundColor: darkMode ? '#1c2541' : base.backgroundColor,
134+
}),
135+
option: (base, state) => ({
136+
...base,
137+
backgroundColor: darkMode
138+
? state.isFocused
139+
? '#47526dff'
140+
: '#1c2541'
141+
: base.backgroundColor,
142+
color: darkMode ? '#ffffff' : base.color,
143+
}),
127144
placeholder: base => ({
128145
...base,
129-
color: 'black',
146+
color: darkMode ? '#ffffff' : base.color,
147+
}),
148+
input: base => ({
149+
...base,
150+
color: darkMode ? '#ffffff' : base.color,
151+
}),
152+
multiValue: base => ({
153+
...base,
154+
backgroundColor: darkMode ? '#47526d' : base.backgroundColor,
155+
}),
156+
157+
multiValueLabel: base => ({
158+
...base,
159+
color: darkMode ? '#ffffff' : base.color,
160+
}),
161+
162+
multiValueRemove: base => ({
163+
...base,
164+
color: darkMode ? '#ffffff' : base.color,
165+
':hover': {
166+
backgroundColor: darkMode ? '#5a6a85' : base[':hover']?.backgroundColor,
167+
color: '#ffffff',
168+
},
130169
}),
131170
}}
132171
/>
@@ -147,24 +186,35 @@ function HoursPledgedChart() {
147186
height={400}
148187
data={chartData}
149188
layout="vertical"
150-
margin={{ top: 20, right: 30, left: 100, bottom: 20 }}
189+
margin={{ top: 20, right: 80, left: 100, bottom: 60 }}
151190
>
152191
<CartesianGrid strokeDasharray="3 3" />
153-
<XAxis type="number" dataKey="avgHours">
154-
<Label value="Average Hours Pledged" position="insideBottom" offset={-10} />
192+
<XAxis type="number" dataKey="avgHours" width={120} tickMargin={15}>
193+
<Label value="Average Hours Pledged" position="insideBottom" offset={-20} dy={10} />
155194
</XAxis>
156-
<YAxis type="category" dataKey="role">
195+
<YAxis type="category" dataKey="role" width={120} tickMargin={15}>
157196
<Label
158197
value="Name of Role"
159198
angle={-90}
160199
position="outsideCenter"
161200
offset={-20}
162-
dx={-50}
201+
dx={-70}
163202
/>
164203
</YAxis>
165-
<Tooltip />
166-
<Bar dataKey="avgHours" fill={darkMode ? '#225163' : '#8884d8'}>
167-
<LabelList dataKey="avgHours" position="right" />
204+
<Tooltip
205+
contentStyle={{
206+
backgroundColor: darkMode ? '#1c2541' : '#ffffff',
207+
color: darkMode ? '#ffffff' : '#000000',
208+
}}
209+
labelStyle={{
210+
color: darkMode ? '#ffffff' : '#000000',
211+
}}
212+
itemStyle={{
213+
color: darkMode ? '#ffffff' : '#000000',
214+
}}
215+
/>
216+
<Bar dataKey="avgHours" fill={darkMode ? '#9ca5f6ff' : '#8884d8'}>
217+
<LabelList dataKey="avgHours" position="right" formatter={v => v} />
168218
</Bar>
169219
</BarChart>
170220
)}

src/components/JobAnalytics/HoursPledgedChart/HoursPledgedChart.module.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.hoursPledgedChart {
22
font-family: Arial, sans-serif;
33
padding: 20px;
4-
background-color: #ffffff;
5-
color: #000000;
4+
background-color: #fff;
5+
color: #000;
66
min-height: 100vh;
77
transition: background-color 0.3s, color 0.3s;
88
}
@@ -23,18 +23,18 @@
2323
box-shadow: 2px 2px 4px 1px black;
2424
}
2525

26+
.hpChartContainer {
27+
display: flex;
28+
justify-content: center;
29+
}
30+
2631
.darkMode .hpChartContainer {
2732
background-color: #1c2541;
2833
color: #f1f1f1;
2934
box-shadow: 2px 2px 4px 1px black;
3035
border: none;
3136
}
3237

33-
.hpChartContainer {
34-
display: flex;
35-
justify-content: center;
36-
}
37-
3838
.hpDateFilter,
3939
.hpRoleFilter {
4040
display: flex;
@@ -49,13 +49,21 @@
4949
border: 1px solid #ccc;
5050
border-radius: 4px;
5151
width: 100%;
52+
53+
}
54+
55+
.darkMode .hpDateFilter input {
56+
background-color: #1c2541;
57+
color: #fff;
58+
border: 1px solid #47526d;
5259
}
5360

5461
label {
5562
font-weight: bold;
5663
margin-bottom: 5px;
5764
}
5865

66+
5967
.darkMode label {
6068
color: #f1f1f1 !important;
6169
}

0 commit comments

Comments
 (0)