Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
ad0bc9f
feat: Complete migration from Create React App to Vite
iamtouchskyer May 9, 2025
3dfd81e
Update instructions
iamtouchskyer May 9, 2025
b994563
feat: Transform welcome page to comprehensive learning summary page
iamtouchskyer Jun 24, 2025
6e083c0
feat: Add Schema Editor component to Admin Dashboard
iamtouchskyer Jun 24, 2025
a547f55
refactor: Redesign header navigation with cleaner settings menu
iamtouchskyer Jun 24, 2025
5e04b80
refactor: Redesign personal settings page with modern UI
iamtouchskyer Jun 24, 2025
37adb58
feat: Add i18n translations for settings and debug menus
iamtouchskyer Jun 24, 2025
1f409d8
fix: Add missing debug routes to fix 404 errors
iamtouchskyer Jun 24, 2025
cafddfe
Restructure exam navigation into three separate menu items
iamtouchskyer Jun 24, 2025
a96d138
feat: reorganize exam menu structure into three categories
iamtouchskyer Jun 26, 2025
a5f5b32
fix: enable submenu display in ProLayout for exam categories
iamtouchskyer Jun 26, 2025
8070267
feat: reorder exam menu items - Past Papers first
iamtouchskyer Jun 26, 2025
584912c
debug: add logging to diagnose competition name display issue
iamtouchskyer Jun 26, 2025
dfb31b5
fix: update PastPapersPage to use correct API endpoints
iamtouchskyer Jun 26, 2025
cf9a4f3
feat: complete Phase 1 test infrastructure setup
iamtouchskyer Jun 26, 2025
e6f29e0
feat: complete Phase 2 test enablement with significant coverage incr…
iamtouchskyer Jun 26, 2025
8b07d94
feat: optimize frontend to reduce API requests and prevent server ove…
iamtouchskyer Jun 26, 2025
104533b
feat: Phase 3 - Continue test enablement progress
iamtouchskyer Jun 26, 2025
df45ed4
fix: improve competition name display in Past Papers page
iamtouchskyer Jun 26, 2025
7d862f6
feat: enable API integration and schema validation tests
iamtouchskyer Jun 26, 2025
99a5830
fix: resolve LaTeX rendering issues and improve test infrastructure
iamtouchskyer Jun 26, 2025
c44a746
Add test authentication page for development
iamtouchskyer Jun 28, 2025
1f03555
feat: implement state management performance optimizations
iamtouchskyer Jun 29, 2025
7344309
fix: resolve all failing unit tests
iamtouchskyer Jul 2, 2025
e445388
fix: resolve React act() warning in FormulaUtils test
iamtouchskyer Jul 2, 2025
8aca71f
test: suppress expected console.error outputs in apiIntegration tests
iamtouchskyer Jul 2, 2025
0db88f7
test: add comprehensive test coverage for API services
iamtouchskyer Jul 2, 2025
69a54a7
fix: suppress AJV strict mode warning for union types
iamtouchskyer Jul 2, 2025
5811e56
chore: update disabled test files with improved structure
iamtouchskyer Jul 2, 2025
d321d27
fix: add Forced Colors Mode support to suppress deprecation warnings
iamtouchskyer Jul 2, 2025
7df5df5
Fix and enable FormulaUtils.test.js
iamtouchskyer Jul 2, 2025
101faf3
Fix and enable SummaryPage.test.jsx
iamtouchskyer Jul 2, 2025
2ff3fd2
Fix and enable KnowledgePointsI18n.test.jsx
iamtouchskyer Jul 2, 2025
c430506
fix: resolve browser compatibility warnings in Vite build
iamtouchskyer Jul 2, 2025
f58e6c3
Fix and enable all disabled test files
iamtouchskyer Jul 2, 2025
6dcbfe3
feat: implement unified header design across application
iamtouchskyer Jul 2, 2025
6c4fd57
fix: remove unused import in UnifiedHeader test
iamtouchskyer Jul 2, 2025
ea65b59
fix: improve dark mode styles and test stability
iamtouchskyer Jul 2, 2025
f076c67
fix: suppress console errors in SummaryPage tests
iamtouchskyer Jul 2, 2025
cd8097d
feat: Implement comprehensive test coverage for utilities (12% → 79%)
iamtouchskyer Jul 2, 2025
5427d73
refactor: implement clean coverage reporting system
iamtouchskyer Jul 7, 2025
ab07f95
fix: comprehensive test coverage improvements and console error fixes
iamtouchskyer Jul 7, 2025
20fde1c
feat: add exam print functionality with customizable options
iamtouchskyer Jul 7, 2025
01ba3e0
fix: resolve dropdown positioning and admin debug page layout issues
iamtouchskyer Jul 7, 2025
4a1b275
fix: add PrinterOutlined to mocked icons in OnlineExam tests
iamtouchskyer Jul 7, 2025
dadc5f0
refactor: remove console.error statements to reduce noise
iamtouchskyer Jul 7, 2025
60505fd
fix: restore console logging statements to match test expectations
iamtouchskyer Jul 7, 2025
1be717d
fix: update ProblemsPage messages to match test expectations
iamtouchskyer Jul 7, 2025
352d62b
fix: make summary statistic cards square with consistent dimensions
iamtouchskyer Jul 7, 2025
e0f0101
fix: resolve FormContext warning in CompetitionExamSelect component
iamtouchskyer Jul 7, 2025
642b452
feat: add 429 Too Many Requests error page with countdown
iamtouchskyer Jul 7, 2025
7bfb2e7
feat: add error pages test panel to debug section
iamtouchskyer Jul 8, 2025
84488fb
fix: resolve antd v5 warnings for React 19 compatibility and message …
iamtouchskyer Jul 8, 2025
aaf5cea
fix: add i18n support for error pages test menu item
iamtouchskyer Jul 8, 2025
55f856f
refactor: convert all debug features to use drawer panels
iamtouchskyer Jul 8, 2025
ef16cee
refactor: remove mock test functionality from client
iamtouchskyer Jul 8, 2025
8a75c2d
test: enable and fix all skipped unit tests
iamtouchskyer Jul 8, 2025
9aede5e
feat: integrate knowledge read status with server API
iamtouchskyer Jul 8, 2025
c79fbf6
fix: add debugging for knowledge read status toggle
iamtouchskyer Jul 8, 2025
d908cd3
fix: correct property name mismatch in batch status response
iamtouchskyer Jul 8, 2025
6e5f1b9
chore: update @iamtouchskyer/math-project-types to v0.4.1
iamtouchskyer Jul 8, 2025
4ab5df1
fix: add support for new problem data format in ProblemDetailDrawer
iamtouchskyer Jul 8, 2025
d5aa045
feat: unify code coverage reporting with server implementation
iamtouchskyer Jul 8, 2025
5c9e0ee
Fix dashboard statistics display logic and improve UI consistency
iamtouchskyer Jul 8, 2025
cbec96f
Fix dashboard translation and add responsive layout
iamtouchskyer Jul 8, 2025
45e5c77
Fix navigation menu: disable auto-expand and update Chinese translation
iamtouchskyer Jul 8, 2025
6b7322e
feat: add comprehensive caching for high priority API endpoints
iamtouchskyer Jul 8, 2025
3d36767
feat: add caching for medium priority user-related API endpoints
iamtouchskyer Jul 8, 2025
de25b7c
docs: add CONTRIBUTING.md with dev setup and contribution guide
Mar 17, 2026
ba2c2d0
fix: remove .env.development and .env.production, update .gitignore
Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .cursor/rules/mcp-document-query.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description: 使用MCP README服务器获取相关文档
globs:
alwaysApply: false
---
在处理需求前,我将先查询 MCP README 服务获取相关文档内容:

