feat: Complete admin panel implementation
- Add user management system with all CRUD operations - Add promotion statistics dashboard with export - Simplify Trading & Market settings UI - Fix promotion schema (dates now optional) - Add missing API endpoints and PATCH support - Add comprehensive documentation - Fix critical bugs (deletePromotion, duplicate endpoints) All features tested and production-ready.
This commit is contained in:
401
ADMIN_QUICK_START.md
Normal file
401
ADMIN_QUICK_START.md
Normal file
@@ -0,0 +1,401 @@
|
||||
# Admin Panel Quick Start Guide
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
### Access the Admin Panel
|
||||
|
||||
1. Ensure you have admin permissions (staff level 3+)
|
||||
2. Navigate to: `http://localhost:5173/admin`
|
||||
3. Login with your Steam account if not already authenticated
|
||||
|
||||
---
|
||||
|
||||
## 📋 Common Admin Tasks
|
||||
|
||||
### 1. Search and Manage Users
|
||||
|
||||
**To find a user:**
|
||||
```
|
||||
1. Go to Admin Panel > Users tab
|
||||
2. Type username, Steam ID, or email in search box
|
||||
3. Click on user card to view details
|
||||
```
|
||||
|
||||
**To adjust user balance:**
|
||||
```
|
||||
1. Find the user
|
||||
2. Click "Balance" button
|
||||
3. Select "Add" or "Remove"
|
||||
4. Enter amount and reason
|
||||
5. Click "Add/Remove Balance"
|
||||
```
|
||||
|
||||
**To ban a user:**
|
||||
```
|
||||
1. Find the user
|
||||
2. Click "Ban" button
|
||||
3. Select duration (or 0 for permanent)
|
||||
4. Enter ban reason
|
||||
5. Click "Ban User"
|
||||
```
|
||||
|
||||
**To unban a user:**
|
||||
```
|
||||
1. Find the banned user
|
||||
2. Click "Unban" button
|
||||
3. Confirm the action
|
||||
```
|
||||
|
||||
### 2. Enable Maintenance Mode
|
||||
|
||||
**Quick maintenance (no downtime planned):**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Maintenance tab
|
||||
2. Toggle "Enable Maintenance Mode"
|
||||
3. Update the message if needed
|
||||
4. Click "Save Changes"
|
||||
```
|
||||
|
||||
**Scheduled maintenance:**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Maintenance tab
|
||||
2. Toggle "Enable Maintenance Mode"
|
||||
3. Set "Scheduled Start" and "Scheduled End" times
|
||||
4. Add your Steam ID to allowed list (optional)
|
||||
5. Click "Save Changes"
|
||||
```
|
||||
|
||||
### 3. Create Site Announcements
|
||||
|
||||
**To create an announcement:**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Announcements tab
|
||||
2. Click "New Announcement"
|
||||
3. Select type: Info, Warning, Success, or Error
|
||||
4. Write your message
|
||||
5. Set start/end dates (optional)
|
||||
6. Toggle "Enabled" and "Dismissible"
|
||||
7. Click "Create"
|
||||
```
|
||||
|
||||
**Announcement types:**
|
||||
- **Info** (Blue) - General information
|
||||
- **Warning** (Yellow) - Important notices
|
||||
- **Success** (Green) - Positive announcements
|
||||
- **Error** (Red) - Critical alerts
|
||||
|
||||
### 4. Create Promotions
|
||||
|
||||
**Example: Welcome Bonus (10% on first deposit)**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Promotions tab
|
||||
2. Click "New Promotion"
|
||||
3. Fill in:
|
||||
- Name: "Welcome Bonus"
|
||||
- Description: "Get 10% extra on your first deposit!"
|
||||
- Type: "Deposit Bonus"
|
||||
- Start/End dates
|
||||
- Bonus Percentage: 10
|
||||
- Min Deposit: 10.00
|
||||
- Max Bonus: 50.00
|
||||
- Max Uses Per User: 1
|
||||
- New Users Only: ✓
|
||||
- Code: "WELCOME10" (optional)
|
||||
4. Click "Create"
|
||||
```
|
||||
|
||||
**Example: Weekend Sale (20% off all items)**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Promotions tab
|
||||
2. Click "New Promotion"
|
||||
3. Fill in:
|
||||
- Name: "Weekend Sale"
|
||||
- Type: "Discount"
|
||||
- Discount Percentage: 20
|
||||
- Start: Friday 00:00
|
||||
- End: Sunday 23:59
|
||||
- Max Uses Per User: Unlimited
|
||||
4. Click "Create"
|
||||
```
|
||||
|
||||
### 5. Configure Trading Settings
|
||||
|
||||
**To disable deposits temporarily:**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Trading & Market tab
|
||||
2. Scroll to "Trading Settings"
|
||||
3. Toggle off "Enable Deposits"
|
||||
4. Click "Save Trading Settings"
|
||||
```
|
||||
|
||||
**To change withdrawal fee:**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Trading & Market tab
|
||||
2. Find "Withdrawal Fee"
|
||||
3. Enter new value (0.05 = 5%)
|
||||
4. Click "Save Trading Settings"
|
||||
```
|
||||
|
||||
### 6. Manage Market Settings
|
||||
|
||||
**To update market commission:**
|
||||
```
|
||||
1. Go to Admin Panel > Config > Trading & Market tab
|
||||
2. Scroll to "Market Settings"
|
||||
3. Update "Commission" (0.10 = 10%)
|
||||
4. Click "Save Market Settings"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Advanced Tasks
|
||||
|
||||
### Bulk Ban Users
|
||||
|
||||
```javascript
|
||||
// Use the API directly for bulk operations
|
||||
await api.post('/admin/users/bulk-ban', {
|
||||
userIds: ['userId1', 'userId2', 'userId3'],
|
||||
banned: true,
|
||||
reason: 'Violation of ToS',
|
||||
duration: 0 // permanent
|
||||
});
|
||||
```
|
||||
|
||||
### Change User Staff Level
|
||||
|
||||
```
|
||||
1. Search for the user
|
||||
2. Click "View Details"
|
||||
3. Click "Change Staff Level"
|
||||
4. Select new level (0-5)
|
||||
5. Click "Update Level"
|
||||
```
|
||||
|
||||
**Staff Levels:**
|
||||
- 0: Regular User
|
||||
- 1: Support
|
||||
- 2: Moderator
|
||||
- 3: Admin
|
||||
- 4: Senior Admin
|
||||
- 5: Super Admin
|
||||
|
||||
### View Promotion Statistics
|
||||
|
||||
```
|
||||
1. Go to Admin Panel > Config > Promotions tab
|
||||
2. Find the promotion
|
||||
3. Click "Stats" button
|
||||
4. View usage statistics and user list
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Best Practices
|
||||
|
||||
### Balance Adjustments
|
||||
- ✅ Always provide a clear reason
|
||||
- ✅ Document the ticket/issue number if applicable
|
||||
- ✅ Double-check the amount before confirming
|
||||
- ❌ Never adjust balance without proper reason
|
||||
|
||||
### User Bans
|
||||
- ✅ Use temporary bans first (24h, 7 days)
|
||||
- ✅ Provide specific reason for the ban
|
||||
- ✅ Keep evidence/logs of violations
|
||||
- ✅ Review appeals within 24 hours
|
||||
- ❌ Don't ban without investigation
|
||||
|
||||
### Maintenance Mode
|
||||
- ✅ Announce maintenance in advance
|
||||
- ✅ Schedule during low-traffic hours
|
||||
- ✅ Add your Steam ID to whitelist for testing
|
||||
- ✅ Keep maintenance windows short (< 4 hours)
|
||||
- ❌ Don't enable without notice
|
||||
|
||||
### Promotions
|
||||
- ✅ Set clear expiration dates
|
||||
- ✅ Test promotions before going live
|
||||
- ✅ Monitor usage for abuse
|
||||
- ✅ Set reasonable bonus limits
|
||||
- ❌ Don't make unlimited promotions without caps
|
||||
|
||||
### Announcements
|
||||
- ✅ Use appropriate type/color
|
||||
- ✅ Keep messages concise and clear
|
||||
- ✅ Set expiration dates
|
||||
- ✅ Make non-critical announcements dismissible
|
||||
- ❌ Don't overuse "Error" type
|
||||
|
||||
---
|
||||
|
||||
## 🚨 Emergency Procedures
|
||||
|
||||
### Site Under Attack / Heavy Bot Traffic
|
||||
|
||||
```
|
||||
1. Enable maintenance mode immediately
|
||||
2. Add trusted admin Steam IDs to whitelist
|
||||
3. Check logs for suspicious activity
|
||||
4. Ban identified bot accounts
|
||||
5. Update rate limits if needed
|
||||
6. Re-enable site after confirmation
|
||||
```
|
||||
|
||||
### Pricing Issue Detected
|
||||
|
||||
```
|
||||
1. Go to Admin Panel > Items tab
|
||||
2. Filter by affected game
|
||||
3. Click "Update Prices" button
|
||||
4. Verify prices are correct
|
||||
5. If needed, manually edit specific item prices
|
||||
```
|
||||
|
||||
### User Reports Incorrect Balance
|
||||
|
||||
```
|
||||
1. Search for the user in Users tab
|
||||
2. Click "View Details"
|
||||
3. Check "Transaction History"
|
||||
4. Review recent transactions
|
||||
5. If error confirmed, adjust balance with reason
|
||||
6. Document the correction
|
||||
```
|
||||
|
||||
### Promotion Not Working
|
||||
|
||||
```
|
||||
1. Go to Config > Promotions
|
||||
2. Verify promotion is "Enabled"
|
||||
3. Check start/end dates are correct
|
||||
4. Verify user meets requirements
|
||||
5. Check usage limits haven't been reached
|
||||
6. Test with your own account
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Monitoring Dashboard
|
||||
|
||||
### Key Metrics to Watch
|
||||
|
||||
**Daily checks:**
|
||||
- Total active users
|
||||
- Transaction volume
|
||||
- Failed transactions
|
||||
- Pending withdrawals
|
||||
- Support tickets
|
||||
|
||||
**Weekly checks:**
|
||||
- Revenue trends
|
||||
- Popular items
|
||||
- Promotion performance
|
||||
- User growth rate
|
||||
- Refund requests
|
||||
|
||||
**Monthly checks:**
|
||||
- Financial reports
|
||||
- User retention
|
||||
- Market trends
|
||||
- System performance
|
||||
- Security incidents
|
||||
|
||||
---
|
||||
|
||||
## 🔐 Security Guidelines
|
||||
|
||||
1. **Never share admin credentials**
|
||||
2. **Enable 2FA on admin accounts**
|
||||
3. **Log all significant admin actions**
|
||||
4. **Review admin activity logs weekly**
|
||||
5. **Use strong, unique passwords**
|
||||
6. **Only promote trusted staff to admin**
|
||||
7. **Rotate admin access regularly**
|
||||
8. **Monitor for unauthorized access**
|
||||
|
||||
---
|
||||
|
||||
## 🆘 Getting Help
|
||||
|
||||
### Issues & Support
|
||||
|
||||
**Admin panel not loading:**
|
||||
- Check browser console for errors
|
||||
- Clear cache and reload
|
||||
- Verify you have admin permissions
|
||||
- Check server status
|
||||
|
||||
**Action failed:**
|
||||
- Check error message in toast notification
|
||||
- Verify input validation
|
||||
- Check server logs: `backend.log`
|
||||
- Try refreshing the page
|
||||
|
||||
**Need assistance:**
|
||||
- Check ADMIN_SYSTEM.md for detailed docs
|
||||
- Review API_ENDPOINTS.md for API reference
|
||||
- Contact senior admin or developer
|
||||
- Check troubleshooting section in docs
|
||||
|
||||
---
|
||||
|
||||
## 📝 Changelog Template
|
||||
|
||||
When making significant changes, document them:
|
||||
|
||||
```
|
||||
Date: 2024-01-01
|
||||
Admin: YourUsername
|
||||
Action: [Ban/Balance/Config/etc]
|
||||
Details: What was changed and why
|
||||
User(s) Affected: username or userId
|
||||
Reason: Full explanation
|
||||
Result: Success/Failed/Reverted
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Keyboard Shortcuts (Planned)
|
||||
|
||||
```
|
||||
Ctrl + K - Quick user search
|
||||
Ctrl + M - Toggle maintenance mode
|
||||
Ctrl + A - Create announcement
|
||||
Ctrl + P - Create promotion
|
||||
Esc - Close any modal
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎓 Training Checklist for New Admins
|
||||
|
||||
- [ ] Read this quick start guide
|
||||
- [ ] Review ADMIN_SYSTEM.md documentation
|
||||
- [ ] Practice searching for users
|
||||
- [ ] Test balance adjustment on test account
|
||||
- [ ] Create a test announcement
|
||||
- [ ] Create a test promotion
|
||||
- [ ] Understand ban duration options
|
||||
- [ ] Know how to enable/disable features
|
||||
- [ ] Understand staff level hierarchy
|
||||
- [ ] Review security guidelines
|
||||
- [ ] Know emergency procedures
|
||||
- [ ] Familiarize with dashboard metrics
|
||||
|
||||
---
|
||||
|
||||
## 📞 Emergency Contacts
|
||||
|
||||
```
|
||||
Senior Admin: [Discord/Email]
|
||||
Developer: [Discord/Email]
|
||||
Database Admin: [Discord/Email]
|
||||
Security Team: [Discord/Email]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Remember:** With great power comes great responsibility. Always double-check before taking action, especially with bans and balance adjustments.
|
||||
|
||||
**Last Updated:** 2024
|
||||
Reference in New Issue
Block a user