mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-28 00:08:21 -05:00
* feat(claude): added rules * fix(copilot): chat loading; refactor(copilot): components, utils, hooks * fix(copilot): options selection strikethrough * fix(copilot): options render inside thinking * fix(copilot): checkpoints, user-input; improvement(code): colors * fix(copilot): scrolling, tool-call truncation, thinking ui * fix(copilot): tool call spacing and shimmer/actions on previous messages * improvement(copilot): queue * addressed comments
1000 B
1000 B
paths
| paths | |
|---|---|
|
Component Patterns
Structure Order
'use client' // Only if using hooks
// Imports (external → internal)
// Constants at module level
const CONFIG = { SPACING: 8 } as const
// Props interface
interface ComponentProps {
requiredProp: string
optionalProp?: boolean
}
export function Component({ requiredProp, optionalProp = false }: ComponentProps) {
// a. Refs
// b. External hooks (useParams, useRouter)
// c. Store hooks
// d. Custom hooks
// e. Local state
// f. useMemo
// g. useCallback
// h. useEffect
// i. Return JSX
}
Rules
'use client'only when using React hooks- Always define props interface
- Extract constants with
as const - Semantic HTML (
aside,nav,article) - Optional chain callbacks:
onAction?.(id)
Component Extraction
Extract when: 50+ lines, used in 2+ files, or has own state/logic
Keep inline when: < 10 lines, single use, purely presentational