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:
2026-01-10 21:57:55 +00:00
parent b90cdd59df
commit 63c578b0ae
52 changed files with 21810 additions and 61 deletions

203
MAINTENANCE_MODE_FIX.md Normal file
View File

@@ -0,0 +1,203 @@
# Maintenance Mode Improvements
## 🎯 What Was Fixed
The maintenance mode scheduling interface was confusing and poorly designed. Users couldn't properly select dates/times, and the scheduling feature wasn't necessary for simple on/off maintenance mode.
## ✅ Changes Made
### 1. Made Scheduling Optional
- Added a checkbox to **enable/disable scheduling**
- By default, scheduling is **hidden**
- Users can now simply toggle maintenance on/off without dates
- Scheduling only shows if you check "Schedule Maintenance (Optional)"
### 2. Clearer Interface
**Before:**
- Two datetime-local fields always visible
- Confusing "Optional" labels
- No clear explanation
**After:**
- Clean toggle for maintenance mode
- Clear help text explaining what maintenance mode does
- Scheduling is collapsed by default
- Only shows when you want to schedule maintenance
### 3. Better Labels and Help Text
**Maintenance Toggle:**
- Clear description: "When enabled, only admins and whitelisted Steam IDs can access the site"
**Maintenance Message:**
- Helpful placeholder: "We're performing scheduled maintenance. We'll be back soon!"
- Explanation: "This message will be shown to users when they try to access the site"
**Allowed Steam IDs:**
- Now labeled as "Optional"
- Clear explanation: "Add Steam IDs of users who can access during maintenance (admins can always access)"
- Better placeholder: "76561198XXXXXXXXX"
**Scheduling:**
- Hidden by default
- Checkbox to enable: "Schedule Maintenance (Optional)"
- Help text: "Leave unchecked to manually control maintenance mode"
### 4. Smart Behavior
- When scheduling checkbox is **unchecked**, dates are automatically **cleared**
- When loading config, scheduling section **auto-expands** if dates exist
- Prevents confusion about scheduled vs manual maintenance
## 🎨 New UI Layout
```
┌─────────────────────────────────────────────┐
│ Maintenance Mode │
├─────────────────────────────────────────────┤
│ │
│ [🟢 ON] Enable Maintenance Mode │
│ When enabled, only admins and whitelisted │
│ Steam IDs can access the site │
│ │
│ Maintenance Message │
│ ┌─────────────────────────────────────────┐ │
│ │ We're performing scheduled maintenance. │ │
│ │ We'll be back soon! │ │
│ └─────────────────────────────────────────┘ │
│ This message will be shown to users │
│ │
│ [ ] Schedule Maintenance (Optional) │
│ Leave unchecked to manually control │
│ │
│ Allowed Steam IDs (Optional) │
│ Add Steam IDs of users who can access │
│ during maintenance │
│ ┌─────────────────────────────────────┐ │
│ │ 76561198027608071 [X] │ │
│ └─────────────────────────────────────┘ │
│ [+ Add Steam ID] │
│ │
│ [💾 Save Maintenance Settings] │
└─────────────────────────────────────────────┘
```
## 📋 Usage Guide
### Simple On/Off (Recommended)
1. Toggle **"Enable Maintenance Mode"** ON 🟢
2. Enter a **message** for users
3. (Optional) Add **Steam IDs** of users who can access
4. Click **"Save Maintenance Settings"**
5. Site is now in maintenance mode!
**To disable:**
1. Toggle **"Enable Maintenance Mode"** OFF 🔴
2. Click **"Save"**
3. Site is back online!
### Scheduled Maintenance (Advanced)
1. Check **"Schedule Maintenance (Optional)"**
2. Set **Scheduled Start** date/time
3. Set **Scheduled End** date/time
4. Enter maintenance message
5. Click **"Save Maintenance Settings"**
The site will automatically:
- Enter maintenance mode at the scheduled start time
- Exit maintenance mode at the scheduled end time
## 🔧 Technical Details
### Files Modified
- `frontend/src/components/AdminConfigPanel.vue`
### Changes
1. Added `showScheduling` ref to control scheduling visibility
2. Added watcher to clear dates when scheduling is disabled
3. Added logic to auto-show scheduling if dates exist in config
4. Improved labels and help text throughout
5. Made Steam IDs section clearer with better descriptions
### API Unchanged
- Backend API remains the same
- Dates are simply set to `null` when not scheduling
- Fully backward compatible
## ✅ Benefits
1. **Simpler UX** - No confusing date fields for simple on/off
2. **Clearer Labels** - Users understand what each option does
3. **Better Defaults** - Scheduling hidden unless needed
4. **Smart Behavior** - Auto-clears dates when disabled
5. **Helpful Text** - Explanations for every option
6. **Progressive Disclosure** - Advanced features hidden until needed
## 🎯 Use Cases
### Use Case 1: Emergency Maintenance
**Need:** Site has an issue, need to take it down NOW
**Solution:**
1. Toggle maintenance ON
2. Enter message: "We're fixing a critical issue. Be back soon!"
3. Save
4. Done in 10 seconds ✅
### Use Case 2: Scheduled Maintenance
**Need:** Plan maintenance window for next Tuesday 2am-4am
**Solution:**
1. Check "Schedule Maintenance"
2. Set start: Tuesday 2:00 AM
3. Set end: Tuesday 4:00 AM
4. Enter message about scheduled maintenance
5. Save
6. System automatically handles it ✅
### Use Case 3: VIP Access During Maintenance
**Need:** Site is down but VIPs should still access
**Solution:**
1. Enable maintenance mode
2. Add VIP Steam IDs to "Allowed Steam IDs"
3. Save
4. VIPs can access, everyone else sees maintenance page ✅
## 📊 Before vs After
| Aspect | Before | After |
|--------|--------|-------|
| **Scheduling Fields** | Always visible | Hidden by default |
| **Clarity** | Confusing | Clear with help text |
| **Simple Mode** | Required dates | Just toggle on/off |
| **Help Text** | Minimal | Comprehensive |
| **Steam IDs** | Unclear purpose | Clearly labeled optional |
| **User Flow** | Confusing | Intuitive |
## 🚀 Testing
After updating:
1. Hard refresh browser (Ctrl+Shift+R)
2. Navigate to `/admin` → Config tab
3. You should see:
- ✅ Clean toggle for maintenance
- ✅ No date fields (unless checkbox enabled)
- ✅ Clear help text for each field
- ✅ Better organized layout
## 📝 Notes
- Scheduling is **completely optional**
- Most users will just use the simple toggle
- Advanced users can still schedule if needed
- All existing maintenance configs will load correctly
- If existing config has dates, scheduling auto-expands
---
**Status:** ✅ Complete and Tested
**Impact:** Greatly improved UX
**Breaking Changes:** None
**Migration Required:** No