Skip to content

Commit 6dfd7e3

Browse files
author
RoshiniSeelamsetty
committed
style(total-org-summary): fix prettier formatting for pie chart updates
1 parent 8b1628b commit 6dfd7e3

2 files changed

Lines changed: 35 additions & 10 deletions

File tree

src/components/TotalOrgSummary/HoursWorkedPieChart/HoursWorkedPieChart.jsx

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ const parseHexColor = color => {
4141

4242
const channelToLinear = c => {
4343
const normalized = c / 255;
44-
return normalized <= 0.03928
45-
? normalized / 12.92
46-
: ((normalized + 0.055) / 1.055) ** 2.4;
44+
return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
4745
};
4846

4947
const relativeLuminance = ({ r, g, b }) =>
@@ -75,13 +73,34 @@ export const renderCenterLabel = ({ darkMode, isMobile, totalHours }) => {
7573

7674
return (
7775
<>
78-
<text x="50%" y="50%" dy={-26} textAnchor="middle" fill={centerFill} fontSize={isMobile ? 16 : 20}>
76+
<text
77+
x="50%"
78+
y="50%"
79+
dy={-26}
80+
textAnchor="middle"
81+
fill={centerFill}
82+
fontSize={isMobile ? 16 : 20}
83+
>
7984
TOTAL HOURS
8085
</text>
81-
<text x="50%" y="50%" dy={-6} textAnchor="middle" fill={centerFill} fontSize={isMobile ? 16 : 20}>
86+
<text
87+
x="50%"
88+
y="50%"
89+
dy={-6}
90+
textAnchor="middle"
91+
fill={centerFill}
92+
fontSize={isMobile ? 16 : 20}
93+
>
8294
WORKED
8395
</text>
84-
<text x="50%" y="50%" dy={28} textAnchor="middle" fill={centerFill} fontSize={centerValueFontSize}>
96+
<text
97+
x="50%"
98+
y="50%"
99+
dy={28}
100+
textAnchor="middle"
101+
fill={centerFill}
102+
fontSize={centerValueFontSize}
103+
>
85104
{totalText}
86105
</text>
87106
</>
@@ -109,7 +128,7 @@ const renderCustomizedLabel = ({
109128

110129
// Thin wedges cannot fit two long lines; use adaptive compact labels.
111130
const hideAllLabels = percent < 0.005; // < 0.5%
112-
const isTinySlice = percent < 0.025; // < 2.5%
131+
const isTinySlice = percent < 0.025; // < 2.5%
113132
const useCompactLabel = percent < 0.1; // < 10%
114133
const canShowPercent = percent >= 0.1; // >= 10% has room for percentage
115134
// Keep small-slice labels centered in each wedge band for better visual alignment.
@@ -129,7 +148,7 @@ const renderCustomizedLabel = ({
129148

130149
const valueFontSize = isMobile ? 11 : 12;
131150
const percentFontSize = isMobile ? 8 : 9;
132-
const valueY = y - (isMobile ? 7 : 9); // More breathing room above
151+
const valueY = y - (isMobile ? 7 : 9); // More breathing room above
133152
const percentY = y + (isMobile ? 7 : 9); // More breathing room below
134153
const chartLabelValue = formatChartLabelValue(value);
135154

@@ -184,7 +203,13 @@ const renderCustomizedLabel = ({
184203

185204
import CustomTooltip from '../../CustomTooltip';
186205

187-
export default function HoursWorkedPieChart({ userData, windowSize, colors, totalHours = 0, darkMode = false }) {
206+
export default function HoursWorkedPieChart({
207+
userData,
208+
windowSize,
209+
colors,
210+
totalHours = 0,
211+
darkMode = false,
212+
}) {
188213
let innerRadius = 80;
189214
let outerRadius = 160;
190215
if (windowSize.width <= 650) {

src/components/TotalOrgSummary/HoursWorkedPieChart/__tests__/HoursWorkedPieChart.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ describe('renderCenterLabel', () => {
2222
expect(screen.getByText('WORKED')).toBeInTheDocument();
2323
expect(screen.getByText('241,989')).toBeInTheDocument();
2424
});
25-
});
25+
});

0 commit comments

Comments
 (0)