Cursor rule
.cursor/rules/admin-interface-patterns.mdcAdmin interface development patterns and conventions for POS System
Cursor rules
Quality
62/100
Scores the file, not the repository.Length
569 words
16 headings · 6 code blocksRepository
118
— · pushed 339 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Admin Interface Development Patterns78## Admin Layout Structure910### Component Organization11Admin components should follow this structure:12- `AdminLayout.tsx` - Main admin wrapper with sidebar navigation13- `Admin[Section].tsx` - Individual admin section components14- Navigation integrated within single sidebar (no duplicate headers)1516### Navigation Pattern17```typescript18// AdminLayout.tsx navigation structure19const adminSections = [20 { id: 'dashboard', label: 'Dashboard', icon: <LayoutDashboard /> },21 { id: 'pos', label: 'General POS', icon: <Store /> },22 { id: 'server', label: 'Server Interface', icon: <Users /> },23 { id: 'counter', label: 'Counter/Checkout', icon: <CreditCard /> },24 { id: 'kitchen', label: 'Kitchen Display', icon: <ChefHat /> },25 { id: 'settings', label: 'Settings', icon: <Settings /> },26 { id: 'staff', label: 'Manage Staff', icon: <UserCog /> },27 { id: 'menu', label: 'Manage Menu', icon: <Menu /> },28 { id: 'reports', label: 'View Reports', icon: <BarChart3 /> }29]30```3132### Sidebar Layout Best Practices33- **Single Navigation Source**: All navigation within sidebar, no duplicate top headers34- **Collapsible Design**: Support both expanded (w-64) and collapsed (w-16) states35- **User Info Integration**: User card and logout within navigation flow, not separate bottom section36- **Flexible Layout**: Use flexbox with spacer to push user info and logout to bottom37- **Consistent Styling**: Same button styles for all navigation items3839### User Authentication Integration40```typescript41// User info within navigation42{!sidebarCollapsed && (43 <div className="p-3 bg-muted/30 rounded-lg">44 <div className="flex items-center gap-3">45 <div className="w-8 h-8 bg-primary rounded-full flex items-center justify-center">46 <User className="w-4 h-4 text-primary-foreground" />47 </div>48 <div className="flex-1 min-w-0">49 <p className="text-sm font-medium truncate">{user.first_name} {user.last_name}</p>50 <p className="text-xs text-muted-foreground truncate">{user.email}</p>51 </div>52 <Badge variant="outline">{user.role.toUpperCase()}</Badge>53 </div>54 </div>55)}5657// Logout as navigation item58<Button59 variant="ghost"60 onClick={handleLogout}61 className="w-full justify-start text-destructive hover:text-destructive hover:bg-destructive/10"62>63 <LogOut className="w-5 h-5" />64 {!sidebarCollapsed && <span className="ml-3">Logout</span>}65</Button>66```6768## Interface Switching Pattern6970Admin users should be able to access all role interfaces:71```typescript72const renderCurrentSection = () => {73 switch (currentSection) {74 case 'dashboard': return <AdminDashboard />75 case 'pos': return <POSLayout user={user} />76 case 'server': return <ServerInterface />77 case 'counter': return <CounterInterface />78 case 'kitchen': return <KitchenLayout user={user} />79 // ... other sections80 }81}82```8384## API Integration Patterns8586### User Management87```typescript88// Admin-only endpoints89async getUsers(): Promise<APIResponse<User[]>> {90 return this.request({ method: 'GET', url: '/admin/users' });91}9293async createUser(userData: CreateUserRequest): Promise<APIResponse<User>> {94 return this.request({ method: 'POST', url: '/admin/users', data: userData });95}96```9798### Form Handling99```typescript100// Consistent form patterns for admin sections101const [showCreateForm, setShowCreateForm] = useState(false)102const [formData, setFormData] = useState<FormType>(initialValues)103104const handleSubmit = (e: React.FormEvent) => {105 e.preventDefault()106 if (validateForm()) {107 mutation.mutate(formData)108 }109}110```111112## Styling Conventions113114### Responsive Layout115- `min-h-screen bg-background flex` for full-height layout116- `flex flex-col` for sidebar with proper spacing117- `flex-1 overflow-auto` for main content area118119### Color Scheme120- Primary actions: `bg-primary text-primary-foreground`121- Destructive actions: `text-destructive hover:bg-destructive/10`122- Muted backgrounds: `bg-muted/30` for subtle highlights123124### Icon Consistency125- Navigation icons: `w-5 h-5` in expanded state126- User avatars: `w-8 h-8` for main display, `w-6 h-6` for collapsed127- Action buttons: `w-4 h-4` for standard buttons128129## Error Handling130131Always provide user feedback:132```typescript133onSuccess: () => {134 queryClient.invalidateQueries({ queryKey: ['users'] })135 alert('User created successfully!')136},137onError: (error: any) => {138 alert(`Failed to create user: ${error.message}`)139}140```141142## Performance Considerations143144- Use React Query for all API calls with proper cache invalidation145- Implement loading states for better UX146- Lazy load admin sections when possible147- Optimize re-renders with proper dependency arrays
Also in madebyaris/poinf-of-sales
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| madebyaris/poinf-of-sales.cursor/rules/api-patterns.mdc · 118 | Cursor rules | lint-formatstylesecuritydatabase+3 | 62/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/authentication-and-security-patterns.mdc · 118 | Cursor rules | setupteststylesecurity+4 | 81/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/backend-golang.mdc · 118 | Cursor rules | testlint-formatstylearch+5 | 69/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/business-logic-patterns.mdc · 118 | Cursor rules | teststyledatabaseperformance+1 | 50/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/database-patterns.mdc · 118 | Cursor rules | stylearchtypessecurity+2 | 62/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/development-workflow.mdc · 118 | Cursor rules | setupbuildteststyle+3 | 86/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/docker-deployment.mdc · 118 | Cursor rules | setupbuildteststyle+8 | 77/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/frontend-react.mdc · 118 | Cursor rules | buildtestlint-formatstyle+4 | 69/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/makefile-scripting.mdc · 118 | Cursor rules | setuplint-formatstylearch+2 | 81/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/performance-optimization-patterns.mdc · 118 | Cursor rules | buildteststyledatabase+3 | 66/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/project-architecture.mdc · 118 | Cursor rules | setupteststylearch+6 | 78/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/react-native-mobile-patterns.mdc · 118 | Cursor rules | buildstylearchui+2 | 74/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/role-based-access-patterns.mdc · 118 | Cursor rules | styletypessecuritydatabase+2 | 58/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/tech-debt-prevention.mdc · 118 | Cursor rules | styletesting-strategyui | 50/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/testing-patterns.mdc · 118 | Cursor rules | setupteststylearch+4 | 74/100 | 3 days ago | |
| madebyaris/poinf-of-sales.cursor/rules/user-journey-optimization.mdc · 118 | Cursor rules | styleperformanceagent-behaviour | 50/100 | 3 days ago |
Diff against .cursor/rules/api-patterns.mdc Diff against .cursor/rules/authentication-and-security-patterns.mdc Diff against .cursor/rules/backend-golang.mdc Diff against .cursor/rules/business-logic-patterns.mdc Diff against .cursor/rules/database-patterns.mdc Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/docker-deployment.mdc Diff against .cursor/rules/frontend-react.mdc Diff against .cursor/rules/makefile-scripting.mdc Diff against .cursor/rules/performance-optimization-patterns.mdc Diff against .cursor/rules/project-architecture.mdc Diff against .cursor/rules/react-native-mobile-patterns.mdc Diff against .cursor/rules/role-based-access-patterns.mdc Diff against .cursor/rules/tech-debt-prevention.mdc Diff against .cursor/rules/testing-patterns.mdc Diff against .cursor/rules/user-journey-optimization.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
