Skip to content

Commit 38b5c56

Browse files
authored
Merge branch 'main' into add-claude-github-actions-1754887785091
2 parents 84c8767 + d25cf9d commit 38b5c56

27 files changed

+1781
-362
lines changed

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"Bash(npm run build:*)",
1111
"Bash(npx vite build:*)",
1212
"Bash(npx vite:*)",
13-
"Bash(npx tsc:*)"
13+
"Bash(npx tsc:*)",
14+
"Bash(gh pr view:*)",
15+
"Bash(gh api:*)"
1416
],
1517
"deny": []
1618
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Describe the bug
10+
<!-- A clear and concise description of what the bug is -->
11+
12+
## To Reproduce
13+
Steps to reproduce the behavior:
14+
1. Go to '...'
15+
2. Enter dimensions '...'
16+
3. Select printer '...'
17+
4. Click on '...'
18+
5. See error
19+
20+
## Expected behavior
21+
<!-- A clear and concise description of what you expected to happen -->
22+
23+
## Actual behavior
24+
<!-- What actually happened instead -->
25+
26+
## Screenshots
27+
<!-- If applicable, add screenshots to help explain your problem -->
28+
29+
## Configuration
30+
<!-- Please provide the following information -->
31+
- Drawer dimensions: [e.g., 22.5" x 16.5" x 3"]
32+
- Unit system: [inches/millimeters]
33+
- Printer selected: [e.g., Prusa MK3S+, Custom]
34+
- Custom printer dimensions (if applicable): [e.g., 250mm x 210mm x 210mm]
35+
- Half-size bins enabled: [yes/no]
36+
- Number of drawers: [e.g., 1]
37+
38+
## Browser Information
39+
<!-- Please complete the following information -->
40+
- Browser: [e.g., Chrome, Firefox, Safari]
41+
- Version: [e.g., 120.0]
42+
- Operating System: [e.g., Windows 11, macOS 14, Ubuntu 22.04]
43+
44+
## Console Errors
45+
<!-- If there are any errors in the browser console, please paste them here -->
46+
```
47+
Paste any console errors here
48+
```
49+
50+
## Additional context
51+
<!-- Add any other context about the problem here -->

.github/pull_request_template.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Description
2+
<!-- Provide a brief description of the changes in this PR -->
3+
4+
## Type of Change
5+
<!-- Mark the relevant option with an "x" -->
6+
- [ ] Bug fix (non-breaking change which fixes an issue)
7+
- [ ] New feature (non-breaking change which adds functionality)
8+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
9+
- [ ] Documentation update
10+
- [ ] Performance improvement
11+
- [ ] Code refactoring
12+
13+
## Related Issue
14+
<!-- Link to the issue this PR addresses, if applicable -->
15+
Fixes #(issue number)
16+
17+
## Changes Made
18+
<!-- List the specific changes made in this PR -->
19+
-
20+
-
21+
-
22+
23+
## Testing
24+
<!-- Describe the tests you ran to verify your changes -->
25+
- [ ] All existing tests pass
26+
- [ ] Added new tests for new functionality
27+
- [ ] Tested manually in browser
28+
- [ ] Tested with different drawer dimensions
29+
- [ ] Tested with custom printer settings
30+
- [ ] Tested with half-size bins enabled/disabled
31+
32+
## Screenshots
33+
<!-- If applicable, add screenshots to help explain your changes -->
34+
35+
## Checklist
36+
<!-- Mark completed items with an "x" -->
37+
- [ ] My code follows the project's code style guidelines
38+
- [ ] I have performed a self-review of my code
39+
- [ ] I have commented my code, particularly in hard-to-understand areas
40+
- [ ] I have made corresponding changes to the documentation
41+
- [ ] My changes generate no new warnings
42+
- [ ] I have added tests that prove my fix is effective or that my feature works
43+
- [ ] New and existing unit tests pass locally with my changes
44+
- [ ] I have used `unitMath` service for all calculations (no native JS math operations)
45+
- [ ] I have used `@/` import paths consistently

.github/workflows/deploy.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/sast.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
--severity=ERROR \
3535
--severity=WARNING \
3636
--severity=INFO \
37+
--exclude=dist \
38+
--exclude=node_modules \
39+
--exclude=coverage \
3740
.
3841
continue-on-error: true
3942

@@ -46,6 +49,9 @@ jobs:
4649
--severity=ERROR \
4750
--severity=WARNING \
4851
--severity=INFO \
52+
--exclude=dist \
53+
--exclude=node_modules \
54+
--exclude=coverage \
4955
.
5056
continue-on-error: true
5157

.semgrepignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Semgrep ignore file
2+
# https://semgrep.dev/docs/ignoring-files-folders-code/
3+
4+
# Build artifacts
5+
dist/
6+
build/
7+
*.min.js
8+
*.bundle.js
9+
10+
# Dependencies
11+
node_modules/
12+
vendor/
13+
14+
# Test coverage
15+
coverage/
16+
.nyc_output/
17+
18+
# IDE and editor files
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
24+
# Temporary files
25+
tmp/
26+
temp/
27+
*.tmp
28+
29+
# Generated files
30+
*.generated.*
31+
*-vendor-*.js
32+
33+
# Package lock files (usually scanned separately)
34+
package-lock.json
35+
yarn.lock
36+
pnpm-lock.yaml
37+
bun.lockb

CLAUDE.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
Gridfinity Space Optimizer is a React-based web application for calculating optimal Gridfinity storage system layouts. It helps users determine the best configuration of Gridfinity bins to fit their drawer dimensions and 3D printer build volumes.
88

9-
## Recent Major Changes (Updated: Current Session)
9+
## Recent Major Changes (Updated: August 2025)
1010

1111
### ✅ MathJS Integration for Precision
1212
- **CRITICAL**: All calculations now use `unitMath` service (`src/services/unitMath.ts`) for BigNumber precision
@@ -29,7 +29,7 @@ Gridfinity Space Optimizer is a React-based web application for calculating opti
2929
- ✅ All test files migrated to TypeScript
3030
- ✅ Type definitions created for all core data structures
3131
- ✅ ESLint configured for TypeScript support
32-
- ✅ All 168 tests passing
32+
- ✅ All 187 tests passing
3333
- All console.log statements removed from production code
3434
- Import paths standardized to use `@/` alias consistently
3535
- ESLint configuration supports both TypeScript and JavaScript
@@ -67,7 +67,7 @@ npm run preview
6767
- **React Router** - Single-page routing
6868
- **Tailwind CSS** - Utility-first styling
6969
- **Shadcn/ui** - Component library built on Radix UI primitives
70-
- **React Query** - Server state management
70+
- **React Query** - Server state management (installed but not actively used)
7171
- **MathJS** - Arbitrary precision arithmetic
7272

7373
### Application Structure
@@ -94,6 +94,7 @@ The app follows a standard React SPA pattern with component-based architecture:
9494
- `PrinterSettings.tsx` - 3D printer selection with predefined build volumes
9595
- `BinOptions.tsx` - Toggle for half-size bin preferences
9696
- `DrawerOptions.tsx` - Number of identical drawers
97+
- `CustomPrinterDialog.tsx` - Dialog for entering custom printer dimensions
9798

9899
3. **Results Display**
99100
- `GridfinityResults.tsx` - Shows calculated bin quantities
@@ -138,7 +139,7 @@ Uses Shadcn/ui components (`src/components/ui/`) - pre-built accessible componen
138139
- **Testing**: Vitest test framework with React Testing Library
139140
- Run tests: `npm test`
140141
- Update snapshots: `npx vitest --run -u`
141-
- 168 tests currently passing
142+
- 187 tests currently passing
142143
- ESLint configured for TypeScript/TSX and JavaScript/JSX with max warnings set to 0
143144
- Development server runs on port 8080 (configured in vite.config.js)
144145
- Uses Vite's hot module replacement for rapid development
@@ -155,14 +156,15 @@ Uses Shadcn/ui components (`src/components/ui/`) - pre-built accessible componen
155156
- `usePersistedState` - Generic hook for localStorage persistence
156157
- `useLegacyMigration` - Handles migration from old localStorage format
157158
- `useCustomPrinter` - Manages custom printer dimensions
159+
- `use-toast` - Toast notification system
158160

159161
## Current Refactor Status
160162

161163
See `REFACTOR_PLAN.md` for details:
162164
- ✅ Phase 1: Clean Up & Stabilize - COMPLETED
163165
- ✅ Phase 2: State Management - COMPLETED
164166
- ✅ Phase 3: Feature Enhancements - COMPLETED
165-
- ⏸️ Phase 4: Architecture with TypeScript - IN PROGRESS
167+
- Phase 4: Architecture with TypeScript - COMPLETED
166168
- ❌ Phase 5-6: Not started yet
167169

168170
See `docs/REFACTOR_PLAN_MATHJS.md` for MathJS integration:
@@ -215,4 +217,10 @@ import { something } from '@/lib/utils';
215217

216218
1. **Memory issues during tests**: Tests sometimes run out of memory due to large calculations
217219
2. **Snapshot tests**: Will fail when precision calculations change - update with `npx vitest --run -u`
218-
3. **localStorage migration**: Legacy settings are migrated on first load - don't break this!
220+
3. **localStorage migration**: Legacy settings are migrated on first load - don't break this!
221+
- Always add tests for new features or changes to the algorithms
222+
223+
## GitHub Templates
224+
225+
- **Pull Request Template**: `.github/pull_request_template.md` - Standardized PR checklist
226+
- **Bug Report Template**: `.github/ISSUE_TEMPLATE/bug_report.md` - Structured bug reporting format

src/components/GridfinityCalculator.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ describe('GridfinityCalculator', () => {
7676
await userEvent.clear(widthInput);
7777
await userEvent.type(widthInput, '20');
7878

79+
// Trigger blur to save the value
80+
await userEvent.tab();
81+
7982
await waitFor(() => {
8083
expect(vi.mocked(saveUserSettings).mock.calls.length).toBeGreaterThan(initialCallCount);
8184
});
@@ -187,6 +190,9 @@ describe('GridfinityCalculator', () => {
187190
await userEvent.clear(heightInput);
188191
await userEvent.type(heightInput, '25');
189192

193+
// Trigger blur to save the value
194+
await userEvent.tab();
195+
190196
await waitFor(() => {
191197
expect(vi.mocked(saveUserSettings).mock.calls.length).toBeGreaterThan(initialSaveCount);
192198
const lastCall = vi.mocked(saveUserSettings).mock.calls[vi.mocked(saveUserSettings).mock.calls.length - 1][0];

src/components/GridfinityCalculator.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const GridfinityCalculator: React.FC = () => {
2525
customPrinterSize: settings.customPrinterSize,
2626
useHalfSize: settings.useHalfSize,
2727
preferHalfSize: settings.preferHalfSize,
28+
preferUniformBaseplates: settings.preferUniformBaseplates,
2829
numDrawers: settings.numDrawers,
2930
});
3031

@@ -102,6 +103,8 @@ const GridfinityCalculator: React.FC = () => {
102103
setUseHalfSize={settings.setUseHalfSize}
103104
preferHalfSize={settings.preferHalfSize}
104105
setPreferHalfSize={settings.setPreferHalfSize}
106+
preferUniformBaseplates={settings.preferUniformBaseplates}
107+
setPreferUniformBaseplates={settings.setPreferUniformBaseplates}
105108
/>
106109
</CardContent>
107110
</Card>

src/components/GridfinityCalculator/BinOptions.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const BinOptions = ({
77
setUseHalfSize,
88
preferHalfSize,
99
setPreferHalfSize,
10+
preferUniformBaseplates,
11+
setPreferUniformBaseplates,
1012
}) => {
1113
return (
1214
<div className="space-y-6 p-4">
@@ -38,6 +40,16 @@ const BinOptions = ({
3840
}}
3941
/>
4042
</div>
43+
<div className="flex items-center justify-between">
44+
<Label htmlFor="prefer-uniform-baseplates" className="flex-1">
45+
Prefer uniform baseplate sizes
46+
</Label>
47+
<Switch
48+
id="prefer-uniform-baseplates"
49+
checked={preferUniformBaseplates}
50+
onCheckedChange={setPreferUniformBaseplates}
51+
/>
52+
</div>
4153
</div>
4254
</div>
4355
);

0 commit comments

Comments
 (0)