Singla activity

This commit is contained in:
2026-04-22 13:25:17 +02:00
parent 27fc4829e0
commit 5366218697
2 changed files with 48 additions and 51 deletions
+8 -12
View File
@@ -26,18 +26,6 @@
margin-bottom: 0;
}
/* Kontener dla szczegółów aktywności */
#statpress-details-container {
display: flex;
flex-wrap: wrap;
gap: 2%;
}
/* Szczegóły aktywności */
.statpress-details-col {
flex: 1 1 48%; /* Pozwala na elastyczne dopasowanie, z bazową szerokością 48% */
min-width: 300px; /* Zapobiega zbytniemu ściskaniu kolumn na mniejszych ekranach */
}
/* Chart Controls */
.statpress-chart-controls {
display: flex;
@@ -202,5 +190,13 @@
.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; }
.statpress-progress-bar-container.small .statpress-progress-bar { line-height: 12px; font-size: 0; }
/* Grid danych dla widoków (np. szczegóły aktywności) */
.statpress-single-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 24px; }
.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: 15px; color: #202124; font-weight: 500; }
.statpress-single-data-value a { color: #1a73e8; text-decoration: none; }
.statpress-single-data-value a:hover { text-decoration: underline; }
/* Inne */
.wrap hr { border: 0; height: 1px; background: #dadce0; margin: 24px 0; }
+40 -39
View File
@@ -38,12 +38,12 @@ function statpress_view_activity_page() {
}
// Funkcja pomocnicza do wyświetlania wiersza, jeśli wartość istnieje
$render_row = function( $label, $value, $unit = '' ) {
$render_row = function( $label, $value, $unit = '', $is_html = false ) {
if ( ! is_null( $value ) && '' !== $value ) {
echo '<tr>';
echo '<th scope="row">' . esc_html( $label ) . '</th>';
echo '<td>' . esc_html( $value ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</td>';
echo '</tr>';
echo '<div class="statpress-single-data-item">';
echo '<span class="statpress-single-data-label">' . esc_html( $label ) . '</span>';
echo '<span class="statpress-single-data-value">' . ( $is_html ? wp_kses_post( $value ) : esc_html( $value ) ) . ( $unit ? ' ' . esc_html( $unit ) : '' ) . '</span>';
echo '</div>';
}
};
@@ -169,46 +169,47 @@ function statpress_view_activity_page() {
<div class="postbox" style="margin-top: 20px;">
<div class="postbox-header"><h2 class="hndle">Podsumowanie</h2></div>
<div class="inside">
<div id="statpress-details-container">
<div class="statpress-details-col">
<h3>Główne dane</h3>
<table class="form-table">
<?php $render_row( 'Kategoria', $activity->category_name ); ?>
<?php $render_row( 'Data', $activity->date ); ?>
<?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
<?php $render_row( 'Czas trwania', $activity->duration ); ?>
<?php $render_row( 'Spalone kalorie', $activity->calories, 'kcal' ); ?>
<?php $render_row( 'Typ wydarzenia', $activity->event_type_name ); ?>
<?php $render_row( 'Sprzęt', $activity->equipment_name ); ?>
</table>
</div>
<div class="statpress-details-col">
<h3>Dane szczegółowe</h3>
<table class="form-table">
<?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?>
<?php $render_row( 'Maksymalna prędkość', number_format( $activity->max_speed, 1, ',', ' ' ), 'km/h' ); ?>
<?php $render_row( 'Średnie tętno', $activity->avg_heart_rate, 'bpm' ); ?>
<?php $render_row( 'Maksymalne tętno', $activity->max_heart_rate, 'bpm' ); ?>
<?php $render_row( 'Średni rytm', $activity->avg_cadence, 'rpm' ); ?>
<?php $render_row( 'Maksymalny rytm', $activity->max_cadence, 'rpm' ); ?>
<?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?>
<?php $render_row( 'Suma spadków', $activity->total_elevation_loss, 'm' ); ?>
<?php $render_row( 'Minimalna wysokość', $activity->min_altitude, 'm n.p.m.' ); ?>
<?php $render_row( 'Maksymalna wysokość', $activity->max_altitude, 'm n.p.m.' ); ?>
</table>
</div>
<h3 style="margin-top: 0; color: #202124;">Główne dane</h3>
<div class="statpress-single-grid">
<?php $render_row( 'Kategoria', $activity->category_name ); ?>
<?php $render_row( 'Data', date_i18n( 'j F Y', strtotime( $activity->date ) ) ); ?>
<?php $render_row( 'Dystans', number_format( $activity->distance, 2, ',', ' ' ), 'km' ); ?>
<?php $render_row( 'Czas trwania', $activity->duration ); ?>
<?php $render_row( 'Spalone kalorie', $activity->calories, 'kcal' ); ?>
<?php $render_row( 'Typ wydarzenia', $activity->event_type_name ); ?>
<?php $render_row( 'Sprzęt', $activity->equipment_name ); ?>
</div>
<hr>
<h3>Notatki i linki</h3>
<table class="form-table">
<?php $render_row( 'Komentarz', nl2br( $activity->comment ) ); ?>
<h3 style="color: #202124;">Dane szczegółowe</h3>
<div class="statpress-single-grid">
<?php $render_row( 'Średnia prędkość', number_format( $activity->avg_speed, 1, ',', ' ' ), 'km/h' ); ?>
<?php $render_row( 'Maksymalna prędkość', number_format( $activity->max_speed, 1, ',', ' ' ), 'km/h' ); ?>
<?php $render_row( 'Średnie tętno', $activity->avg_heart_rate, 'bpm' ); ?>
<?php $render_row( 'Maksymalne tętno', $activity->max_heart_rate, 'bpm' ); ?>
<?php $render_row( 'Średni rytm', $activity->avg_cadence, 'rpm' ); ?>
<?php $render_row( 'Maksymalny rytm', $activity->max_cadence, 'rpm' ); ?>
<?php $render_row( 'Suma wzniosów', $activity->total_elevation_gain, 'm' ); ?>
<?php $render_row( 'Suma spadków', $activity->total_elevation_loss, 'm' ); ?>
<?php $render_row( 'Minimalna wysokość', $activity->min_altitude, 'm n.p.m.' ); ?>
<?php $render_row( 'Maksymalna wysokość', $activity->max_altitude, 'm n.p.m.' ); ?>
</div>
<hr>
<h3 style="color: #202124;">Notatki i linki</h3>
<div class="statpress-single-grid">
<?php $render_row( 'Komentarz', nl2br( esc_html( $activity->comment ) ), '', true ); ?>
<?php if ( ! empty( $activity->strava_url ) ) : ?>
<tr><th scope="row">Strava</th><td><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer">Zobacz aktywność na Strava</a></td></tr>
<div class="statpress-single-data-item">
<span class="statpress-single-data-label">Strava</span>
<span class="statpress-single-data-value"><a href="<?php echo esc_url( $activity->strava_url ); ?>" target="_blank" rel="noopener noreferrer">Zobacz aktywność na Strava</a></span>
</div>
<?php endif; ?>
<?php if ( ! empty( $activity->gpx_url ) ) : ?>
<tr><th scope="row">Plik GPX</th><td><a href="<?php echo esc_url( $activity->gpx_url ); ?>" target="_blank">Pobierz plik GPX</a></td></tr>
<div class="statpress-single-data-item">
<span class="statpress-single-data-label">Plik GPX</span>
<span class="statpress-single-data-value"><a href="<?php echo esc_url( $activity->gpx_url ); ?>" target="_blank">Pobierz plik GPX</a></span>
</div>
<?php endif; ?>
</table>
</div>
<?php if ( $has_gpx_data ) : ?>
<hr>