Skip to content

Commit 2e4caba

Browse files
committed
chore: automated code formatting fixes via CI pipeline
1 parent f654253 commit 2e4caba

25 files changed

Lines changed: 840 additions & 923 deletions

src/design-system/DESIGN_SYSTEM.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
/**
2-
* SubTrackr Design System - Complete Documentation
3-
*
4-
* This document provides comprehensive guidance on using the design system
5-
* for consistent, accessible, and maintainable UI development.
6-
*/
1+
/\*\*
2+
3+
- SubTrackr Design System - Complete Documentation
4+
-
5+
- This document provides comprehensive guidance on using the design system
6+
- for consistent, accessible, and maintainable UI development.
7+
\*/
78

89
# SubTrackr Design System Documentation
910

@@ -28,6 +29,7 @@ The SubTrackr Design System provides a comprehensive set of design tokens, compo
2829
The design system uses a semantic color system with three built-in themes:
2930

3031
#### Dark Theme (Default)
32+
3133
- **Primary**: #6366f1 (Indigo)
3234
- **Secondary**: #8b5cf6 (Purple)
3335
- **Accent**: #06b6d4 (Cyan)
@@ -37,9 +39,11 @@ The design system uses a semantic color system with three built-in themes:
3739
- **Info**: #0ea5e9 (Sky)
3840

3941
#### Light Theme
42+
4043
Optimized for daytime use with adjusted saturation and contrast.
4144

4245
#### High Contrast Theme
46+
4347
WCAG AAA compliant with 7:1 minimum contrast ratios for accessibility.
4448

4549
### Spacing
@@ -343,10 +347,10 @@ All components support standard accessibility props:
343347

344348
```typescript
345349
interface AccessibilityProps {
346-
accessibilityLabel: string; // Required - screen reader label
347-
accessibilityHint?: string; // Optional - additional context
348-
accessibilityRole?: string; // Optional - semantic role
349-
testID?: string; // Optional - testing identifier
350+
accessibilityLabel: string; // Required - screen reader label
351+
accessibilityHint?: string; // Optional - additional context
352+
accessibilityRole?: string; // Optional - semantic role
353+
testID?: string; // Optional - testing identifier
350354
}
351355
```
352356

