Skip to content

Commit a0773b0

Browse files
committed
Barbell icon
1 parent 7f9fc79 commit a0773b0

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

assets/css/admin-style.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* BenchPress icon - Default color */
2+
#adminmenu .toplevel_page_benchpress .wp-menu-image img {
3+
width: 20px;
4+
height: 20px;
5+
color: rgb(255,255,255,0.8);
6+
transition: color 0.3s ease;
7+
padding: 7px 0;
8+
}
9+
10+
/* BenchPress icon - Hover color */
11+
#adminmenu .toplevel_page_benchpress:hover .wp-menu-image img {
12+
color: #FFF;
13+
}

assets/img/barbell-icon.svg

Lines changed: 1 addition & 0 deletions
Loading

benchpress.php

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
die;
2828
}
2929

30+
// Track the starting time of the plugin.
31+
$benchpress_start_time = microtime( true );
32+
3033
// Define constants.
3134
define( 'BENCHPRESS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
3235
define( 'BENCHPRESS_VERSION', '1.0.0' );
@@ -85,8 +88,8 @@ function benchpress_admin_menu() {
8588
'manage_options',
8689
'benchpress',
8790
'benchpress_render_page',
88-
'dashicons-performance',
89-
5
91+
plugin_dir_url( __FILE__ ) . 'assets/img/barbell-icon.svg',
92+
2
9093
);
9194

9295
add_submenu_page(
@@ -152,16 +155,22 @@ function benchpress_render_page() {
152155
return;
153156
}
154157

158+
global $benchpress_start_time;
159+
$benchpress_execution_time = microtime( true ) - $benchpress_start_time;
160+
$formatted_execution_time = number_format( $benchpress_execution_time, 4 );
161+
155162
echo '<div class="wrap"><h1>' . esc_html__( 'BenchPress', 'benchpress' );
156163
echo ' <button id="benchpress-snapshot-btn" class="button"><span class="dashicons dashicons-camera"></span> ' . esc_html__( 'Save Snapshot', 'benchpress' ) . '</button>';
157164
echo ' <button id="benchpress-refresh-btn" class="button"><span class="dashicons dashicons-update"></span> ' . esc_html__( 'Refresh Tests', 'benchpress' ) . '</button>';
158-
echo '</h1><hr />';
165+
echo '</h1>';
166+
echo '<hr />';
159167
echo '<p><a href="https://robertdevore.com/benchpress-documentation/" target="_blank">' . esc_html__( 'Documentation', 'benchpress' ) . '</a> &middot; <a href="https://robertdevore.com/contact/" target="_blank">' . esc_html__( 'Support', 'benchpress' ) . '</a> &middot; <a href="https://robertdevore.com/wordpress-and-woocommerce-plugins/" target="_blank">' . esc_html__( 'More Plugins', 'benchpress' ) . '</a></p>';
160168

161169
echo '<div id="benchpress-results">';
162170
$table = new BenchPress_Table();
163171
$table->prepare_items();
164172
$table->display();
173+
echo '<p>' . sprintf( esc_html__( 'Total Execution Time: %s seconds', 'benchpress' ), $formatted_execution_time ) . '</p>';
165174
echo '</div></div>';
166175
}
167176

@@ -354,6 +363,26 @@ function benchpress_enqueue_assets() {
354363
}
355364
add_action( 'admin_enqueue_scripts', 'benchpress_enqueue_assets' );
356365

366+
/**
367+
* Enqueue custom admin styles for BenchPress plugin.
368+
*
369+
* This function loads the custom CSS file for the BenchPress plugin's
370+
* admin interface. It adds styling to the BenchPress menu icon in
371+
* the WordPress® admin sidebar, including hover effects.
372+
*
373+
* @since 1.0.0
374+
* @return void
375+
*/
376+
function benchpress_enqueue_admin_styles() {
377+
wp_enqueue_style(
378+
'benchpress-admin-style',
379+
plugin_dir_url( __FILE__ ) . 'assets/css/admin-style.css',
380+
[],
381+
BENCHPRESS_VERSION
382+
);
383+
}
384+
add_action( 'admin_enqueue_scripts', 'benchpress_enqueue_admin_styles' );
385+
357386
/**
358387
* Handles AJAX request to refresh benchmark results.
359388
*

0 commit comments

Comments
 (0)