Skip to content

Commit 99cd3e6

Browse files
authored
Merge pull request #193 from apsinghdev/perf/oss-sheet
UI enforce design consistency
2 parents 58e50c7 + d4f09db commit 99cd3e6

File tree

34 files changed

+1699
-280
lines changed

34 files changed

+1699
-280
lines changed

.cursorrules

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Opensox AI - Cursor Rules
2+
3+
## Code Style
4+
5+
### Comments
6+
- always use lowercase when writing comments
7+
- avoid unnecessary comments; code should be self-documenting when possible
8+
- use comments to explain "why", not "what"
9+
10+
## UI Component Guidelines
11+
12+
### Design System - CRITICAL
13+
**Always follow the design system defined in `apps/web/src/lib/design-tokens.ts` and `apps/web/tailwind.config.ts`**
14+
15+
#### Color Usage
16+
- **NEVER** use hardcoded hex values (e.g., `#5519f7`) directly in components
17+
- **ALWAYS** reference colors from the design token system using Tailwind classes
18+
- Use semantic color names that describe purpose, not appearance
19+
20+
#### Available Color Palettes
21+
22+
**Brand Colors:**
23+
- `bg-brand-purple` - primary brand color for ctas, highlights
24+
- `bg-brand-purple-light` - hover states
25+
- `bg-brand-purple-dark` - depth and contrast
26+
27+
**Background/Surface Colors (Landing Page):**
28+
- `bg-surface-primary` - main app background (#101010)
29+
- `bg-surface-secondary` - sidebar, secondary surfaces (#141414)
30+
- `bg-surface-tertiary` - content areas, cards (#1A1A1A)
31+
- `bg-surface-elevated` - elevated cards, modals (#1E1E1E)
32+
- `bg-surface-hover` - hover states for dark surfaces
33+
- `bg-surface-card` - card backgrounds
34+
35+
**Background/Surface Colors (Dashboard):**
36+
- `bg-dash-base` - page background (darkest)
37+
- `bg-dash-surface` - panels, cards, navbars
38+
- `bg-dash-raised` - buttons, inputs, interactive surfaces
39+
- `bg-dash-hover` - hover states for raised items
40+
- `bg-dash-border` - thin dividers, borders
41+
42+
**Border Colors:**
43+
- `border` or `border-border` - primary border (#252525)
44+
- `border-light` - lighter borders for nested elements
45+
- `border-dark` - darker borders
46+
- `border-focus` - focus states (brand purple)
47+
48+
**Text Colors:**
49+
- `text-text-primary` - primary white text (#ffffff)
50+
- `text-text-secondary` - secondary text (#e1e1e1)
51+
- `text-text-tertiary` - tertiary/muted text (#d1d1d1)
52+
- `text-text-muted` - very muted text (#a1a1a1)
53+
- `text-text-light` - light gray for copyright/footer
54+
55+
**Link Colors:**
56+
- `text-link` - default link color (blue-400)
57+
- `text-link-hover` - hover state (blue-300)
58+
59+
**Status Colors:**
60+
- Success: `bg-success-bg`, `text-success-text`, `border-success-border`
61+
- Error: `bg-error-bg`, `text-error-text`, `border-error-border`
62+
- Warning: `bg-warning-bg`, `text-warning-text`, `border-warning-border`
63+
- Info: `bg-info-bg`, `text-info-text`, `border-info-border`
64+
65+
#### Typography
66+
- Use `font-sans` for standard UI text (Geist Sans)
67+
- Use `font-mono` for code, technical content, or monospace needs (DM Mono)
68+
69+
#### Spacing
70+
- Follow Tailwind's spacing scale (0.25rem increments)
71+
- For section padding:
72+
- Mobile: `p-4` (1rem)
73+
- Desktop: `p-[60px]`
74+
75+
#### Border Radius
76+
- Small elements: `rounded-lg` (0.5rem)
77+
- Medium elements: `rounded-xl` (1rem)
78+
- Large elements: `rounded-2xl` (1.5rem)
79+
- Buttons: `rounded-[16px]`
80+
81+
#### Animations
82+
- Fast transitions: `duration-100` (0.1s)
83+
- Normal transitions: `duration-300` (0.3s)
84+
- Slow transitions: `duration-600` (0.6s)
85+
- Available custom animations:
86+
- `animate-accordion-down`, `animate-accordion-up`
87+
- `animate-scrollRight`, `animate-scrollLeft`
88+
- `animate-customspin`, `animate-spin-slow`, `animate-spin-slow-reverse`
89+
- `animate-marquee`, `animate-marquee-vertical`
90+
- `animate-shine`
91+
92+
### Component Structure
93+
- prefer functional components with typescript
94+
- use proper typescript types, avoid `any`
95+
- extract reusable logic into custom hooks
96+
- keep components focused and single-responsibility
97+
98+
### Props & State
99+
- use descriptive prop names
100+
- define prop types using typescript interfaces or types
101+
- prefer controlled components over uncontrolled
102+
- use zustand for global state (located in `src/store/`)
103+
104+
### Imports
105+
- organize imports: react → third-party → local components → utils → types
106+
- use absolute imports from `@/` prefix when available
107+
- remove unused imports
108+
109+
## File Organization
110+
- place shared components in `apps/web/src/components/`
111+
- place page-specific components near their page
112+
- co-locate tests with the code they test
113+
- keep utility functions in `apps/web/src/lib/` or `apps/web/src/utils/`
114+
115+
## Naming Conventions
116+
- components: PascalCase (e.g., `UserProfile.tsx`)
117+
- files/folders: kebab-case or camelCase for utilities
118+
- constants: UPPER_SNAKE_CASE
119+
- functions/variables: camelCase
120+
- types/interfaces: PascalCase with descriptive names
121+
122+
## Accessibility
123+
- include proper aria labels
124+
- ensure keyboard navigation works
125+
- maintain proper heading hierarchy
126+
- provide alt text for images
127+
128+
## Performance
129+
- use dynamic imports for code splitting when appropriate
130+
- optimize images (use next/image)
131+
- memoize expensive computations
132+
- avoid unnecessary re-renders
133+
134+
## Monorepo Structure
135+
- this is a turborepo monorepo
136+
- shared packages live in `packages/`
137+
- apps live in `apps/` (web, api, backend, docs)
138+
- respect package boundaries
139+
- use workspace dependencies properly
140+

0 commit comments

Comments
 (0)