feat(ui): improve update notification system with Markdown and better visibility
Enhances the update notification experience by improving logic, readability, and UI styling. - Reduced "skip this version" reminder period from 7 days to 2 hours for more frequent notifications. - Integrated showdown.js to render changelog content in Markdown for better formatting. - Converted changelog text from Markdown to HTML before displaying in the notification bar. - Enhanced visibility and styling of the update notification bar.
This commit is contained in:
@ -27,26 +27,26 @@
|
|||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
<!-- Update Notification Bar -->
|
<!-- Update Notification Bar -->
|
||||||
<div id="updateBar" class="m-0 rounded-0 border-0" style="display: none; position: relative; z-index: 1100; background: linear-gradient(135deg, #f0f2ff 0%, #e6e9ff 100%); box-shadow: 0 2px 8px rgba(102, 16, 242, 0.15); border-bottom: 1px solid rgba(0,0,0,0.05);">
|
<div id="updateBar" class="m-0 rounded-0 border-0" style="display: none; position: relative; z-index: 1100; background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%); box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-bottom: 1px solid rgba(0,0,0,0.1);">
|
||||||
<div class="container-fluid py-3">
|
<div class="container-fluid py-3">
|
||||||
<div class="d-flex align-items-center justify-content-between">
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<div class="d-flex align-items-center justify-content-center mr-3" style="width: 36px; height: 36px; background: rgba(255,255,255,0.9); border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
|
<div class="d-flex align-items-center justify-content-center mr-3" style="width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 50%;">
|
||||||
<i class="fas fa-rocket text-indigo" style="font-size: 16px;"></i>
|
<i class="fas fa-rocket text-white" style="font-size: 16px;"></i>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<span id="updateMessage" class="font-weight-bold text-indigo mb-0" style="font-size: 15px;">New version available</span>
|
<span id="updateMessage" class="font-weight-bold text-white mb-0" style="font-size: 15px;">New version available</span>
|
||||||
<button type="button" class="btn btn-link btn-sm p-0 ml-2 text-indigo" id="showChangelog" style="text-decoration: none; opacity: 0.8; transition: all 0.2s ease;">
|
<button type="button" class="btn btn-link btn-sm p-0 ml-2 text-white" id="showChangelog" style="text-decoration: none; opacity: 0.8; transition: all 0.2s ease;">
|
||||||
<i class="fas fa-chevron-down" style="font-size: 12px;"></i>
|
<i class="fas fa-chevron-down" style="font-size: 12px;"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<small class="d-block" style="font-size: 13px; margin-top: 2px; color: #6f7a99;">Click to view changelog and update options</small>
|
<small class="d-block" style="font-size: 13px; margin-top: 2px; color: rgba(255,255,255,0.8);">Click to view changelog and update options</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-sm dropdown-toggle text-indigo font-weight-bold" type="button" style="background: rgba(255,255,255,0.7); border: 1px solid rgba(102, 16, 242, 0.3); padding: 8px 16px; border-radius: 20px; font-size: 13px;" data-toggle="dropdown">
|
<button class="btn btn-sm dropdown-toggle text-white font-weight-bold" type="button" style="background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); padding: 8px 16px; border-radius: 20px; font-size: 13px;" data-toggle="dropdown">
|
||||||
<i class="fas fa-download mr-1"></i> Update Options
|
<i class="fas fa-download mr-1"></i> Update Options
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu dropdown-menu-right shadow-sm">
|
<div class="dropdown-menu dropdown-menu-right shadow-sm">
|
||||||
@ -62,18 +62,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-sm ml-2 text-indigo" id="closeUpdateBar" style="background: rgba(255,255,255,0.7); border: 1px solid rgba(102, 16, 242, 0.3); width: 32px; height: 32px; border-radius: 50%; padding: 0; opacity: 0.8; transition: all 0.2s ease;">
|
<button type="button" class="btn btn-sm ml-2 text-white" id="closeUpdateBar" style="background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); width: 32px; height: 32px; border-radius: 50%; padding: 0; opacity: 0.8; transition: all 0.2s ease;">
|
||||||
<i class="fas fa-times" style="font-size: 12px;"></i>
|
<i class="fas fa-times" style="font-size: 12px;"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="changelogContent" class="mt-3" style="display: none;">
|
<div id="changelogContent" class="mt-3" style="display: none;">
|
||||||
<div style="background: rgba(255,255,255,0.9); border-radius: 8px; padding: 16px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);">
|
<div style="background: rgba(0,0,0,0.15); border-radius: 8px; padding: 16px;">
|
||||||
<div class="d-flex align-items-center mb-2">
|
<div class="d-flex align-items-center mb-2">
|
||||||
<i class="fas fa-list-ul text-info mr-2"></i>
|
<i class="fas fa-list-ul text-white mr-2" style="opacity: 0.8;"></i>
|
||||||
<h6 class="mb-0 font-weight-bold text-dark">Release Notes</h6>
|
<h6 class="mb-0 font-weight-bold text-white">Release Notes</h6>
|
||||||
</div>
|
</div>
|
||||||
<div id="changelogText" style="max-height: 180px; overflow-y: auto; font-size: 14px; line-height: 1.5; color: #2d3436;"></div>
|
<div id="changelogText" style="max-height: 180px; overflow-y: auto; font-size: 14px; line-height: 1.5; color: rgba(255,255,255,0.9);"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -199,6 +199,8 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/3.2.0/js/adminlte.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/admin-lte/3.2.0/js/adminlte.min.js"></script>
|
||||||
<!-- SweetAlert2 -->
|
<!-- SweetAlert2 -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js"></script>
|
||||||
|
<!-- ShowdownJS for Markdown -->
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -254,14 +256,18 @@
|
|||||||
const checkInterval = 24 * 60 * 60 * 1000;
|
const checkInterval = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
if (!lastCheck) return true;
|
if (!lastCheck) return true;
|
||||||
if (updateDismissed && now - parseInt(updateDismissed) < 7 * 24 * 60 * 60 * 1000) return false;
|
if (updateDismissed && now - parseInt(updateDismissed) < 2 * 60 * 60 * 1000) return false;
|
||||||
|
|
||||||
return now - parseInt(lastCheck) > checkInterval;
|
return now - parseInt(lastCheck) > checkInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUpdateBar(version, changelog) {
|
function showUpdateBar(version, changelog) {
|
||||||
$('#updateMessage').text(`Version ${version} is now available`);
|
$('#updateMessage').text(`Version ${version} is now available`);
|
||||||
$('#changelogText').html(changelog ? changelog.replace(/\n/g, '<br>') : 'No changelog available');
|
|
||||||
|
const converter = new showdown.Converter();
|
||||||
|
const htmlChangelog = changelog ? converter.makeHtml(changelog) : '<p>No changelog available.</p>';
|
||||||
|
$('#changelogText').html(htmlChangelog);
|
||||||
|
|
||||||
$('#updateBar').slideDown(300);
|
$('#updateBar').slideDown(300);
|
||||||
|
|
||||||
$('#viewRelease').off('click').on('click', function(e) {
|
$('#viewRelease').off('click').on('click', function(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user