Material Design

This commit is contained in:
2026-04-22 13:11:06 +02:00
parent d31591e287
commit 94569539d7
4 changed files with 244 additions and 108 deletions
+2 -2
View File
@@ -192,8 +192,8 @@ function statpress_goals_page() {
</div> </div>
</div> </div>
<style> <style>
.statpress-progress-bar-container { background: #eee; border-radius: 4px; height: 12px; width: 100%; overflow: hidden; margin-bottom: 4px; } .statpress-progress-bar-container { background: #e8eaed; border-radius: 10px; height: 12px; width: 100%; overflow: hidden; margin-bottom: 4px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); }
.statpress-progress-bar { background: #3498db; height: 100%; border-radius: 4px; transition: width 0.5s ease-in-out; } .statpress-progress-bar { background: #1a73e8; height: 100%; border-radius: 10px; transition: width 0.5s ease-in-out; }
</style> </style>
<?php <?php
} }
+9 -9
View File
@@ -110,29 +110,29 @@ function statpress_yearly_summary_page() {
'distance' => array( 'distance' => array(
'label' => 'Dystans (km)', 'label' => 'Dystans (km)',
'data' => $chart_datasets['distance'], 'data' => $chart_datasets['distance'],
'backgroundColor' => 'rgba(52, 152, 219, 0.5)', 'backgroundColor' => 'rgba(26, 115, 232, 0.5)', /* Google Blue */
'borderColor' => 'rgba(52, 152, 219, 1)', 'borderColor' => 'rgba(26, 115, 232, 1)',
'yAxisLabel' => 'Kilometry', 'yAxisLabel' => 'Kilometry',
), ),
'duration' => array( 'duration' => array(
'label' => 'Czas trwania (godz.)', 'label' => 'Czas trwania (godz.)',
'data' => $chart_datasets['duration'], 'data' => $chart_datasets['duration'],
'backgroundColor' => 'rgba(26, 188, 156, 0.5)', 'backgroundColor' => 'rgba(24, 128, 56, 0.5)', /* Google Green */
'borderColor' => 'rgba(26, 188, 156, 1)', 'borderColor' => 'rgba(24, 128, 56, 1)',
'yAxisLabel' => 'Godziny', 'yAxisLabel' => 'Godziny',
), ),
'calories' => array( 'calories' => array(
'label' => 'Kalorie (kcal)', 'label' => 'Kalorie (kcal)',
'data' => $chart_datasets['calories'], 'data' => $chart_datasets['calories'],
'backgroundColor' => 'rgba(231, 76, 60, 0.5)', 'backgroundColor' => 'rgba(217, 48, 37, 0.5)', /* Google Red */
'borderColor' => 'rgba(231, 76, 60, 1)', 'borderColor' => 'rgba(217, 48, 37, 1)',
'yAxisLabel' => 'kcal', 'yAxisLabel' => 'kcal',
), ),
'activities' => array( 'activities' => array(
'label' => 'Liczba aktywności', 'label' => 'Liczba aktywności',
'data' => $chart_datasets['activities'], 'data' => $chart_datasets['activities'],
'backgroundColor' => 'rgba(241, 196, 15, 0.5)', 'backgroundColor' => 'rgba(249, 171, 0, 0.5)', /* Google Yellow */
'borderColor' => 'rgba(241, 196, 15, 1)', 'borderColor' => 'rgba(249, 171, 0, 1)',
'yAxisLabel' => 'Ilość', 'yAxisLabel' => 'Ilość',
), ),
); );
@@ -247,7 +247,7 @@ function statpress_yearly_summary_page() {
</div> </div>
<style> <style>
.statpress-goals-list { list-style: none; margin: 0; padding: 0; } .statpress-goal-item { margin-bottom: 15px; } .statpress-goal-info { display: flex; justify-content: space-between; margin-bottom: 5px; } .statpress-goals-list { list-style: none; margin: 0; padding: 0; } .statpress-goal-item { margin-bottom: 15px; } .statpress-goal-info { display: flex; justify-content: space-between; margin-bottom: 5px; }
.statpress-progress-bar-container { background: #eee; border-radius: 4px; height: 18px; width: 100%; overflow: hidden; } .statpress-progress-bar { background: #3498db; height: 100%; border-radius: 4px; transition: width 0.5s ease-in-out; text-align: center; color: white; font-size: 11px; line-height: 18px; } .statpress-progress-bar-container { background: #e8eaed; border-radius: 10px; height: 20px; width: 100%; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); } .statpress-progress-bar { background: #1a73e8; height: 100%; border-radius: 10px; transition: width 0.5s ease-in-out; text-align: center; color: white; font-size: 12px; line-height: 20px; font-weight: 500; }
</style> </style>
<?php endif; ?> <?php endif; ?>
+118 -97
View File
@@ -38,7 +38,7 @@ function statpress_shortcode_handler( $atts ) {
$table_activities = $wpdb->prefix . 'statpress_activities'; $table_activities = $wpdb->prefix . 'statpress_activities';
$sql = $wpdb->prepare( $sql = $wpdb->prepare(
" "
SELECT a.*, c.name as category_name, eq.name as equipment_name SELECT a.*, c.name as category_name, c.icon, c.color, eq.name as equipment_name
FROM $table_activities a FROM $table_activities a
LEFT JOIN {$wpdb->prefix}statpress_categories c ON a.category_id = c.id LEFT JOIN {$wpdb->prefix}statpress_categories c ON a.category_id = c.id
LEFT JOIN {$wpdb->prefix}statpress_equipment eq ON a.equipment_id = eq.id LEFT JOIN {$wpdb->prefix}statpress_equipment eq ON a.equipment_id = eq.id
@@ -68,78 +68,95 @@ function statpress_shortcode_handler( $atts ) {
// Rozpoczęcie buforowania wyjścia // Rozpoczęcie buforowania wyjścia
ob_start(); ob_start();
?> ?>
<div class="statpress-shortcode-container"> <style>
.statpress-md-container { font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.statpress-md-container h3 { color: #202124; font-weight: 400; margin: 24px 0 16px; font-size: 20px; }
/* Karty podsumowania */
.statpress-summary-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.statpress-summary-card { background: #fff; border-radius: 8px; padding: 20px; flex: 1; min-width: 140px; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15); border-left: 4px solid #1a73e8; }
.statpress-summary-card-title { font-size: 12px; color: #5f6368; text-transform: uppercase; font-weight: 500; margin-bottom: 8px; letter-spacing: 0.5px; }
.statpress-summary-card-value { font-size: 28px; color: #202124; font-weight: 400; }
/* Karty aktywności */
.statpress-activity-list { display: flex; flex-direction: column; gap: 16px; }
.statpress-activity-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15); display: flex; padding: 16px 20px; align-items: center; flex-wrap: wrap; gap: 20px; transition: transform 0.2s, box-shadow 0.2s; }
.statpress-activity-card:hover { transform: translateY(-2px); box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15); }
.statpress-activity-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.statpress-activity-icon .material-icons { font-size: 24px; }
.statpress-activity-info { flex: 1; min-width: 200px; }
.statpress-activity-title { font-size: 16px; font-weight: 500; color: #202124; margin: 0 0 6px 0; line-height: 1.3; }
.statpress-activity-meta { font-size: 13px; color: #5f6368; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statpress-activity-meta-dot { font-size: 8px; color: #dadce0; }
.statpress-activity-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.statpress-stat-item { display: flex; flex-direction: column; }
.statpress-stat-label { font-size: 11px; color: #5f6368; text-transform: uppercase; font-weight: 500; margin-bottom: 2px; }
.statpress-stat-value { font-size: 15px; color: #202124; font-weight: 500; }
/* Responsywność */
@media (max-width: 600px) {
.statpress-activity-card { align-items: flex-start; padding: 16px; gap: 16px; }
.statpress-activity-stats { width: 100%; justify-content: space-between; border-top: 1px solid #f1f3f4; padding-top: 16px; margin-top: 4px; }
.statpress-summary-card { min-width: 100%; border-left: none; border-top: 4px solid #1a73e8; }
}
</style>
<div class="statpress-shortcode-container statpress-md-container">
<h3>Podsumowanie miesiąca</h3> <h3>Podsumowanie miesiąca</h3>
<table class="statpress-summary-table"> <div class="statpress-summary-cards">
<thead> <div class="statpress-summary-card">
<tr> <div class="statpress-summary-card-title">Całkowity dystans</div>
<th>Całkowity dystans</th> <div class="statpress-summary-card-value"><?php echo number_format( $total_distance, 2, ',', ' ' ); ?> km</div>
<th>Całkowity czas</th> </div>
</tr> <div class="statpress-summary-card" style="border-color: #188038;">
</thead> <div class="statpress-summary-card-title">Całkowity czas</div>
<tbody> <div class="statpress-summary-card-value"><?php echo esc_html( $total_duration_formatted ); ?></div>
<tr> </div>
<td><?php echo number_format( $total_distance, 2, ',', ' ' ); ?> km</td> </div>
<td><?php echo esc_html( $total_duration_formatted ); ?></td>
</tr>
</tbody>
</table>
<h3>Lista aktywności</h3> <h3>Lista aktywności</h3>
<table class="statpress-activity-table"> <div class="statpress-activity-list">
<thead> <?php if ( ! empty( $activities ) ) : ?>
<tr> <?php foreach ( $activities as $row ) :
<th>Data</th> $material_icon = 'fitness_center';
<th>Tytuł</th> if ( strpos( $row->icon, 'groups' ) !== false ) { $material_icon = 'directions_bike'; }
<th>Kategoria</th> elseif ( strpos( $row->icon, 'businessman' ) !== false ) { $material_icon = 'directions_run'; }
$bg_color = !empty($row->color) ? $row->color : '#1a73e8';
<th>Dystans</th> ?>
<th>Czas</th> <div class="statpress-activity-card">
<th>Sprzęt</th> <div class="statpress-activity-icon" style="background-color: <?php echo esc_attr( $bg_color ); ?>;">
</tr> <span class="material-icons"><?php echo esc_html( $material_icon ); ?></span>
</thead> </div>
<tbody> <div class="statpress-activity-info">
<?php if ( ! empty( $activities ) ) : ?> <h4 class="statpress-activity-title"><?php echo esc_html( $row->title ); ?></h4>
<?php foreach ( $activities as $row ) : ?> <p class="statpress-activity-meta">
<tr> <span><?php echo esc_html( date_i18n( 'd.m.Y', strtotime( $row->date ) ) ); ?></span>
<td><?php echo esc_html( date_i18n( 'd.m.Y', strtotime( $row->date ) ) ); ?></td> <span class="statpress-activity-meta-dot">•</span>
<td><?php echo esc_html( $row->title ); ?></td> <span><?php echo esc_html( $row->category_name ); ?></span>
<td><?php echo esc_html( $row->category_name ); ?></td> <?php if ( $row->equipment_name ) : ?>
<td><?php echo number_format( $row->distance, 2, ',', ' ' ); ?> km</td> <span class="statpress-activity-meta-dot">•</span>
<td><?php echo esc_html( $row->duration ); ?></td> <span><?php echo esc_html( $row->equipment_name ); ?></span>
<td><?php echo esc_html( $row->equipment_name ); ?></td> <?php endif; ?>
</tr> </p>
<?php if ( $row->avg_speed || $row->avg_heart_rate || $row->avg_cadence ) : ?> </div>
<tr class="statpress-activity-details-row"> <div class="statpress-activity-stats">
<td colspan="6" class="statpress-activity-details-cell"> <div class="statpress-stat-item"><span class="statpress-stat-label">Dystans</span><span class="statpress-stat-value"><?php echo number_format( $row->distance, 2, ',', ' ' ); ?> km</span></div>
<table class="statpress-nested-details-table"> <div class="statpress-stat-item"><span class="statpress-stat-label">Czas</span><span class="statpress-stat-value"><?php echo esc_html( $row->duration ); ?></span></div>
<thead> <?php if ( $row->avg_speed ) : ?><div class="statpress-stat-item"><span class="statpress-stat-label">Śr. prędkość</span><span class="statpress-stat-value"><?php echo number_format( $row->avg_speed, 1, ',', ' ' ); ?> km/h</span></div><?php endif; ?>
<tr> <?php if ( $row->avg_heart_rate ) : ?><div class="statpress-stat-item"><span class="statpress-stat-label">Śr. tętno</span><span class="statpress-stat-value"><?php echo esc_html( $row->avg_heart_rate ); ?> bpm</span></div><?php endif; ?>
<?php if ( $row->avg_speed ) { echo '<th>Śr. prędkość</th>'; } ?> </div>
<?php if ( $row->avg_heart_rate ) { echo '<th>Śr. tętno</th>'; } ?> </div>
<?php if ( $row->avg_cadence ) { echo '<th>Śr. kadencja</th>'; } ?> <?php endforeach; ?>
</tr> <?php else : ?>
</thead> <div class="statpress-summary-card">
<tbody> <p style="margin: 0; color: #5f6368;">Brak aktywności w tym miesiącu.</p>
<tr> </div>
<?php if ( $row->avg_speed ) { echo '<td>' . number_format( $row->avg_speed, 1, ',', ' ' ) . ' km/h</td>'; } ?> <?php endif; ?>
<?php if ( $row->avg_heart_rate ) { echo '<td>' . $row->avg_heart_rate . ' bpm</td>'; } ?> </div>
<?php if ( $row->avg_cadence ) { echo '<td>' . $row->avg_cadence . ' rpm</td>'; } ?>
</tr>
</tbody>
</table>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="6">Brak aktywności w tym miesiącu.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div> </div>
<?php <?php
// Zwrócenie zawartości bufora // Zwrócenie zawartości bufora
@@ -188,10 +205,10 @@ function statpress_single_activity_shortcode_handler( $atts ) {
// Funkcja pomocnicza do wyświetlania wiersza // Funkcja pomocnicza do wyświetlania wiersza
$render_row = function( $label, $value, $unit = '' ) { $render_row = function( $label, $value, $unit = '' ) {
if ( ! is_null( $value ) && '' !== $value && 0 != $value ) { if ( ! is_null( $value ) && '' !== $value && 0 != $value ) {
echo '<tr>'; echo '<div class="statpress-single-data-item">';
echo '<th>' . esc_html( $label ) . '</th>'; echo '<span class="statpress-single-data-label">' . esc_html( $label ) . '</span>';
echo '<td>' . esc_html( $value ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</td>'; echo '<span class="statpress-single-data-value">' . esc_html( $value ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</span>';
echo '</tr>'; echo '</div>';
} }
}; };
@@ -323,32 +340,36 @@ function statpress_single_activity_shortcode_handler( $atts ) {
} }
?> ?>
<div class="statpress-single-activity-shortcode" id="<?php echo esc_attr( $unique_id ); ?>"> <style>
<h4><?php echo esc_html( $activity->title ); ?></h4> .statpress-single-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15); padding: 24px; margin-bottom: 24px; font-family: 'Roboto', -apple-system, sans-serif; }
<p><em><?php echo esc_html( date_i18n( 'j F Y', strtotime( $activity->date ) ) ); ?></em></p> .statpress-single-header { border-bottom: 1px solid #e8eaed; padding-bottom: 16px; margin-bottom: 20px; }
.statpress-single-header h4 { margin: 0 0 8px 0; font-size: 22px; color: #202124; font-weight: 400; }
.statpress-single-header p { margin: 0; color: #5f6368; font-size: 14px; }
.statpress-single-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.statpress-single-data-item { display: flex; flex-direction: column; }
.statpress-single-data-label { font-size: 12px; color: #5f6368; text-transform: uppercase; font-weight: 500; margin-bottom: 4px; }
.statpress-single-data-value { font-size: 16px; color: #202124; font-weight: 500; }
</style>
<div class="statpress-single-activity-shortcode statpress-single-card" id="<?php echo esc_attr( $unique_id ); ?>">
<div class="statpress-single-columns-container"> <div class="statpress-single-header">
<div class="statpress-single-col"> <h4><?php echo esc_html( $activity->title ); ?></h4>
<table class="statpress-single-summary-table"> <p><?php echo esc_html( date_i18n( 'j F Y', strtotime( $activity->date ) ) ); ?></p>
<tbody> </div>
<?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
<?php $render_row( 'Czas trwania', $activity->duration ); ?> <div class="statpress-single-grid">
<?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?> <?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
<?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?> <?php $render_row( 'Czas trwania', $activity->duration ); ?>
</tbody> <?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?>
</table> <?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?>
</div> <?php $render_row( 'Kategoria', $activity->category_name ); ?>
<div class="statpress-single-col"> <?php $render_row( 'Sprzęt', $activity->equipment_name ); ?>
<table class="statpress-single-summary-table"> <?php if ( ! empty( $activity->strava_url ) ) : ?>
<tbody> <div class="statpress-single-data-item">
<?php $render_row( 'Kategoria', $activity->category_name ); ?> <span class="statpress-single-data-label">Strava</span>
<?php $render_row( 'Sprzęt', $activity->equipment_name ); ?> <span class="statpress-single-data-value"><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer" style="color: #1a73e8; text-decoration: none;">Zobacz aktywność</a></span>
<?php if ( ! empty( $activity->strava_url ) ) : ?>
<tr><th>Strava</th><td><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer">Zobacz aktywność</a></td></tr>
<?php endif; ?>
</tbody>
</table>
</div> </div>
<?php endif; ?>
</div> </div>
<?php if ( $has_gpx_data ) : ?> <?php if ( $has_gpx_data ) : ?>
+115
View File
@@ -43,6 +43,115 @@ add_action( 'admin_menu', 'statpress_add_admin_menu' );
add_action( 'admin_init', 'statpress_admin_init_setup' ); add_action( 'admin_init', 'statpress_admin_init_setup' );
add_action( 'admin_enqueue_scripts', 'statpress_enqueue_admin_styles' ); add_action( 'admin_enqueue_scripts', 'statpress_enqueue_admin_styles' );
add_action( 'admin_enqueue_scripts', 'statpress_enqueue_material_assets' );
function statpress_enqueue_material_assets() {
$screen = get_current_screen();
if ( $screen && strpos( $screen->id, 'statpress' ) !== false ) {
wp_enqueue_style( 'google-fonts-roboto', 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap', false );
wp_enqueue_style( 'google-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons', false );
}
}
add_action( 'admin_head', 'statpress_material_design_styles' );
function statpress_material_design_styles() {
$screen = get_current_screen();
if ( ! $screen || strpos( $screen->id, 'statpress' ) === false ) {
return;
}
?>
<style>
/* Zmiana głównej czcionki i nagłówków */
#wpbody-content { font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.wrap h1, .wrap h2 { font-weight: 400; color: #202124; }
/* Material Cards (karty) */
.wrap .postbox, .wrap .wp-list-table {
border: none !important;
border-radius: 8px;
box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15) !important;
background: #fff;
}
.wrap .postbox-header { border-bottom: 1px solid #dadce0; }
.wrap .postbox-header h2 { font-weight: 500; font-size: 16px; color: #202124; }
/* Tabele danych */
.wrap .wp-list-table { overflow: hidden; border-spacing: 0; }
.wrap .wp-list-table thead th { background: #f8f9fa; font-weight: 500; text-transform: uppercase; font-size: 12px; color: #5f6368; border-bottom: 1px solid #dadce0; padding: 16px 12px; }
.wrap .wp-list-table tbody td { border-bottom: 1px solid #e8eaed; padding: 14px 12px; vertical-align: middle; color: #3c4043; font-size: 14px; }
.wrap .wp-list-table.striped>tbody>:nth-child(odd), .wrap .wp-list-table>tbody>:nth-child(odd) { background-color: #ffffff; }
.wrap .wp-list-table tbody tr:hover { background-color: #f1f3f4; }
/* Przyciski */
.wrap .button.button-primary {
background: #1a73e8 !important; /* Google Blue */
border: none !important;
border-radius: 4px !important;
box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15) !important;
color: #fff !important;
text-transform: uppercase;
font-weight: 500;
letter-spacing: 0.25px;
transition: all 0.2s;
text-shadow: none !important;
padding: 4px 16px !important;
}
.wrap .button.button-primary:hover, .wrap .button.button-primary:focus {
background: #174ea6 !important;
box-shadow: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15) !important;
transform: translateY(-1px);
}
.wrap .button {
border-radius: 4px;
text-transform: uppercase;
font-weight: 500;
font-size: 13px;
border: 1px solid #dadce0 !important;
color: #1a73e8 !important;
background: transparent;
transition: all 0.2s;
box-shadow: none !important;
padding: 4px 16px;
}
.wrap .button:hover { background: #f8f9fa !important; border-color: #dadce0 !important; color: #174ea6 !important; }
.wrap .button-link-delete { color: #d93025 !important; border-color: #fce8e6 !important; background: #fce8e6 !important; }
.wrap .button-link-delete:hover { background: #fad2cf !important; border-color: #fad2cf !important; color: #b31412 !important; }
/* Pola formularzy (Inputs) */
.wrap .form-table th { font-weight: 500; color: #3c4043; }
.wrap input[type="text"], .wrap input[type="number"], .wrap input[type="date"], .wrap input[type="time"], .wrap select, .wrap textarea, .wrap input[type="url"] {
border: 1px solid #dadce0;
border-radius: 4px;
padding: 8px 12px;
box-shadow: none;
transition: border-color 0.2s, box-shadow 0.2s;
color: #202124;
font-size: 14px;
background: #fff;
}
.wrap input:focus, .wrap select:focus, .wrap textarea:focus {
border-color: #1a73e8;
box-shadow: inset 0 0 0 2px #1a73e8;
outline: none;
}
/* Zakładki (Tabs) */
.wrap .nav-tab-wrapper { border-bottom: 1px solid #dadce0; margin-bottom: 20px; padding-top: 10px; }
.wrap .nav-tab { border: none; background: transparent; font-weight: 500; text-transform: uppercase; color: #5f6368; padding: 12px 16px; margin: 0; font-size: 14px; }
.wrap .nav-tab:hover { background: #f1f3f4; color: #202124; }
.wrap .nav-tab-active, .wrap .nav-tab-active:hover { border-bottom: 3px solid #1a73e8; color: #1a73e8; background: transparent; }
/* Notyfikacje */
.wrap .notice { border-radius: 8px; border-left-width: 6px; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.3); border-color: #1a73e8; background: #fff; margin-bottom: 20px; }
.wrap .notice-success { border-color: #188038; }
.wrap .notice-error { border-color: #d93025; }
.wrap .notice-warning { border-color: #f9ab00; }
/* Inne */
.wrap hr { border: 0; height: 1px; background: #dadce0; margin: 24px 0; }
</style>
<?php
}
// --- 3. REST API --- // --- 3. REST API ---
$api_options = get_option( 'statpress_api_options' ); $api_options = get_option( 'statpress_api_options' );
if ( ! empty( $api_options['enable_api'] ) ) { if ( ! empty( $api_options['enable_api'] ) ) {
@@ -57,6 +166,12 @@ require_once STATPRESS_PLUGIN_DIR . 'includes/frontend/shortcodes.php';
add_action( 'wp_enqueue_scripts', 'statpress_enqueue_frontend_assets' ); add_action( 'wp_enqueue_scripts', 'statpress_enqueue_frontend_assets' );
add_action( 'init', 'statpress_register_shortcode' ); add_action( 'init', 'statpress_register_shortcode' );
add_action( 'wp_enqueue_scripts', 'statpress_enqueue_frontend_material_assets' );
function statpress_enqueue_frontend_material_assets() {
wp_enqueue_style( 'google-fonts-roboto', 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap', false );
wp_enqueue_style( 'google-material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons', false );
}
// --- 5. MIGRACJA DANYCH (jednorazowa) --- // --- 5. MIGRACJA DANYCH (jednorazowa) ---
add_action( 'admin_init', 'statpress_handle_data_migration' ); add_action( 'admin_init', 'statpress_handle_data_migration' );
add_action( 'admin_init', 'statpress_handle_admin_tools' ); add_action( 'admin_init', 'statpress_handle_admin_tools' );