文件路径: {{currentFilePath}}
模块名: {{fileBasename}}

请先阅读以下相关文档,再开始编写代码:
{{fetch('http://localhost:8374/api/find-readmes', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: { filePath: '{{currentFilePath}}', moduleName: '{{fileBasename}}' } })}}
40 changes: 40 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"react-hooks",
"jsx-a11y"
],
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
},
"settings": {
"react": {
"version": "detect"
}
},
"globals": {
"import": "readonly",
"import.meta": "readonly"
}
}
31 changes: 26 additions & 5 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
- Implement card-based interfaces for content display
- Use tabs for organizing different view modes (compact, categorized, detailed)
- Provide toggle features for viewing raw vs rendered content
- Implement consistent view options:
- Implement consistent view options using i18n translations:
```jsx
<TabPane tab={locale === 'zh' ? "紧凑视图" : "Compact View"} key="compact">
<TabPane tab={t('components.viewModes.compact')} key="compact">
```
- Follow established patterns for loading states:
```jsx
{loadingStates[id] ? <Spin size="small" /> : <Content />}
```

## Internationalization
- Use the `useI18n` hook to access the current locale
- Include both Chinese and English text options for all user-facing content
- Format language conditionals as: `locale === 'zh' ? "中文" : "English"`
- Never hard-code string literals in components
- Always place all text strings in the i18n translation files
- Use the `useI18n` hook to access translations
- Group translations by component or feature
- Maintain consistent terminology across languages

