Skip to content

Commit c5b30af

Browse files
committed
chore(format): fix CI formatting for backend (ruff) and frontend (prettier)
1 parent e9dd5eb commit c5b30af

File tree

10 files changed

+102
-93
lines changed

10 files changed

+102
-93
lines changed

backend/tests/unit/test_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ async def test_update_user_by_id(db_session):
533533
db_session.rollback()
534534
raise
535535

536+
536537
# Error case tests
537538
@pytest.mark.asyncio
538539
async def test_delete_nonexistent_user_by_email(db_session):

frontend/src/components/ranking/caregiver-ranking-form.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export function CaregiverRankingForm({
2525
const kind = itemKinds?.[index];
2626
const scope = itemScopes?.[index];
2727
const isLovedOneQuality = kind === 'quality' && scope === 'loved_one';
28-
const isLovedOneDynamic = (kind === 'treatment' || kind === 'experience') && scope === 'loved_one';
28+
const isLovedOneDynamic =
29+
(kind === 'treatment' || kind === 'experience') && scope === 'loved_one';
2930
const prefix = isLovedOneQuality
3031
? 'I would prefer a volunteer whose loved one is '
3132
: isLovedOneDynamic
@@ -34,7 +35,9 @@ export function CaregiverRankingForm({
3435
return (
3536
<>
3637
{prefix}
37-
<Text as="span" fontWeight={700}>{label}</Text>
38+
<Text as="span" fontWeight={700}>
39+
{label}
40+
</Text>
3841
</>
3942
);
4043
};

frontend/src/components/ranking/caregiver-two-column-qualities-form.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ export function CaregiverTwoColumnQualitiesForm({
4747
}: CaregiverTwoColumnQualitiesFormProps) {
4848
const maxSelected = 5;
4949
const reachedMax = selectedQualities.length >= maxSelected;
50-
const volunteerOptions = (leftOptions && leftOptions.length > 0)
51-
? leftOptions
52-
: VOLUNTEER_OPTIONS.map((label) => ({ key: label, label }));
53-
const lovedOneOptions = (rightOptions && rightOptions.length > 0)
54-
? rightOptions
55-
: LOVED_ONE_OPTIONS.map((label) => ({ key: label, label }));
50+
const volunteerOptions =
51+
leftOptions && leftOptions.length > 0
52+
? leftOptions
53+
: VOLUNTEER_OPTIONS.map((label) => ({ key: label, label }));
54+
const lovedOneOptions =
55+
rightOptions && rightOptions.length > 0
56+
? rightOptions
57+
: LOVED_ONE_OPTIONS.map((label) => ({ key: label, label }));
5658

5759
return (
5860
<Box>

frontend/src/components/ranking/volunteer-ranking-form.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export function VolunteerRankingForm({
2525
const kind = itemKinds?.[index];
2626
const scope = itemScopes?.[index];
2727
const isLovedOneQuality = kind === 'quality' && scope === 'loved_one';
28-
const isLovedOneDynamic = (kind === 'treatment' || kind === 'experience') && scope === 'loved_one';
28+
const isLovedOneDynamic =
29+
(kind === 'treatment' || kind === 'experience') && scope === 'loved_one';
2930
const prefix = isLovedOneQuality
3031
? 'I would prefer a volunteer whose loved one is '
3132
: isLovedOneDynamic
@@ -34,7 +35,9 @@ export function VolunteerRankingForm({
3435
return (
3536
<>
3637
{prefix}
37-
<Text as="span" fontWeight={700}>{label}</Text>
38+
<Text as="span" fontWeight={700}>
39+
{label}
40+
</Text>
3841
</>
3942
);
4043
};

frontend/src/components/ui/checkmark-icon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ export const CheckMarkIcon: React.FC = () => (
2424
/>
2525
</svg>
2626
</Box>
27-
);
27+
);

frontend/src/components/ui/drag-icon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export const DragIcon: React.FC = () => (
1010
<circle cx="4" cy="12" r="1.5" fill={COLORS.fieldGray} />
1111
<circle cx="12" cy="12" r="1.5" fill={COLORS.fieldGray} />
1212
</svg>
13-
);
13+
);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { UserIcon } from './user-icon';
22
export { CheckMarkIcon } from './checkmark-icon';
33
export { DragIcon } from './drag-icon';
4-
export { WelcomeScreen } from './welcome-screen';
4+
export { WelcomeScreen } from './welcome-screen';

frontend/src/components/ui/user-icon.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,15 @@ import { Box } from '@chakra-ui/react';
33
import { COLORS } from '@/constants/form';
44

55
export const UserIcon: React.FC = () => (
6-
<Box
7-
mx="auto"
8-
display="flex"
9-
alignItems="center"
10-
justifyContent="center"
11-
mb={6}
12-
>
6+
<Box mx="auto" display="flex" alignItems="center" justifyContent="center" mb={6}>
137
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke={COLORS.teal}>
14-
<path
8+
<path
159
d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"
1610
strokeWidth="2"
1711
strokeLinecap="round"
1812
strokeLinejoin="round"
1913
/>
20-
<circle
21-
cx="12"
22-
cy="7"
23-
r="4"
24-
strokeWidth="2"
25-
fill="none"
26-
/>
14+
<circle cx="12" cy="7" r="4" strokeWidth="2" fill="none" />
2715
</svg>
2816
</Box>
29-
);
17+
);

frontend/src/components/ui/welcome-screen.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
1414
icon,
1515
title,
1616
description,
17-
buttonText = "Continue",
18-
onContinue
17+
buttonText = 'Continue',
18+
onContinue,
1919
}) => (
2020
<Box
2121
minH="100vh"
@@ -25,12 +25,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
2525
justifyContent="center"
2626
px={4}
2727
>
28-
<Box
29-
w="full"
30-
maxW="384px"
31-
mx="auto"
32-
textAlign="center"
33-
>
28+
<Box w="full" maxW="384px" mx="auto" textAlign="center">
3429
{icon}
3530

3631
<Heading
@@ -78,4 +73,4 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({
7873
</Button>
7974
</Box>
8075
</Box>
81-
);
76+
);

frontend/src/pages/participant/ranking.tsx

Lines changed: 72 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export default function ParticipantRankingPage({
6161
participantType = 'caregiver',
6262
caregiverHasCancer = true,
6363
}: ParticipantRankingPageProps) {
64-
const [derivedParticipantType, setDerivedParticipantType] = useState<'cancerPatient' | 'caregiver' | null>(null);
64+
const [derivedParticipantType, setDerivedParticipantType] = useState<
65+
'cancerPatient' | 'caregiver' | null
66+
>(null);
6567
const [derivedCaregiverHasCancer, setDerivedCaregiverHasCancer] = useState<boolean | null>(null);
6668
const [isLoadingCase, setIsLoadingCase] = useState<boolean>(false);
6769

@@ -133,7 +135,9 @@ export default function ParticipantRankingPage({
133135
try {
134136
setIsLoadingOptions(true);
135137
setOptionsError(null);
136-
const { data } = await baseAPIClient.get<OptionsResponse>('/ranking/options', { params: { target } });
138+
const { data } = await baseAPIClient.get<OptionsResponse>('/ranking/options', {
139+
params: { target },
140+
});
137141
const staticQualitiesExpanded: DisplayOption[] = (data.staticQualities || []).flatMap((q) => {
138142
const scopes = q.allowedScopes || [];
139143
return scopes.map((s) => ({
@@ -219,7 +223,11 @@ export default function ParticipantRankingPage({
219223

220224
// For patient flow, fetch options once
221225
useEffect(() => {
222-
if (effectiveParticipantType === 'cancerPatient' && singleColumnOptions.length === 0 && !isLoadingOptions) {
226+
if (
227+
effectiveParticipantType === 'cancerPatient' &&
228+
singleColumnOptions.length === 0 &&
229+
!isLoadingOptions
230+
) {
223231
fetchOptions('patient');
224232
}
225233
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -236,7 +244,9 @@ export default function ParticipantRankingPage({
236244
p={10}
237245
>
238246
{optionsError ? (
239-
<Text color="red.500" mb={4}>{optionsError}</Text>
247+
<Text color="red.500" mb={4}>
248+
{optionsError}
249+
</Text>
240250
) : null}
241251

242252
{effectiveParticipantType === 'caregiver' ? (
@@ -303,38 +313,23 @@ export default function ParticipantRankingPage({
303313
boxShadow="0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"
304314
p={10}
305315
>
306-
{// Prefer explicit flag; otherwise infer from value
307-
(formData.isCaregiverVolunteerFlow ?? false) ||
308-
formData.volunteerType === 'caringForLovedOne' ||
309-
(!!formData.volunteerType && formData.volunteerType !== 'similarDiagnosis') ? (
310-
<CaregiverTwoColumnQualitiesForm
311-
selectedQualities={formData.selectedQualities}
312-
onQualityToggle={toggleQuality}
313-
leftOptions={leftColumnOptions}
314-
rightOptions={rightColumnOptions}
315-
onNext={() => {
316-
if (leftColumnOptions.length === 0 && rightColumnOptions.length === 0 && !isLoadingOptions) {
317-
fetchOptions('caregiver');
318-
}
319-
const keys = formData.selectedQualities;
320-
const labels = keys.map((k) => optionsIndex[k]?.label || k);
321-
setFormData((prev) => ({
322-
...prev,
323-
rankedPreferences: [...labels],
324-
rankedKeys: [...keys],
325-
}));
326-
setCurrentStep(4);
327-
}}
328-
/>
329-
) : effectiveCaregiverHasCancer ? (
330-
formData.volunteerType === 'similarDiagnosis' ? (
331-
<CaregiverQualitiesForm
316+
{
317+
// Prefer explicit flag; otherwise infer from value
318+
(formData.isCaregiverVolunteerFlow ?? false) ||
319+
formData.volunteerType === 'caringForLovedOne' ||
320+
(!!formData.volunteerType && formData.volunteerType !== 'similarDiagnosis') ? (
321+
<CaregiverTwoColumnQualitiesForm
332322
selectedQualities={formData.selectedQualities}
333323
onQualityToggle={toggleQuality}
334-
options={singleColumnOptions}
324+
leftOptions={leftColumnOptions}
325+
rightOptions={rightColumnOptions}
335326
onNext={() => {
336-
if (singleColumnOptions.length === 0 && !isLoadingOptions) {
337-
fetchOptions('patient');
327+
if (
328+
leftColumnOptions.length === 0 &&
329+
rightColumnOptions.length === 0 &&
330+
!isLoadingOptions
331+
) {
332+
fetchOptions('caregiver');
338333
}
339334
const keys = formData.selectedQualities;
340335
const labels = keys.map((k) => optionsIndex[k]?.label || k);
@@ -346,8 +341,48 @@ export default function ParticipantRankingPage({
346341
setCurrentStep(4);
347342
}}
348343
/>
344+
) : effectiveCaregiverHasCancer ? (
345+
formData.volunteerType === 'similarDiagnosis' ? (
346+
<CaregiverQualitiesForm
347+
selectedQualities={formData.selectedQualities}
348+
onQualityToggle={toggleQuality}
349+
options={singleColumnOptions}
350+
onNext={() => {
351+
if (singleColumnOptions.length === 0 && !isLoadingOptions) {
352+
fetchOptions('patient');
353+
}
354+
const keys = formData.selectedQualities;
355+
const labels = keys.map((k) => optionsIndex[k]?.label || k);
356+
setFormData((prev) => ({
357+
...prev,
358+
rankedPreferences: [...labels],
359+
rankedKeys: [...keys],
360+
}));
361+
setCurrentStep(4);
362+
}}
363+
/>
364+
) : (
365+
<VolunteerMatchingForm
366+
selectedQualities={formData.selectedQualities}
367+
onQualityToggle={toggleQuality}
368+
options={singleColumnOptions}
369+
onNext={() => {
370+
if (singleColumnOptions.length === 0 && !isLoadingOptions) {
371+
fetchOptions('patient');
372+
}
373+
const keys = formData.selectedQualities;
374+
const labels = keys.map((k) => optionsIndex[k]?.label || k);
375+
setFormData((prev) => ({
376+
...prev,
377+
rankedPreferences: [...labels],
378+
rankedKeys: [...keys],
379+
}));
380+
setCurrentStep(4);
381+
}}
382+
/>
383+
)
349384
) : (
350-
<VolunteerMatchingForm
385+
<CaregiverQualitiesForm
351386
selectedQualities={formData.selectedQualities}
352387
onQualityToggle={toggleQuality}
353388
options={singleColumnOptions}
@@ -366,26 +401,7 @@ export default function ParticipantRankingPage({
366401
}}
367402
/>
368403
)
369-
) : (
370-
<CaregiverQualitiesForm
371-
selectedQualities={formData.selectedQualities}
372-
onQualityToggle={toggleQuality}
373-
options={singleColumnOptions}
374-
onNext={() => {
375-
if (singleColumnOptions.length === 0 && !isLoadingOptions) {
376-
fetchOptions('patient');
377-
}
378-
const keys = formData.selectedQualities;
379-
const labels = keys.map((k) => optionsIndex[k]?.label || k);
380-
setFormData((prev) => ({
381-
...prev,
382-
rankedPreferences: [...labels],
383-
rankedKeys: [...keys],
384-
}));
385-
setCurrentStep(4);
386-
}}
387-
/>
388-
)}
404+
}
389405
</Box>
390406
</Flex>
391407
);
@@ -411,7 +427,8 @@ export default function ParticipantRankingPage({
411427
let target: 'patient' | 'caregiver' = 'patient';
412428
if (
413429
effectiveParticipantType === 'caregiver' &&
414-
((formData.isCaregiverVolunteerFlow ?? false) || formData.volunteerType === 'caringForLovedOne')
430+
((formData.isCaregiverVolunteerFlow ?? false) ||
431+
formData.volunteerType === 'caringForLovedOne')
415432
) {
416433
target = 'caregiver';
417434
} else {

0 commit comments

Comments
 (0)