diff --git a/CHANGELOG.md b/CHANGELOG.md
index 932259d51..35e87ebb0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,13 @@
Fixed:
* Duplicate weekly suggested tasks.
-* Fixed the REST API endpoint for getting stats.
+* The REST API endpoint for getting stats.
+* Scrollable monthly badges widget height on page load.
+* 2026 monthly badges showing up
+
+Enhancements:
+
+* Refocus the "add new task" input after ToDo item is added.
= 1.0.1 =
diff --git a/assets/css/dashboard-widgets/score.css b/assets/css/dashboard-widgets/score.css
index 97d43f0f8..4d4cfbf5c 100644
--- a/assets/css/dashboard-widgets/score.css
+++ b/assets/css/dashboard-widgets/score.css
@@ -1,6 +1,7 @@
#progress_planner_dashboard_widget_score {
.prpl-dashboard-widget {
+ padding-top: 5px; /* Total 16px top spacing */
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
grid-gap: calc(var(--prpl-gap) / 2);
@@ -36,12 +37,12 @@
}
.prpl-dashboard-widget-footer {
- margin-top: 1em;
- padding-top: 1em;
+ margin-top: 1rem;
+ padding-top: 1rem;
border-top: 1px solid #c3c4c7; /* same color as the one WP-Core uses */
font-size: var(--prpl-font-size-base);
display: flex;
- gap: 1em;
+ gap: 0.5rem;
align-items: center;
}
}
diff --git a/assets/images/logo_progress_planner_pro.svg b/assets/images/logo_progress_planner_pro.svg
new file mode 100644
index 000000000..1532dfc31
--- /dev/null
+++ b/assets/images/logo_progress_planner_pro.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/js/web-components/prpl-gauge.js b/assets/js/web-components/prpl-gauge.js
index 0ccc0a12e..c82dec531 100644
--- a/assets/js/web-components/prpl-gauge.js
+++ b/assets/js/web-components/prpl-gauge.js
@@ -16,6 +16,9 @@ customElements.define(
start: '270deg',
cutout: '57%',
contentFontSize: 'var(--prpl-font-size-6xl)',
+ contentPadding:
+ 'var(--prpl-padding) var(--prpl-padding) calc(var(--prpl-padding) * 2) var(--prpl-padding)',
+ marginBottom: 'var(--prpl-padding)',
},
content = ''
) {
@@ -41,11 +44,18 @@ customElements.define(
props.cutout = this.getAttribute( 'cutout' ) || props.cutout;
props.contentFontSize =
this.getAttribute( 'contentFontSize' ) || props.contentFontSize;
+ props.contentPadding =
+ this.getAttribute( 'contentPadding' ) || props.contentPadding;
+ props.marginBottom =
+ this.getAttribute( 'marginBottom' ) || props.marginBottom;
this.innerHTML = `
-
+ }; border-radius:var(--prpl-border-radius-big); aspect-ratio: 2 / 1; overflow: hidden; position: relative; margin-bottom: ${
+ props.marginBottom
+ };">
{
);
document.getElementById( 'new-todo-content' ).value = '';
+
+ // Focus the new task input element.
+ document.getElementById( 'new-todo-content' ).focus();
} );
} );
diff --git a/classes/actions/class-content.php b/classes/actions/class-content.php
index 4291c1e8c..3f299e351 100644
--- a/classes/actions/class-content.php
+++ b/classes/actions/class-content.php
@@ -27,11 +27,9 @@ public function __construct() {
* @return void
*/
public function register_hooks() {
- // Add activity when a post is updated.
- \add_action( 'post_updated', [ $this, 'post_updated' ], 10, 2 );
- // Add activity when a post is added.
- \add_action( 'wp_insert_post', [ $this, 'insert_post' ], 10, 2 );
+ // Add activity when a post is added or updated.
+ \add_action( 'wp_insert_post', [ $this, 'insert_post' ], 10, 3 );
\add_action( 'transition_post_status', [ $this, 'transition_post_status' ], 10, 3 );
// Add activity when a post is trashed or deleted.
@@ -40,84 +38,41 @@ public function register_hooks() {
}
/**
- * Post updated.
+ * Insert a post.
*
- * Runs on post_updated hook.
+ * Runs on wp_insert_post hook.
*
* @param int $post_id The post ID.
* @param \WP_Post $post The post object.
- *
+ * @param bool $update Whether this is an update.
* @return void
*/
- public function post_updated( $post_id, $post ) {
+ public function insert_post( $post_id, $post, $update ) {
// Bail if we should skip saving.
if ( $this->should_skip_saving( $post ) ) {
return;
}
- // Reset the words count.
- \progress_planner()->get_settings()->set( [ 'word_count', $post_id ], false );
-
- if ( 'publish' !== $post->post_status ) {
- return;
- }
-
- // Check if there is an update activity for this post, on this date.
- $existing = \progress_planner()->get_query()->query_activities(
- [
- 'category' => 'content',
- 'type' => 'update',
- 'data_id' => (string) $post_id,
- 'start_date' => \progress_planner()->get_date()->get_datetime_from_mysql_date( $post->post_modified )->modify( '-12 hours' ),
- 'end_date' => \progress_planner()->get_date()->get_datetime_from_mysql_date( $post->post_modified )->modify( '+12 hours' ),
- ],
- 'RAW'
- );
+ // Set the type of activity.
+ $type = $update ? 'update' : 'publish';
- // If there is an update activity for this post, on this date, bail.
- if ( ! empty( $existing ) ) {
- return;
- }
-
- $this->add_post_activity( $post, 'update' );
- }
-
- /**
- * Insert a post.
- *
- * Runs on wp_insert_post hook.
- *
- * @param int $post_id The post ID.
- * @param \WP_Post $post The post object.
- * @return void
- */
- public function insert_post( $post_id, $post ) {
- // Bail if we should skip saving.
- if ( $this->should_skip_saving( $post ) ) {
- return;
+ // Reset the words count if it's an update.
+ if ( 'update' === $type ) {
+ \progress_planner()->get_settings()->set( [ 'word_count', $post_id ], false );
}
+ // Bail if the post is not published.
if ( 'publish' !== $post->post_status ) {
return;
}
- // Check if there is a publish activity for this post.
- $existing = \progress_planner()->get_query()->query_activities(
- [
- 'category' => 'content',
- 'type' => 'publish',
- 'data_id' => (string) $post_id,
- ],
- 'RAW'
- );
-
- // If there is a publish activity for this post, bail.
- if ( ! empty( $existing ) ) {
+ // Bail if there is a recent activity for this post.
+ if ( $this->is_there_recent_activity( $post, $type ) ) {
return;
}
- // Add a publish activity.
- $this->add_post_activity( $post, 'publish' );
+ // Finally add an activity.
+ $this->add_post_activity( $post, $type );
}
/**
@@ -138,6 +93,11 @@ public function transition_post_status( $new_status, $old_status, $post ) {
return;
}
+ // Bail if there is a recent activity for this post.
+ if ( $this->is_there_recent_activity( $post, $new_status ) ) {
+ return;
+ }
+
// Add activity.
$this->add_post_activity( $post, $new_status === 'publish' ? 'publish' : 'update' );
}
@@ -236,6 +196,38 @@ private function should_skip_saving( $post ) {
return false;
}
+ /**
+ * Check if there is a recent activity for this post.
+ *
+ * @param \WP_Post $post The post object.
+ * @param string $type The type of activity (ie publish, update, trash, delete etc).
+ *
+ * @return bool
+ */
+ private function is_there_recent_activity( $post, $type ) {
+ // Query arguments.
+ $query_args = [
+ 'category' => 'content',
+ 'type' => $type,
+ 'data_id' => (string) $post->ID,
+ ];
+
+ // If it's an update add the start and end date. We don't want to add multiple update activities for the same post on the same day.
+ if ( 'update' === $type ) {
+ $query_args['start_date'] = \progress_planner()->get_date()->get_datetime_from_mysql_date( $post->post_modified )->modify( '-12 hours' );
+ $query_args['end_date'] = \progress_planner()->get_date()->get_datetime_from_mysql_date( $post->post_modified )->modify( '+12 hours' );
+ }
+
+ // Check if there is an activity for this post.
+ $existing = \progress_planner()->get_query()->query_activities(
+ $query_args,
+ 'RAW'
+ );
+
+ // If there is an activity for this post, bail.
+ return ! empty( $existing ) ? true : false;
+ }
+
/**
* Add an update activity.
*
diff --git a/classes/badges/class-monthly.php b/classes/badges/class-monthly.php
index 85092b6ef..06a0af062 100644
--- a/classes/badges/class-monthly.php
+++ b/classes/badges/class-monthly.php
@@ -57,7 +57,7 @@ public static function init_badges() {
$start_date = $activation_date->modify( 'first day of this month' );
// Year when plugin was released.
- $end_date = ( 2024 === (int) $start_date->format( 'Y' ) )
+ $end_date = ( 2024 === (int) $start_date->format( 'Y' ) && 2024 === (int) \gmdate( 'Y' ) )
? new \DateTime( 'last day of December next year' )
: new \DateTime( 'last day of December this year' );
diff --git a/classes/widgets/class-suggested-tasks.php b/classes/widgets/class-suggested-tasks.php
index 0ceb62d22..424a34d7d 100644
--- a/classes/widgets/class-suggested-tasks.php
+++ b/classes/widgets/class-suggested-tasks.php
@@ -89,6 +89,8 @@ public function register_scripts() {
public function enqueue_scripts() {
$handle = 'progress-planner-' . $this->id;
+ $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
+
// Enqueue the script.
\wp_enqueue_script( $handle );
@@ -123,9 +125,10 @@ public function enqueue_scripts() {
$handle,
'progressPlannerSuggestedTasks',
[
- 'ajaxUrl' => \admin_url( 'admin-ajax.php' ),
- 'nonce' => \wp_create_nonce( 'progress_planner' ),
- 'tasks' => $tasks,
+ 'ajaxUrl' => \admin_url( 'admin-ajax.php' ),
+ 'nonce' => \wp_create_nonce( 'progress_planner' ),
+ 'tasks' => $tasks,
+ 'maxItems' => $current_screen && 'dashboard' === $current_screen->id ? 3 : 5,
]
);
}
diff --git a/views/admin-page-header.php b/views/admin-page-header.php
index 0d0d43fb6..493fc10b0 100644
--- a/views/admin-page-header.php
+++ b/views/admin-page-header.php
@@ -19,7 +19,13 @@
?>