Expand All @@ -73,8 +73,29 @@
## Performance Considerations
- Implement virtualization for long lists
- Use pagination for data fetching (limit/offset pattern)
- Implement both client-side and server-side pagination where appropriate
- Memoize expensive calculations or rendering
- Use proper loading states during asynchronous operations
- Optimize re-renders with appropriate dependency arrays
- Batch state updates where possible
- Pre-render content that requires heavy processing (like LaTeX formulas)
- Use React.memo for components that receive the same props frequently
- Lazy load components that aren't needed for initial rendering

## API Communication
- Always use schema validation for API requests and responses
- Look for corresponding schema files in the `schemas/` directory to verify data
- Use try/catch blocks for all API calls with proper error handling
- Implement data caching strategies where appropriate
- Follow established patterns for loading and error states
- Use consistent approach for handling API errors:
```jsx
try {
const response = await apiCall(data);
// Process response
} catch (error) {
handleApiError(error);
}
```
- Validate data against schemas before sending to the server
- Validate responses against schemas after receiving from the server
146 changes: 146 additions & 0 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Test Coverage

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
coverage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage

- name: Generate coverage report
run: npm run test:coverage:report
continue-on-error: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Upload coverage reports
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: |
coverage/
coverage-report.md

- name: Comment PR with coverage
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');

// Read coverage summary
let coverageComment = '## 📊 Test Coverage Report\n\n';

try {
const coverage = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
const total = coverage.total;

coverageComment += '| Metric | Coverage | Details |\n';
coverageComment += '|--------|----------|---------|\\n';
coverageComment += `| Statements | ${total.statements.pct}% | ${total.statements.covered}/${total.statements.total} |\n`;
coverageComment += `| Branches | ${total.branches.pct}% | ${total.branches.covered}/${total.branches.total} |\n`;
coverageComment += `| Functions | ${total.functions.pct}% | ${total.functions.covered}/${total.functions.total} |\n`;
coverageComment += `| Lines | ${total.lines.pct}% | ${total.lines.covered}/${total.lines.total} |\n`;

// Check if coverage meets thresholds
const threshold = 40; // Current threshold
const passed = total.lines.pct >= threshold;

coverageComment += '\n';
coverageComment += passed
? '✅ Coverage threshold met!'
: `❌ Coverage below threshold (${threshold}%)`;

} catch (error) {
coverageComment += '⚠️ Could not read coverage data\n';
}

// Find and update or create comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

const botComment = comments.find(comment =>
comment.user.type === 'Bot' && comment.body.includes('Test Coverage Report')
);

if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: coverageComment
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: coverageComment
});
}

- name: Coverage Badge
if: github.ref == 'refs/heads/main'
run: |
COVERAGE=$(node -p "require('./coverage/coverage-summary.json').total.lines.pct")
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV

- name: Create Badge
if: github.ref == 'refs/heads/main'
uses: schneegans/dynamic-badges-action@v1.6.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: your-gist-id-here
filename: math-project-coverage.json
label: Coverage
message: ${{ env.COVERAGE }}%
color: ${{ env.COVERAGE > 80 && 'brightgreen' || env.COVERAGE > 60 && 'yellow' || 'red' }}

test-matrix:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [16, 18, 20]

steps:
- uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test -- --ci --coverage=false
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@

# testing
/coverage
/coverage-reports
coverage-dashboard.html

# production
/build

# misc
.DS_Store
.env
.env.local
.env.development
.env.development.local
.env.test.local
.env.production
.env.production.local
.env.test.local

npm-debug.log*
yarn-debug.log*
Expand Down
27 changes: 27 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "🧪 Running tests before commit..."

# Run tests
npm test -- --watchAll=false --passWithNoTests --bail

# Check if tests passed
if [ $? -ne 0 ]; then
echo "❌ Tests failed! Please fix the failing tests before committing."
echo "💡 You can run 'npm test' to see the test results in detail."
exit 1
fi

echo "✅ All tests passed!"

# Optional: Run lint-staged for code quality checks
# Uncomment the following lines if you want to enforce linting as well
# echo "🔍 Running code quality checks..."
# npx lint-staged
# if [ $? -ne 0 ]; then
# echo "❌ Code quality checks failed! Please fix the issues before committing."
# exit 1
# fi

echo "✅ Pre-commit checks passed! Proceeding with commit..."
9 changes: 9 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"*.{js,jsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,css,md}": [
"prettier --write"
]
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@iamtouchskyer:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false
}
Loading