Skip to content

Commit 22f2c06

Browse files
author
nejc
committed
feat: complete version platform manager implementation
- Added comprehensive user version tracking system - Implemented version creation with automatic version numbering - Created feature management system with import/export functionality - Added analytics dashboard with user adoption metrics - Implemented version update modal system - Added proper statistics and user management - Fixed lazy loading issues and improved performance - Enhanced UI with better responsive design and user experience
1 parent 9071d32 commit 22f2c06

27 files changed

+2164
-1741
lines changed

VERSION_MODAL_USAGE.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Version Platform Manager - Modal Usage
2+
3+
This document explains how to use the new version update modal functionality.
4+
5+
## Overview
6+
7+
The version platform manager now includes an automatic modal system that shows users what's new when they log in or visit pages after a version update.
8+
9+
## Features
10+
11+
1. **Automatic Detection**: Middleware checks if user needs to see version updates
12+
2. **Modal Display**: Beautiful modal popup with version content
13+
3. **Cookie Tracking**: 1-day cookie prevents showing same version again
14+
4. **Read/Skip Options**: Users can mark as read or skip for now
15+
5. **Markdown Support**: Rich content support with markdown rendering
16+
17+
## Setup
18+
19+
### 1. Register Middleware
20+
21+
Add the middleware to your routes where you want the modal to appear:
22+
23+
```php
24+
Route::middleware(['web', 'auth', 'version.updates'])->group(function () {
25+
// Your routes here
26+
});
27+
```
28+
29+
### 2. Include Modal Component
30+
31+
Add the modal component to your layout:
32+
33+
```blade
34+
<!-- In your main layout -->
35+
<x-version-platform-manager::version-update-modal />
36+
```
37+
38+
### 3. Create a Version
39+
40+
1. Go to `/admin/version-manager/versions/create`
41+
2. Fill in version details
42+
3. Add markdown content in the "What's New" section
43+
4. Save the version
44+
45+
## How It Works
46+
47+
### Middleware Check
48+
49+
The `CheckVersionUpdates` middleware:
50+
- Checks if user is authenticated
51+
- Compares user's version with latest platform version
52+
- Sets up modal data if update is needed
53+
- Excludes certain routes (configurable)
54+
55+
### Modal Display
56+
57+
The modal appears automatically when:
58+
- User has an older version than latest
59+
- User hasn't read/skipped this version (cookie check)
60+
- User is on a non-excluded route
61+
62+
### User Actions
63+
64+
Users can:
65+
- **Mark as Read**: Updates their version and sets a 1-day cookie
66+
- **Skip**: Sets a 1-day cookie without updating version
67+
- **Close**: Just closes the modal (will show again next time)
68+
69+
## Configuration
70+
71+
### Excluded Routes
72+
73+
Configure routes to exclude from version checks in `config/version-platform-manager.php`:
74+
75+
```php
76+
'whats_new_exclude' => [
77+
'admin*',
78+
'api*',
79+
'login',
80+
'register',
81+
'password/*',
82+
],
83+
```
84+
85+
### Modal Settings
86+
87+
Configure modal behavior:
88+
89+
```php
90+
'modal' => [
91+
'auto_show' => env('VERSION_MODAL_AUTO_SHOW', true),
92+
'dismissible' => env('VERSION_MODAL_DISMISSIBLE', true),
93+
'show_once_per_session' => env('VERSION_MODAL_SHOW_ONCE_PER_SESSION', true),
94+
'delay' => env('VERSION_MODAL_DELAY', 1000), // milliseconds
95+
],
96+
```
97+
98+
## API Endpoints
99+
100+
### Check if should show update
101+
```
102+
GET /version-platform-manager/should-show-update
103+
```
104+
105+
### Mark as read
106+
```
107+
POST /version-platform-manager/mark-as-read
108+
{
109+
"version": "1.1.0"
110+
}
111+
```
112+
113+
### Skip version
114+
```
115+
POST /version-platform-manager/skip
116+
{
117+
"version": "1.1.0"
118+
}
119+
```
120+
121+
## Testing
122+
123+
Visit `/version-example` to test the modal functionality.
124+
125+
## Content Format
126+
127+
### Markdown Content
128+
129+
Use markdown in the version creation form:
130+
131+
```markdown
132+
# What's New in Version 1.1.0
133+
134+
## 🎉 New Features
135+
- Added dark mode support
136+
- New dashboard widgets
137+
138+
## ⚡ Improvements
139+
- Faster page loading
140+
- Better mobile experience
141+
142+
## 🐛 Bug Fixes
143+
- Fixed login issue
144+
- Resolved data export problem
145+
```
146+
147+
### Emoji Categories
148+
149+
- 🎉 Feature
150+
- ⚡ Improvement
151+
- 🐛 Bug Fix
152+
- 🔒 Security
153+
- ⚠️ Deprecation
154+
155+
## Database Schema
156+
157+
The system uses these tables:
158+
- `platform_versions`: Version information
159+
- `user_versions`: User version tracking
160+
- `whats_new`: Version content items
161+
162+
## Cookie Management
163+
164+
Cookies are set for 1 day (86400 seconds):
165+
- `version_{version}_read`: When user marks as read
166+
- `version_{version}_skipped`: When user skips
167+
168+
## Troubleshooting
169+
170+
### Modal not showing
171+
1. Check if user is authenticated
172+
2. Verify user has older version than latest
173+
3. Check if cookies are blocking display
174+
4. Ensure middleware is applied to route
175+
176+
### Content not displaying
177+
1. Check if markdown content is saved in version metadata
178+
2. Verify Vue.js is loaded
179+
3. Check browser console for JavaScript errors
180+
181+
### Styling issues
182+
1. Ensure Tailwind CSS is loaded
183+
2. Check if custom CSS conflicts with modal styles
184+
3. Verify responsive design classes

database/migrations/2024_01_01_000000_create_version_platform_manager_tables.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ public function up(): void
3434
Schema::create('whats_new', function (Blueprint $table) {
3535
$table->id();
3636
$table->foreignId('platform_version_id')->constrained()->onDelete('cascade');
37+
$table->string('title');
3738
$table->text('content');
3839
$table->enum('type', ['feature', 'improvement', 'bugfix', 'security', 'deprecation'])->default('feature');
40+
$table->enum('status', ['draft', 'private', 'published'])->default('draft');
3941
$table->boolean('is_active')->default(true);
4042
$table->integer('sort_order')->default(0);
4143
$table->json('metadata')->nullable();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('whats_new', function (Blueprint $table) {
15+
$table->string('title')->after('platform_version_id');
16+
$table->enum('status', ['draft', 'private', 'published'])->default('draft')->after('type');
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*/
23+
public function down(): void
24+
{
25+
Schema::table('whats_new', function (Blueprint $table) {
26+
$table->dropColumn(['title', 'status']);
27+
});
28+
}
29+
};

0 commit comments

Comments
 (0)