@@ -420,8 +424,8 @@ if (isIOS()) {
420424

421425
// Conditional values
422426
const elevation = getPlatformValue(
423-
4, // iOS shadow
424-
8, // Android elevation
427+
4, // iOS shadow
428+
8, // Android elevation
425429
'0 2px 4px rgba(0,0,0,0.1)' // Web box-shadow
426430
);
427431
```
@@ -493,6 +497,7 @@ npm test src/design-system
493497
```
494498

495499
Tests cover:
500+
496501
- Component rendering
497502
- User interactions
498503
- Accessibility compliance
@@ -506,6 +511,7 @@ npm run e2e:test-android
506511
```
507512

508513
E2E tests verify:
514+
509515
- Visual consistency across platforms
510516
- Theme application
511517
- RTL layout
@@ -531,15 +537,15 @@ const handleChange = (field: string, value: string) => {
531537

532538
const handleSubmit = () => {
533539
const newErrors: Record<string, string> = {};
534-
540+
535541
if (!isValidEmail(formData.email)) {
536542
newErrors.email = 'Invalid email address';
537543
}
538-
544+
539545
if (!isValidAmount(formData.amount)) {
540546
newErrors.amount = 'Amount must be between $1-$1000';
541547
}
542-
548+
543549
if (Object.keys(newErrors).length === 0) {
544550
// Submit form
545551
} else {
@@ -612,6 +618,7 @@ To migrate existing components to use the design system:
612618
## Support
613619

614620
For questions or issues with the design system:
621+
615622
1. Check this documentation
616623
2. Review Storybook examples
617624
3. Check existing tests

src/design-system/__tests__/Button.test.tsx

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@ describe('Button Component', () => {
1313
// ========================================================================
1414

1515
it('should render with label text', () => {
16-
render(
17-
<Button
18-
label="Click Me"
19-
onPress={() => {}}
20-
accessibilityLabel="Click button"
21-
/>
22-
);
16+
render(<Button label="Click Me" onPress={() => {}} accessibilityLabel="Click button" />);
2317

2418
const button = screen.getByText('Click Me');
2519
expect(button).toBeTruthy();
2620
});
2721

2822
it('should render all variants', () => {
29-
const variants = ['primary', 'secondary', 'outline', 'ghost', 'danger', 'success', 'crypto'] as const;
23+
const variants = [
24+
'primary',
25+
'secondary',
26+
'outline',
27+
'ghost',
28+
'danger',
29+
'success',
30+
'crypto',
31+
] as const;
3032

3133
variants.forEach((variant) => {
3234
const { unmount } = render(
@@ -70,13 +72,7 @@ describe('Button Component', () => {
7072
it('should call onPress when tapped', () => {
7173
const mockOnPress = jest.fn();
7274

73-
render(
74-
<Button
75-
label="Press Me"
76-
onPress={mockOnPress}
77-
accessibilityLabel="Press button"
78-
/>
79-
);
75+
render(<Button label="Press Me" onPress={mockOnPress} accessibilityLabel="Press button" />);
8076

8177
const button = screen.getByText('Press Me');
8278
fireEvent.press(button);
@@ -105,13 +101,7 @@ describe('Button Component', () => {
105101
it('should handle async onPress', async () => {
106102
const mockOnPress = jest.fn().mockResolvedValue(undefined);
107103

108-
render(
109-
<Button
110-
label="Async Button"
111-
onPress={mockOnPress}
112-
accessibilityLabel="Async button"
113-
/>
114-
);
104+
render(<Button label="Async Button" onPress={mockOnPress} accessibilityLabel="Async button" />);
115105

116106
const button = screen.getByText('Async Button');
117107
fireEvent.press(button);
@@ -172,12 +162,7 @@ describe('Button Component', () => {
172162

173163
it('should display loading indicator', () => {
174164
render(
175-
<Button
176-
label="Loading"
177-
onPress={() => {}}
178-
loading
179-
accessibilityLabel="Loading button"
180-
/>
165+
<Button label="Loading" onPress={() => {}} loading accessibilityLabel="Loading button" />
181166
);
182167

183168
// The loading indicator should be rendered
@@ -220,9 +205,10 @@ describe('Button Component', () => {
220205
);
221206

222207
const button = getByTestId('full-width-button');
223-
expect(button).toHaveProp('style', expect.arrayContaining([
224-
expect.objectContaining({ width: '100%' }),
225-
]));
208+
expect(button).toHaveProp(
209+
'style',
210+
expect.arrayContaining([expect.objectContaining({ width: '100%' })])
211+
);
226212
});
227213

228214
// ========================================================================
@@ -244,11 +230,7 @@ describe('Button Component', () => {
244230

245231
it('should generate test ID from label', () => {
246232
const { getByTestId } = render(
247-
<Button
248-
label="Auto Test ID"
249-
onPress={() => {}}
250-
accessibilityLabel="Auto ID button"
251-
/>
233+
<Button label="Auto Test ID" onPress={() => {}} accessibilityLabel="Auto ID button" />
252234
);
253235

254236
expect(getByTestId('button-auto-test-id')).toBeTruthy();

src/design-system/__tests__/visualRegression.e2e.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
/**
22
* Design System - Visual Regression Tests
3-
*
3+
*
44
* Uses Detox for E2E visual regression testing on iOS and Android
55
* Complements Jest unit tests with visual snapshots
66
*/
77

8-
import {
9-
element,
10-
by,
11-
expect as detoxExpect,
12-
waitFor,
13-
} from 'detox';
8+
import { element, by, expect as detoxExpect, waitFor } from 'detox';
149

1510
/**
1611
* Button Visual Regression Tests

src/design-system/components/Button.tsx

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ import {
1616
} from 'react-native';
1717
import type { ViewStyle, TextStyle } from 'react-native';
1818

19-
import {
20-
spacing,
21-
borderRadius,
22-
typography,
23-
shadows,
24-
animation,
25-
} from '../tokens';
19+
import { spacing, borderRadius, typography, shadows, animation } from '../tokens';
2620
import type { AccessibilityProps, ComponentSize } from '../types/design-tokens';
2721

2822
// ============================================================================
@@ -335,9 +329,7 @@ export const Button = React.forwardRef<TouchableOpacity, ButtonProps>(
335329
? themeColors.disabledBackground
336330
: themeColors.background,
337331
borderWidth: variant === 'outline' ? 1 : 0,
338-
borderColor: isDisabledOrLoading
339-
? themeColors.disabledBorder
340-
: themeColors.border,
332+
borderColor: isDisabledOrLoading ? themeColors.disabledBorder : themeColors.border,
341333
};
342334

343335
// Build text style
@@ -369,33 +361,21 @@ export const Button = React.forwardRef<TouchableOpacity, ButtonProps>(
369361
disabled={isDisabledOrLoading}
370362
activeOpacity={0.7}
371363
accessibilityLabel={accessibilityLabel || label}
372-
accessibilityHint={
373-
accessibilityHint || (disabled ? 'Button is disabled' : undefined)
374-
}
364+
accessibilityHint={accessibilityHint || (disabled ? 'Button is disabled' : undefined)}
375365
accessibilityRole={accessibilityRole}
376366
accessibilityState={{
377367
disabled: isDisabledOrLoading,
378368
}}
379-
testID={testID}
380-
>
369+
testID={testID}>
381370
{loading && (
382-
<ActivityIndicator
383-
size="small"
384-
color={buttonTextStyle.color}
385-
style={styles.spinner}
386-
/>
371+
<ActivityIndicator size="small" color={buttonTextStyle.color} style={styles.spinner} />
387372
)}
388373
{leftIcon && !loading && <View style={styles.withLeftIcon}>{leftIcon}</View>}
389374

390375
<Text
391-
style={[
392-
textSizeStyle,
393-
buttonTextStyle,
394-
textStyle,
395-
]}
376+
style={[textSizeStyle, buttonTextStyle, textStyle]}
396377
allowFontScaling
397-
maxFontSizeMultiplier={1.2}
398-
>
378+
maxFontSizeMultiplier={1.2}>
399379
{label}
400380
</Text>
401381

src/design-system/components/Card.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,9 @@ export const Card = React.forwardRef<View, CardProps>(
151151

152152
// Variant-specific styles
153153
const variantStyle: ViewStyle = {
154-
backgroundColor:
155-
variant === 'filled' ? theme.colors.surfaceVariant : theme.colors.surface,
154+
backgroundColor: variant === 'filled' ? theme.colors.surfaceVariant : theme.colors.surface,
156155
borderColor:
157-
variant === 'outlined' || variant === 'default'
158-
? theme.colors.border
159-
: undefined,
156+
variant === 'outlined' || variant === 'default' ? theme.colors.border : undefined,
160157
};
161158

162159
// Padding size
@@ -194,21 +191,13 @@ export const Card = React.forwardRef<View, CardProps>(
194191
return (
195192
<View
196193
ref={ref}
197-
style={[
198-
styles.card,
199-
getVariantStyles(),
200-
paddingStyle,
201-
variantStyle,
202-
platformStyles,
203-
style,
204-
]}
194+
style={[styles.card, getVariantStyles(), paddingStyle, variantStyle, platformStyles, style]}
205195
onTouchEnd={onPress}
206196
accessible={!!accessibilityLabel || !!onPress}
207197
accessibilityLabel={accessibilityLabel}
208198
accessibilityRole={accessibilityRole || 'none'}
209199
accessibilityHint={onPress ? 'Double tap to activate' : undefined}
210-
testID={testID}
211-
>
200+
testID={testID}>
212201
{children}
213202
</View>
214203
);

src/design-system/components/Input.tsx

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55
*/
66

77
import React from 'react';
8-
import {
9-
StyleSheet,
10-
View,
11-
TextInput as RNTextInput,
12-
Text,
13-
Platform,
14-
} from 'react-native';
8+
import { StyleSheet, View, TextInput as RNTextInput, Text, Platform } from 'react-native';
159
import type { ViewStyle, TextStyle, TextInputProps as RNTextInputProps } from 'react-native';
1610

1711
import { spacing, borderRadius, typography } from '../tokens';
@@ -24,8 +18,7 @@ import type { AccessibilityProps } from '../types/design-tokens';
2418
export type InputVariant = 'default' | 'outline' | 'filled';
2519

2620
export interface InputProps
27-
extends Omit<RNTextInputProps, 'onChangeText' | 'onFocus' | 'onBlur'>,
28-
AccessibilityProps {
21+
extends Omit<RNTextInputProps, 'onChangeText' | 'onFocus' | 'onBlur'>, AccessibilityProps {
2922
/**
3023
* Input label text
3124
*/
@@ -278,10 +271,7 @@ export const Input = React.forwardRef<RNTextInput, InputProps>(
278271
<View style={[styles.container, containerStyle]}>
279272
{label && (
280273
<View style={styles.labelRow}>
281-
<Text
282-
style={[styles.label, labelStyle]}
283-
nativeID={`${inputId}-label`}
284-
>
274+
<Text style={[styles.label, labelStyle]} nativeID={`${inputId}-label`}>
285275
{label}
286276
</Text>
287277
{required && <Text style={styles.required}>*</Text>}
@@ -295,8 +285,7 @@ export const Input = React.forwardRef<RNTextInput, InputProps>(
295285
variant === 'filled' && styles.inputContainerFilled,
296286
isFocused && styles.inputContainerFocused,
297287
inputContainerStyle,
298-
]}
299-
>
288+
]}>
300289
{leftIcon && <View style={styles.iconContainer}>{leftIcon}</View>}
301290

302291
<RNTextInput
@@ -311,10 +300,7 @@ export const Input = React.forwardRef<RNTextInput, InputProps>(
311300
editable={!disabled}
312301
selectTextOnFocus={!disabled}
313302
accessibilityLabel={accessibilityLabel || label}
314-
accessibilityHint={
315-
accessibilityHint ||
316-
(error ? `Error: ${error}` : helperText)
317-
}
303+
accessibilityHint={accessibilityHint || (error ? `Error: ${error}` : helperText)}
318304
accessibilityRole={accessibilityRole}
319305
accessibilityState={{
320306
disabled,
@@ -333,8 +319,7 @@ export const Input = React.forwardRef<RNTextInput, InputProps>(
333319
<Text
334320
style={[styles.errorText, helperStyle]}
335321
accessibilityLiveRegion="polite"
336-
accessibilityRole="alert"
337-
>
322+
accessibilityRole="alert">
338323
{error || helperText}
339324
</Text>
340325
)}

0 commit comments

Comments
 (0)