From 9b4d1b91edad3a17738877f263470734efa558ee Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 25 Dec 2024 13:28:29 +0100 Subject: [PATCH 1/8] fallback for remote images --- assets/js/web-components/prpl-badge.js | 3 +++ classes/admin/class-scripts.php | 1 + classes/class-base.php | 12 ++++++++++++ views/page-widgets/latest-badge.php | 1 + 4 files changed, 17 insertions(+) diff --git a/assets/js/web-components/prpl-badge.js b/assets/js/web-components/prpl-badge.js index 851d07a98..dda9aeef0 100644 --- a/assets/js/web-components/prpl-badge.js +++ b/assets/js/web-components/prpl-badge.js @@ -20,6 +20,9 @@ customElements.define( }" alt="Badge" ${ false === complete ? 'style="filter: grayscale(1);opacity: 0.25;"' : '' } + onerror="this.onerror=null;this.src='${ + progressPlannerBadge.placeholderImageUrl.badge + }';" /> `; } diff --git a/classes/admin/class-scripts.php b/classes/admin/class-scripts.php index 04e72d4fe..6c593f56c 100644 --- a/classes/admin/class-scripts.php +++ b/classes/admin/class-scripts.php @@ -102,6 +102,7 @@ public function localize_script( $handle ) { 'progressPlannerBadge', [ 'remoteServerRootUrl' => \progress_planner()->get_remote_server_root_url(), + 'placeholderImageUrl' => \progress_planner()->get_placeholder_image_url(), ] ); break; diff --git a/classes/class-base.php b/classes/class-base.php index 91d037989..9033a9274 100644 --- a/classes/class-base.php +++ b/classes/class-base.php @@ -144,6 +144,18 @@ public function get_remote_server_root_url() { : 'https://progressplanner.com'; } + /** + * Get the placeholder image URL. + * + * @return array + */ + public function get_placeholder_image_url() { + return [ + 'default' => 'https://placehold.co/400x300', + 'badge' => 'https://placehold.co/244x150', + ]; + } + /** * Get the activation date. * diff --git a/views/page-widgets/latest-badge.php b/views/page-widgets/latest-badge.php index 2bde8bac7..7ef3ac702 100644 --- a/views/page-widgets/latest-badge.php +++ b/views/page-widgets/latest-badge.php @@ -37,6 +37,7 @@ alt="get_name() ); ?>" width="1200" height="675" + onerror="this.onerror=null;this.src='get_placeholder_image_url()['default'] ); ?>';" /> is_local_site() ) : ?> Date: Wed, 25 Dec 2024 13:37:49 +0100 Subject: [PATCH 2/8] add background color as fallback for blog images --- assets/css/page-widgets/whats-new.css | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/css/page-widgets/whats-new.css b/assets/css/page-widgets/whats-new.css index ed473c3b4..e03e63b45 100644 --- a/assets/css/page-widgets/whats-new.css +++ b/assets/css/page-widgets/whats-new.css @@ -57,4 +57,5 @@ border-radius: var(--prpl-border-radius); box-shadow: 5px 5px 5px var(--prpl-color-gray-2); border: 1px solid var(--prpl-color-gray-2); + background-color: var(--prpl-color-gray-1); /* Fallback, if remote host image is not accessible */ } From bea207ae463e6566180514cd7a675e8504340cd8 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 25 Dec 2024 13:52:43 +0100 Subject: [PATCH 3/8] default image size --- classes/class-base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-base.php b/classes/class-base.php index 9033a9274..9c0dc9a22 100644 --- a/classes/class-base.php +++ b/classes/class-base.php @@ -151,7 +151,7 @@ public function get_remote_server_root_url() { */ public function get_placeholder_image_url() { return [ - 'default' => 'https://placehold.co/400x300', + 'default' => 'https://placehold.co/1200x675', 'badge' => 'https://placehold.co/244x150', ]; } From 80fa3683a7f5b3ecf34fcb1b5ca13332b698b89b Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Fri, 3 Jan 2025 09:46:13 +0100 Subject: [PATCH 4/8] refocus on the "new task" input after the item was added --- assets/js/widgets/todo.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/assets/js/widgets/todo.js b/assets/js/widgets/todo.js index f028f86f7..570661929 100644 --- a/assets/js/widgets/todo.js +++ b/assets/js/widgets/todo.js @@ -50,11 +50,6 @@ const progressPlannerInjectTodoItem = ( content, done, addToStart, save ) => { document.getElementById( 'todo-list' ).appendChild( todoItemElement ); } - // Focus the new task's content element after it is added to the DOM - setTimeout( () => { - todoItemElement.querySelector( 'input[type="checkbox"]' ).focus(); - }, 0 ); - if ( save ) { progressPlannerSaveTodoList(); } @@ -91,5 +86,8 @@ prplDocumentReady( () => { ); document.getElementById( 'new-todo-content' ).value = ''; + + // Focus the new task input element. + document.getElementById( 'new-todo-content' ).focus(); } ); } ); From 8b5240c7c0502ec489acab640d0e30cb9fa1cc18 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Fri, 3 Jan 2025 09:53:11 +0100 Subject: [PATCH 5/8] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932259d51..9f4841ba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ Fixed: * Duplicate weekly suggested tasks. * Fixed the REST API endpoint for getting stats. +Enhancements: + +* Refocus the "add new task" input after ToDo item is added. + = 1.0.1 = Fixed: From 7d489b7ffc388f35ee0ebdb3a49c51c37d302d89 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Mon, 6 Jan 2025 12:39:44 +0100 Subject: [PATCH 6/8] replace image with a SVG placeholder --- assets/js/web-components/prpl-badge.js | 2 +- classes/admin/class-scripts.php | 2 +- classes/class-base.php | 14 +++++++------- views/page-widgets/latest-badge.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/js/web-components/prpl-badge.js b/assets/js/web-components/prpl-badge.js index dda9aeef0..9bba6b950 100644 --- a/assets/js/web-components/prpl-badge.js +++ b/assets/js/web-components/prpl-badge.js @@ -21,7 +21,7 @@ customElements.define( alt="Badge" ${ false === complete ? 'style="filter: grayscale(1);opacity: 0.25;"' : '' } onerror="this.onerror=null;this.src='${ - progressPlannerBadge.placeholderImageUrl.badge + progressPlannerBadge.placeholderImageUrl }';" /> `; diff --git a/classes/admin/class-scripts.php b/classes/admin/class-scripts.php index 6c593f56c..a14a736d4 100644 --- a/classes/admin/class-scripts.php +++ b/classes/admin/class-scripts.php @@ -102,7 +102,7 @@ public function localize_script( $handle ) { 'progressPlannerBadge', [ 'remoteServerRootUrl' => \progress_planner()->get_remote_server_root_url(), - 'placeholderImageUrl' => \progress_planner()->get_placeholder_image_url(), + 'placeholderImageUrl' => \progress_planner()->get_placeholder_svg(), ] ); break; diff --git a/classes/class-base.php b/classes/class-base.php index 9c0dc9a22..59d2f8b56 100644 --- a/classes/class-base.php +++ b/classes/class-base.php @@ -145,15 +145,15 @@ public function get_remote_server_root_url() { } /** - * Get the placeholder image URL. + * Get the placeholder SVG. * - * @return array + * @param int $width The width of the placeholder image. + * @param int $height The height of the placeholder image. + * + * @return string */ - public function get_placeholder_image_url() { - return [ - 'default' => 'https://placehold.co/1200x675', - 'badge' => 'https://placehold.co/244x150', - ]; + public function get_placeholder_svg( $width = 1200, $height = 675 ) { + return 'data:image/svg+xml;base64,' . base64_encode( sprintf( 'progressplanner.com', $width, $height, ( $width - 4 ), ( $height - 4 ) ) ); } /** diff --git a/views/page-widgets/latest-badge.php b/views/page-widgets/latest-badge.php index 7ef3ac702..70890a495 100644 --- a/views/page-widgets/latest-badge.php +++ b/views/page-widgets/latest-badge.php @@ -37,7 +37,7 @@ alt="get_name() ); ?>" width="1200" height="675" - onerror="this.onerror=null;this.src='get_placeholder_image_url()['default'] ); ?>';" + onerror="this.onerror=null;this.src='get_placeholder_svg() ); ?>';" /> is_local_site() ) : ?> Date: Mon, 6 Jan 2025 12:52:57 +0100 Subject: [PATCH 7/8] Get ready for v 1.0.2 --- CHANGELOG.md | 10 +++++----- package.json | 2 +- progress-planner.php | 2 +- readme.txt | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35e87ebb0..f185ca45d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,14 @@ Fixed: -* Duplicate weekly suggested tasks. -* The REST API endpoint for getting stats. -* Scrollable monthly badges widget height on page load. -* 2026 monthly badges showing up +* Remove duplicated weekly suggested tasks. +* The REST API endpoint for getting stats was broken, causing the weekly emails not to work. +* Scrollable monthly badges widget was the wrong height on page load. +* 2026 monthly badges were showing up and shouldn't (yet). Enhancements: -* Refocus the "add new task" input after ToDo item is added. +* Refocus the "add new task" input after a to-do item is added. = 1.0.1 = diff --git a/package.json b/package.json index 8a24be634..82cdd397f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "progress-planner", - "version": "1.0.0", + "version": "1.0.2", "private": true, "description": "WordPress plugin", "author": "Team Emilia Projects", diff --git a/progress-planner.php b/progress-planner.php index 1eedc7f47..6cdad75b8 100644 --- a/progress-planner.php +++ b/progress-planner.php @@ -9,7 +9,7 @@ * Description: A plugin to help you fight procrastination and get things done. * Requires at least: 6.3 * Requires PHP: 7.4 - * Version: 1.0.1 + * Version: 1.0.2 * Author: Team Emilia Projects * Author URI: https://prpl.fyi/about * License: GPL-3.0+ diff --git a/readme.txt b/readme.txt index d560223e4..827a9ac55 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: planning, maintenance, writing, blogging Requires at least: 6.3 Tested up to: 6.7 Requires PHP: 7.4 -Stable tag: 1.0.1 +Stable tag: 1.0.2 License: GPL3+ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -78,6 +78,19 @@ https://youtu.be/e1bmxZYyXFY == Changelog == += 1.0.2 = + +Fixed: + +* Remove duplicated weekly suggested tasks. +* The REST API endpoint for getting stats was broken, causing the weekly emails not to work. +* Scrollable monthly badges widget was the wrong height on page load. +* 2026 monthly badges were showing up and shouldn't (yet). + +Enhancements: + +* Refocus the "add new task" input after a to-do item is added. + = 1.0.1 = Fixed: From 61b454acea55c713caf2eb69738b27d27f0831da Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Mon, 6 Jan 2025 13:06:59 +0100 Subject: [PATCH 8/8] Update image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bace46ec5..f588507af 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ # Progress Planner -![Progress Planner - Powering your website's progress](https://repository-images.githubusercontent.com/753019432/24c42936-cd56-4192-8f28-503073087bd1) +![Progress Planner - Powering your website's progress](https://repository-images.githubusercontent.com/753019432/5ca27f0c-4380-4b01-a18c-1c7633262659) ## What does this plugin do?