initial commit
This commit is contained in:
parent
e468202f95
commit
423b9a25fb
24 changed files with 6670 additions and 0 deletions
294
native/wordpress/maple-icons-wp/assets/admin.css
Normal file
294
native/wordpress/maple-icons-wp/assets/admin.css
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
/**
|
||||
* Maple Icons - Admin Styles
|
||||
*
|
||||
* @package MapleIcons
|
||||
*/
|
||||
|
||||
/* Admin page wrapper */
|
||||
.mi-admin-wrap {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.mi-admin-intro {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-left: 4px solid #2271b1;
|
||||
padding: 12px 16px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.mi-admin-intro p {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* Icon sets grid */
|
||||
.mi-sets-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
/* Individual set card */
|
||||
.mi-set-card {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.mi-set-card:hover {
|
||||
border-color: #2271b1;
|
||||
}
|
||||
|
||||
.mi-set-card.mi-set-active {
|
||||
border-color: #00a32a;
|
||||
box-shadow: 0 0 0 1px #00a32a;
|
||||
}
|
||||
|
||||
.mi-set-card.mi-set-downloading {
|
||||
opacity: 0.8;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Card header */
|
||||
.mi-set-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.mi-set-name {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
/* Badges */
|
||||
.mi-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.mi-badge-active {
|
||||
background: #00a32a;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.mi-badge-downloaded {
|
||||
background: #dcdcde;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
/* Set metadata */
|
||||
.mi-set-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 13px;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
.mi-set-count {
|
||||
font-weight: 600;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
/* External link */
|
||||
.mi-set-link {
|
||||
display: inline-block;
|
||||
margin-bottom: 16px;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.mi-set-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Action buttons */
|
||||
.mi-set-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.mi-set-actions .button {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mi-delete-btn {
|
||||
color: #d63638 !important;
|
||||
border-color: #d63638 !important;
|
||||
}
|
||||
|
||||
.mi-delete-btn:hover {
|
||||
background: #d63638 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Progress bar */
|
||||
.mi-set-progress {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.mi-progress-bar {
|
||||
height: 8px;
|
||||
background: #dcdcde;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.mi-progress-fill {
|
||||
height: 100%;
|
||||
background: #2271b1;
|
||||
border-radius: 4px;
|
||||
width: 0;
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.mi-progress-text {
|
||||
font-size: 12px;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
.mi-set-message {
|
||||
margin-top: 12px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.mi-set-message.mi-message-success {
|
||||
background: #edfaef;
|
||||
border: 1px solid #00a32a;
|
||||
color: #00450c;
|
||||
}
|
||||
|
||||
.mi-set-message.mi-message-error {
|
||||
background: #fcf0f1;
|
||||
border: 1px solid #d63638;
|
||||
color: #8a1f22;
|
||||
}
|
||||
|
||||
.mi-set-message.mi-message-info {
|
||||
background: #f0f6fc;
|
||||
border: 1px solid #2271b1;
|
||||
color: #135e96;
|
||||
}
|
||||
|
||||
/* Usage section */
|
||||
.mi-admin-usage,
|
||||
.mi-admin-info {
|
||||
background: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 4px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.mi-admin-usage h2,
|
||||
.mi-admin-info h2 {
|
||||
margin-top: 0;
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #c3c4c7;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.mi-admin-usage ol {
|
||||
margin: 16px 0 0;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.mi-admin-usage li {
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mi-admin-info p {
|
||||
font-size: 14px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.mi-admin-info p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.mi-admin-info code {
|
||||
background: #f0f0f1;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Loading spinner */
|
||||
.mi-spinner {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #c3c4c7;
|
||||
border-top-color: #2271b1;
|
||||
border-radius: 50%;
|
||||
animation: mi-spin 0.8s linear infinite;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@keyframes mi-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Button loading state */
|
||||
.button.mi-loading {
|
||||
position: relative;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
.button.mi-loading::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin: -7px 0 0 -7px;
|
||||
border: 2px solid currentColor;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: mi-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
.button-primary.mi-loading::after {
|
||||
border-color: rgba(255, 255, 255, 0.3);
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media screen and (max-width: 782px) {
|
||||
.mi-sets-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.mi-set-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mi-set-actions .button {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
255
native/wordpress/maple-icons-wp/assets/admin.js
Normal file
255
native/wordpress/maple-icons-wp/assets/admin.js
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/**
|
||||
* Maple Icons - Admin JavaScript
|
||||
*
|
||||
* @package MapleIcons
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Show message on a card.
|
||||
*
|
||||
* @param {jQuery} $card The card element.
|
||||
* @param {string} message The message text.
|
||||
* @param {string} type Message type: success, error, info.
|
||||
*/
|
||||
function showMessage($card, message, type) {
|
||||
var $message = $card.find('.mi-set-message');
|
||||
$message
|
||||
.removeClass('mi-message-success mi-message-error mi-message-info')
|
||||
.addClass('mi-message-' + type)
|
||||
.text(message)
|
||||
.show();
|
||||
|
||||
// Auto-hide success messages after 5 seconds.
|
||||
if (type === 'success') {
|
||||
setTimeout(function() {
|
||||
$message.fadeOut();
|
||||
}, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide message on a card.
|
||||
*
|
||||
* @param {jQuery} $card The card element.
|
||||
*/
|
||||
function hideMessage($card) {
|
||||
$card.find('.mi-set-message').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show progress bar.
|
||||
*
|
||||
* @param {jQuery} $card The card element.
|
||||
*/
|
||||
function showProgress($card) {
|
||||
$card.find('.mi-set-progress').show();
|
||||
$card.find('.mi-set-actions').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide progress bar.
|
||||
*
|
||||
* @param {jQuery} $card The card element.
|
||||
*/
|
||||
function hideProgress($card) {
|
||||
$card.find('.mi-set-progress').hide();
|
||||
$card.find('.mi-set-actions').show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update progress bar.
|
||||
*
|
||||
* @param {jQuery} $card The card element.
|
||||
* @param {number} percentage Progress percentage (0-100).
|
||||
* @param {string} text Progress text.
|
||||
*/
|
||||
function updateProgress($card, percentage, text) {
|
||||
$card.find('.mi-progress-fill').css('width', percentage + '%');
|
||||
$card.find('.mi-progress-text').text(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll download progress.
|
||||
*
|
||||
* @param {string} slug Icon set slug.
|
||||
* @param {jQuery} $card The card element.
|
||||
*/
|
||||
function pollProgress(slug, $card) {
|
||||
$.ajax({
|
||||
url: miAdmin.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'mi_get_progress',
|
||||
nonce: miAdmin.nonce,
|
||||
slug: slug
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success && response.data.downloading) {
|
||||
var percentage = response.data.percentage || 0;
|
||||
var text = response.data.completed + ' / ' + response.data.total + ' icons';
|
||||
updateProgress($card, percentage, text);
|
||||
|
||||
// Continue polling if still downloading.
|
||||
setTimeout(function() {
|
||||
pollProgress(slug, $card);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle download button click.
|
||||
*/
|
||||
$(document).on('click', '.mi-download-btn', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btn = $(this);
|
||||
var $card = $btn.closest('.mi-set-card');
|
||||
var slug = $btn.data('slug');
|
||||
|
||||
if ($btn.hasClass('mi-loading')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$btn.addClass('mi-loading');
|
||||
$card.addClass('mi-set-downloading');
|
||||
hideMessage($card);
|
||||
showProgress($card);
|
||||
updateProgress($card, 0, miAdmin.strings.downloading);
|
||||
|
||||
// Start polling for progress.
|
||||
setTimeout(function() {
|
||||
pollProgress(slug, $card);
|
||||
}, 500);
|
||||
|
||||
$.ajax({
|
||||
url: miAdmin.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'mi_download_set',
|
||||
nonce: miAdmin.nonce,
|
||||
slug: slug
|
||||
},
|
||||
success: function(response) {
|
||||
hideProgress($card);
|
||||
$btn.removeClass('mi-loading');
|
||||
$card.removeClass('mi-set-downloading');
|
||||
|
||||
if (response.success) {
|
||||
showMessage($card, response.data.message || miAdmin.strings.downloadSuccess, 'success');
|
||||
// Reload page to update UI state.
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
showMessage($card, response.data.message || miAdmin.strings.downloadError, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
hideProgress($card);
|
||||
$btn.removeClass('mi-loading');
|
||||
$card.removeClass('mi-set-downloading');
|
||||
showMessage($card, miAdmin.strings.downloadError, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Handle delete button click.
|
||||
*/
|
||||
$(document).on('click', '.mi-delete-btn', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btn = $(this);
|
||||
var $card = $btn.closest('.mi-set-card');
|
||||
var slug = $btn.data('slug');
|
||||
|
||||
if ($btn.hasClass('mi-loading')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(miAdmin.strings.confirmDelete)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$btn.addClass('mi-loading');
|
||||
hideMessage($card);
|
||||
|
||||
$.ajax({
|
||||
url: miAdmin.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'mi_delete_set',
|
||||
nonce: miAdmin.nonce,
|
||||
slug: slug
|
||||
},
|
||||
success: function(response) {
|
||||
$btn.removeClass('mi-loading');
|
||||
|
||||
if (response.success) {
|
||||
showMessage($card, response.data.message || miAdmin.strings.deleteSuccess, 'success');
|
||||
// Reload page to update UI state.
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1500);
|
||||
} else {
|
||||
showMessage($card, response.data.message || miAdmin.strings.deleteError, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$btn.removeClass('mi-loading');
|
||||
showMessage($card, miAdmin.strings.deleteError, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Handle activate button click.
|
||||
*/
|
||||
$(document).on('click', '.mi-activate-btn, .mi-deactivate-btn', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btn = $(this);
|
||||
var $card = $btn.closest('.mi-set-card');
|
||||
var slug = $btn.data('slug');
|
||||
|
||||
if ($btn.hasClass('mi-loading')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$btn.addClass('mi-loading');
|
||||
hideMessage($card);
|
||||
|
||||
$.ajax({
|
||||
url: miAdmin.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'mi_set_active',
|
||||
nonce: miAdmin.nonce,
|
||||
slug: slug
|
||||
},
|
||||
success: function(response) {
|
||||
$btn.removeClass('mi-loading');
|
||||
|
||||
if (response.success) {
|
||||
showMessage($card, response.data.message || miAdmin.strings.activateSuccess, 'success');
|
||||
// Reload page to update UI state.
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 1000);
|
||||
} else {
|
||||
showMessage($card, response.data.message || miAdmin.strings.activateError, 'error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$btn.removeClass('mi-loading');
|
||||
showMessage($card, miAdmin.strings.activateError, 'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
5
native/wordpress/maple-icons-wp/assets/index.php
Normal file
5
native/wordpress/maple-icons-wp/assets/index.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
// Silence is golden.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue