Repository navigation
Development Guide
sobhan azimzadeh edited this page Sep 18, 2025
·
1 revision
This guide provides detailed information for developers working on the TECSOQR project.
- Node.js 18+
- npm or yarn
- Git
- VS Code (recommended)
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"formulahendry.auto-rename-tag",
"dsznajder.es7-react-js-snippets",
"christian-kohler.path-intellisense",
"bradlc.vscode-tailwindcss",
"chakrounanas.turbo-console-log"
]
}- Always use TypeScript types:
interface QRCodeCustomization {
foreground?: string;
background?: string;
cornerStyle?: "square" | "rounded" | "dots";
dotStyle?: "square" | "rounded" | "dots";
}- Use proper type exports:
export type QRCodeContent = QRCodeURL | QRCodeText | QRCodeEmail | QRCodePhone;- Functional Components:
interface ComponentProps {
value: QRCodeCustomization;
onChange: (value: QRCodeCustomization) => void;
}
export const Component = ({ value, onChange }: ComponentProps) => {
// Component logic
};- Props Interface Naming:
interface ButtonProps {
label: string;
onClick: () => void;
}src/
├── components/ # React components
│ ├── ComponentName/
│ │ ├── index.ts # Export
│ │ └── ComponentName.tsx
│ └── shared/
├── services/ # Business logic
├── utils/ # Helper functions
└── types/ # Type definitions
- Add type definition in
types/qr-code.ts:
export interface QRCodeNewType extends QRCodeBase {
type: "newtype";
field1: string;
field2?: number;
}- Create form component in
components/qr-forms:
export const NewTypeForm = ({ value, onChange }: FormProps) => {
// Form implementation
};- Add to QR code service in
services/qr-code.service.ts:
private static formatNewType(content: QRCodeNewType): string {
// Format implementation
}- Update customization interface:
interface QRCodeCustomization {
newStyle?: "option1" | "option2";
}- Modify SVG modifier:
const modifySvgStyles = (svg: string, customization?: QRCodeCustomization) => {
// Add new style handling
};describe("QRCodeService", () => {
it("should generate valid QR code", async () => {
// Test implementation
});
});describe("QRPreview", () => {
it("should render preview correctly", () => {
// Test implementation
});
});const LazyComponent = lazy(() => import("./Component"));const MemoizedComponent = memo(({ prop }: Props) => {
// Component logic
});const handleChange = useCallback(
(newValue: string) => {
// Handler logic
},
[dependencies]
);try {
const qrCode = await QRCodeService.generateQRCode(content);
} catch (error) {
console.error("QR generation failed:", error);
// Handle error
}const validate = (input: QRCodeInput): ValidationResult => {
// Validation logic
};Create .env.production:
VITE_APP_URL=https://qrcode.tecso.teamnpm run build- Enable source maps
- Configure cache headers
- Optimize assets
name: Deploy to GitHub Pages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run build- feature/feature-name
- fix/bug-description
- refactor/component-name
feat: add new QR code type
fix: resolve style misalignment
refactor: improve performance
- Create feature branch
- Implement changes
- Add tests
- Submit PR with description
- QR Code Generation Fails
// Check content formatting
console.log("Content:", content);
// Verify SVG generation
console.log("SVG:", svg);- Style Issues
// Debug style application
console.log("Applied styles:", customization);
// Check SVG structure
console.log("Modified SVG:", modifiedSvg);- React Developer Tools
- VS Code Debugger
- Browser DevTools