From 8ba8b3e51175b4fdd8a18b2809d933c9e030b7fb Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 09:38:47 +0300 Subject: [PATCH 001/204] Split view --- views/page-widgets/monthly-badges.php | 111 +++++++++++++++++++++++++ views/page-widgets/suggested-tasks.php | 96 +-------------------- 2 files changed, 112 insertions(+), 95 deletions(-) create mode 100644 views/page-widgets/monthly-badges.php diff --git a/views/page-widgets/monthly-badges.php b/views/page-widgets/monthly-badges.php new file mode 100644 index 000000000..113146ab6 --- /dev/null +++ b/views/page-widgets/monthly-badges.php @@ -0,0 +1,111 @@ +get_admin__widgets__suggested_tasks(); +$prpl_badge = \progress_planner()->get_badges()->get_badge( Monthly::get_badge_id_from_date( new \DateTime() ) ); + +?> + +

+ +

+ + + + + + + +
+ + + get_score()['target_score']; ?>pt + +
+ + get_previous_incomplete_months_badges() ) ) : ?> +
+

+

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

+ get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?> +
+ + +
+ + progress_callback()['points']; ?>pt + + + progress_callback()['remaining'] + ); + ?> + +
+
+ +
+ + +
+ + + + +
+ + the_view( + 'page-widgets/parts/monthly-badges-2024.php', + [ + 'title_tag' => 'h2', + ] + ); + ?> + + + the_view( + 'page-widgets/parts/monthly-badges.php', + [ + 'title_year' => 2025, + ] + ); + ?> + + get_ui__popover()->the_popover( 'monthly-badges' )->render_button( + '', + \esc_html__( 'Show all my badges!', 'progress-planner' ) + ); + \progress_planner()->get_ui__popover()->the_popover( 'monthly-badges' )->render(); + ?> +
\ No newline at end of file diff --git a/views/page-widgets/suggested-tasks.php b/views/page-widgets/suggested-tasks.php index 7a3d2145e..aff66d266 100644 --- a/views/page-widgets/suggested-tasks.php +++ b/views/page-widgets/suggested-tasks.php @@ -5,14 +5,11 @@ * @package Progress_Planner */ -use Progress_Planner\Badges\Monthly; - if ( ! defined( 'ABSPATH' ) ) { exit; } $prpl_widget = \progress_planner()->get_admin__widgets__suggested_tasks(); -$prpl_badge = \progress_planner()->get_badges()->get_badge( Monthly::get_badge_id_from_date( new \DateTime() ) ); ?>
@@ -36,95 +33,4 @@
- -

- -

- - - - - - - -
- - - get_score()['target_score']; ?>pt - -
- - get_previous_incomplete_months_badges() ) ) : ?> -
-

-

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

- get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?> -
- - -
- - progress_callback()['points']; ?>pt - - - progress_callback()['remaining'] - ); - ?> - -
-
- -
- - -
- - -
- - the_view( - 'page-widgets/parts/monthly-badges-2024.php', - [ - 'title_tag' => 'h2', - ] - ); - ?> - - - the_view( - 'page-widgets/parts/monthly-badges.php', - [ - 'title_year' => 2025, - ] - ); - ?> - - get_ui__popover()->the_popover( 'monthly-badges' )->render_button( - '', - \esc_html__( 'Show all my badges!', 'progress-planner' ) - ); - \progress_planner()->get_ui__popover()->the_popover( 'monthly-badges' )->render(); - ?> -
+the_view( 'page-widgets/monthly-badges.php' ); ?> \ No newline at end of file From 954eeb68589ba00c6f3d7b4c712f74074195f920 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 09:41:29 +0300 Subject: [PATCH 002/204] Duplicate class --- .../admin/widgets/class-monthly-badges.php | 106 ++++++++++++++++++ views/page-widgets/monthly-badges.php | 2 +- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 classes/admin/widgets/class-monthly-badges.php diff --git a/classes/admin/widgets/class-monthly-badges.php b/classes/admin/widgets/class-monthly-badges.php new file mode 100644 index 000000000..e6e0b49f0 --- /dev/null +++ b/classes/admin/widgets/class-monthly-badges.php @@ -0,0 +1,106 @@ + The scores. + */ + public function get_score() { + $activities = \progress_planner()->get_activities__query()->query_activities( + [ + 'category' => 'suggested_task', + 'start_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-01' ) ), + 'end_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-t' ) ), + ] + ); + + $score = 0; + foreach ( $activities as $activity ) { + $score += $activity->get_points( $activity->date ); + } + + return [ + 'score' => (int) $score, + 'target' => (int) Monthly::TARGET_POINTS, + 'target_score' => (int) min( Monthly::TARGET_POINTS, max( 0, floor( $score ) ) ), + ]; + } + + /** + * Get previous month badge. + * + * @return \Progress_Planner\Badges\Monthly[] + */ + public function get_previous_incomplete_months_badges() { + $previous_incomplete_month_badges = []; + + $minus_one_month = ( new DateTime() )->modify( 'first day of previous month' ); + $minus_one_month_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_one_month ) ); + if ( $minus_one_month_badge && $minus_one_month_badge->progress_callback()['progress'] < 100 ) { + $previous_incomplete_month_badges[] = $minus_one_month_badge; + } + + $minus_two_months = ( new DateTime() )->modify( 'first day of previous month' )->modify( 'first day of previous month' ); + $minus_two_months_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_two_months ) ); + if ( $minus_two_months_badge && $minus_two_months_badge->progress_callback()['progress'] < 100 ) { + $previous_incomplete_month_badges[] = $minus_two_months_badge; + } + + return $previous_incomplete_month_badges; + } + + /** + * Enqueue the scripts. + * + * @return void + */ + public function enqueue_scripts() { + parent::enqueue_scripts(); + + // Enqueue the badge scroller script. + \progress_planner()->get_admin__enqueue()->enqueue_script( + 'widgets/suggested-tasks-badge-scroller', + ); + } + + /** + * Get the stylesheet dependencies. + * + * @return array + */ + public function get_stylesheet_dependencies() { + // Register styles for the web-component. + \wp_register_style( + 'progress-planner-suggested-task', + constant( 'PROGRESS_PLANNER_URL' ) . '/assets/css/suggested-task.css', + [], + \progress_planner()->get_file_version( constant( 'PROGRESS_PLANNER_DIR' ) . '/assets/css/suggested-task.css' ) + ); + + return [ + 'progress-planner-suggested-task', + ]; + } +} diff --git a/views/page-widgets/monthly-badges.php b/views/page-widgets/monthly-badges.php index 113146ab6..04f65b0e7 100644 --- a/views/page-widgets/monthly-badges.php +++ b/views/page-widgets/monthly-badges.php @@ -11,7 +11,7 @@ exit; } -$prpl_widget = \progress_planner()->get_admin__widgets__suggested_tasks(); +$prpl_widget = \progress_planner()->get_admin__widgets__monthly_badges(); $prpl_badge = \progress_planner()->get_badges()->get_badge( Monthly::get_badge_id_from_date( new \DateTime() ) ); ?> From 42809214ecf6da93ff36b171db2c21c043d10f03 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 09:43:49 +0300 Subject: [PATCH 003/204] Cleanup the Suggested_Tasks class --- .../admin/widgets/class-suggested-tasks.php | 52 ------------------- views/page-widgets/suggested-tasks.php | 2 - 2 files changed, 54 deletions(-) diff --git a/classes/admin/widgets/class-suggested-tasks.php b/classes/admin/widgets/class-suggested-tasks.php index 83e5bfed0..ebcb9ec83 100644 --- a/classes/admin/widgets/class-suggested-tasks.php +++ b/classes/admin/widgets/class-suggested-tasks.php @@ -7,9 +7,6 @@ namespace Progress_Planner\Admin\Widgets; -use DateTime; -use Progress_Planner\Badges\Monthly; - /** * Suggested_Tasks class. */ @@ -22,55 +19,6 @@ final class Suggested_Tasks extends Widget { */ protected $id = 'suggested-tasks'; - /** - * Get the score. - * - * @return array The scores. - */ - public function get_score() { - $activities = \progress_planner()->get_activities__query()->query_activities( - [ - 'category' => 'suggested_task', - 'start_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-01' ) ), - 'end_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-t' ) ), - ] - ); - - $score = 0; - foreach ( $activities as $activity ) { - $score += $activity->get_points( $activity->date ); - } - - return [ - 'score' => (int) $score, - 'target' => (int) Monthly::TARGET_POINTS, - 'target_score' => (int) min( Monthly::TARGET_POINTS, max( 0, floor( $score ) ) ), - ]; - } - - /** - * Get previous month badge. - * - * @return \Progress_Planner\Badges\Monthly[] - */ - public function get_previous_incomplete_months_badges() { - $previous_incomplete_month_badges = []; - - $minus_one_month = ( new DateTime() )->modify( 'first day of previous month' ); - $minus_one_month_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_one_month ) ); - if ( $minus_one_month_badge && $minus_one_month_badge->progress_callback()['progress'] < 100 ) { - $previous_incomplete_month_badges[] = $minus_one_month_badge; - } - - $minus_two_months = ( new DateTime() )->modify( 'first day of previous month' )->modify( 'first day of previous month' ); - $minus_two_months_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_two_months ) ); - if ( $minus_two_months_badge && $minus_two_months_badge->progress_callback()['progress'] < 100 ) { - $previous_incomplete_month_badges[] = $minus_two_months_badge; - } - - return $previous_incomplete_month_badges; - } - /** * Enqueue the scripts. * diff --git a/views/page-widgets/suggested-tasks.php b/views/page-widgets/suggested-tasks.php index aff66d266..4d9a497f1 100644 --- a/views/page-widgets/suggested-tasks.php +++ b/views/page-widgets/suggested-tasks.php @@ -8,8 +8,6 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } - -$prpl_widget = \progress_planner()->get_admin__widgets__suggested_tasks(); ?>
From 54baad436919f8a20db0e7e0f9cffcbf131fc0b6 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 11:48:38 +0300 Subject: [PATCH 004/204] Use 2 columns, split CSS & other tweaks --- assets/css/admin.css | 4 + assets/css/page-widgets/monthly-badges.css | 199 ++++++++++++++++++ assets/css/page-widgets/suggested-tasks.css | 194 ----------------- classes/admin/class-page.php | 3 +- .../admin/widgets/class-suggested-tasks.php | 7 + classes/admin/widgets/class-todo.php | 7 + classes/admin/widgets/class-widget.php | 11 +- views/page-widgets/suggested-tasks.php | 2 - 8 files changed, 229 insertions(+), 198 deletions(-) create mode 100644 assets/css/page-widgets/monthly-badges.css diff --git a/assets/css/admin.css b/assets/css/admin.css index ce430cbbb..bf249d2ae 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -96,6 +96,10 @@ color: var(--prpl-color-link); } +.prpl-widget-width-2 { + grid-column: span 2; +} + .prpl-widget-title { margin-top: 0; font-size: 1.375rem; diff --git a/assets/css/page-widgets/monthly-badges.css b/assets/css/page-widgets/monthly-badges.css new file mode 100644 index 000000000..05384e39f --- /dev/null +++ b/assets/css/page-widgets/monthly-badges.css @@ -0,0 +1,199 @@ +/** + * Suggested tasks widget. + * + * Dependencies: progress-planner/web-components/prpl-badge + */ + +.prpl-widget-wrapper.prpl-monthly-badges { + + /* Remove styling from the widget wrapper (but not in popover view). */ + & > .widget-inner-container .prpl-widget-content > .prpl-widget-wrapper:has(.badge-group-monthly) { + padding: 0; + border: none; + box-shadow: none; + margin-bottom: 0; + } + + .badge-group-monthly { + padding: calc(var(--prpl-padding) / 2); + border-radius: var(--prpl-border-radius-big); + background-color: var(--prpl-background-orange); + + .prpl-badge-row-wrapper { + overflow: hidden; + } + + .prpl-badge-row-wrapper-inner { + --prpl-current-row: 1; + + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: calc(var(--prpl-gap) / 2); + + transition: transform 0.3s ease-in-out; + transform: translateY(calc((var(--row-height) + var(--grid-gap)) * (var(--prpl-current-row) - 1) * -1)); + } + + .prpl-badge-row-button-wrapper { + display: flex; + justify-content: center; + + &:has(.prpl-badge-row-button-up) { + margin-bottom: var(--prpl-padding); + padding-bottom: 0.2rem; + + border-bottom: 1px solid var(--prpl-color-gray-3); + } + + &:has(.prpl-badge-row-button-down) { + margin-top: var(--prpl-padding); + padding-top: 0.2rem; + + border-top: 1px solid var(--prpl-color-gray-3); + } + + &.prpl-badge-row-button-disabled { + opacity: 0.5; + pointer-events: none; + } + } + + .prpl-badge-row-button { + border: none; + background: none; + cursor: pointer; + } + + p { + margin: 0; + font-size: var(--prpl-font-size-xs); + text-align: center; + line-height: 1.2; + } + } + + .prpl-widget-content { + margin-bottom: 1em; + + &:last-child { + margin-bottom: 0; + } + } + + .prpl-widget-content-points { + display: flex; + justify-content: space-between; + align-items: center; + + .prpl-widget-content-points-number { + font-size: var(--prpl-font-size-3xl); + font-weight: 600; + } + } +} + +/*------------------------------------*\ + Popover styles. +\*------------------------------------*/ +#prpl-popover-monthly-badges { + + .prpl-widgets-container { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(var(--prpl-column-min-width), 1fr)); + grid-gap: var(--prpl-gap); + grid-auto-rows: auto; + } + + .prpl-widget-title { + padding: 0.5rem 1rem; + border-radius: 0.5rem; + background: var(--prpl-background-orange); + } + + .badge-group-monthly { + background-color: transparent; + } + + .prpl-widget-wrapper-content { + + .prpl-widget-title { + background: var(--prpl-background-blue); + } + + .badge-group-content { + background-color: transparent; + } + } + + .prpl-widget-wrapper-maintenance { + + .prpl-widget-title { + background: var(--prpl-background-red); + } + + .badge-group-maintenance { + background-color: transparent; + } + } +} + +.prpl-widget-wrapper.prpl-badge-streak { + display: flex; + flex-direction: column; + justify-content: space-between; + + .progress-label { + display: inline-block; + } + + .progress-wrapper { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: calc(var(--prpl-gap) / 2); + padding: calc(var(--prpl-padding) / 2); + border-radius: var(--prpl-border-radius-big); + + &:not(:first-child) { + margin-top: var(--prpl-padding); + } + + &.badge-group-content { + background: var(--prpl-background-blue); + } + + &.badge-group-maintenance { + background: var(--prpl-background-red); + } + + .prpl-badge { + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + min-width: 0; + } + + p { + margin: 0; + font-size: var(--prpl-font-size-xs); + text-align: center; + line-height: 1.2; + } + } + + .prpl-widget-content { + margin-bottom: 1em; + } + + .badge-group-monthly { + background-color: transparent; + } +} + +#prpl-popover-monthly-badges-trigger { + font-size: var(--prpl-font-size-base); + color: var(--prpl-color-link); + text-decoration: underline; + margin-top: 0.75rem; +} diff --git a/assets/css/page-widgets/suggested-tasks.css b/assets/css/page-widgets/suggested-tasks.css index d0b1e4666..13f827413 100644 --- a/assets/css/page-widgets/suggested-tasks.css +++ b/assets/css/page-widgets/suggested-tasks.css @@ -6,94 +6,6 @@ * Dependencies: progress-planner/suggested-task, progress-planner/web-components/prpl-badge */ -.prpl-widget-wrapper.prpl-suggested-tasks { - - /* Remove styling from the widget wrapper (but not in popover view). */ - & > .widget-inner-container .prpl-widget-content > .prpl-widget-wrapper:has(.badge-group-monthly) { - padding: 0; - border: none; - box-shadow: none; - margin-bottom: 0; - } - - .badge-group-monthly { - padding: calc(var(--prpl-padding) / 2); - border-radius: var(--prpl-border-radius-big); - background-color: var(--prpl-background-orange); - - .prpl-badge-row-wrapper { - overflow: hidden; - } - - .prpl-badge-row-wrapper-inner { - --prpl-current-row: 1; - - display: grid; - grid-template-columns: 1fr 1fr 1fr; - gap: calc(var(--prpl-gap) / 2); - - transition: transform 0.3s ease-in-out; - transform: translateY(calc((var(--row-height) + var(--grid-gap)) * (var(--prpl-current-row) - 1) * -1)); - } - - .prpl-badge-row-button-wrapper { - display: flex; - justify-content: center; - - &:has(.prpl-badge-row-button-up) { - margin-bottom: var(--prpl-padding); - padding-bottom: 0.2rem; - - border-bottom: 1px solid var(--prpl-color-gray-3); - } - - &:has(.prpl-badge-row-button-down) { - margin-top: var(--prpl-padding); - padding-top: 0.2rem; - - border-top: 1px solid var(--prpl-color-gray-3); - } - - &.prpl-badge-row-button-disabled { - opacity: 0.5; - pointer-events: none; - } - } - - .prpl-badge-row-button { - border: none; - background: none; - cursor: pointer; - } - - p { - margin: 0; - font-size: var(--prpl-font-size-xs); - text-align: center; - line-height: 1.2; - } - } - - .prpl-widget-content { - margin-bottom: 1em; - - &:last-child { - margin-bottom: 0; - } - } - - .prpl-widget-content-points { - display: flex; - justify-content: space-between; - align-items: center; - - .prpl-widget-content-points-number { - font-size: var(--prpl-font-size-3xl); - font-weight: 600; - } - } -} - .prpl-dashboard-widget-suggested-tasks { &:not(:has(.prpl-suggested-tasks-loading)):not(:has(.prpl-suggested-tasks-list li)) { @@ -178,112 +90,6 @@ } } -/*------------------------------------*\ - Popover styles. -\*------------------------------------*/ -#prpl-popover-monthly-badges { - - .prpl-widgets-container { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(var(--prpl-column-min-width), 1fr)); - grid-gap: var(--prpl-gap); - grid-auto-rows: auto; - } - - .prpl-widget-title { - padding: 0.5rem 1rem; - border-radius: 0.5rem; - background: var(--prpl-background-orange); - } - - .badge-group-monthly { - background-color: transparent; - } - - .prpl-widget-wrapper-content { - - .prpl-widget-title { - background: var(--prpl-background-blue); - } - - .badge-group-content { - background-color: transparent; - } - } - - .prpl-widget-wrapper-maintenance { - - .prpl-widget-title { - background: var(--prpl-background-red); - } - - .badge-group-maintenance { - background-color: transparent; - } - } -} - -.prpl-widget-wrapper.prpl-badge-streak { - display: flex; - flex-direction: column; - justify-content: space-between; - - .progress-label { - display: inline-block; - } - - .progress-wrapper { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - gap: calc(var(--prpl-gap) / 2); - padding: calc(var(--prpl-padding) / 2); - border-radius: var(--prpl-border-radius-big); - - &:not(:first-child) { - margin-top: var(--prpl-padding); - } - - &.badge-group-content { - background: var(--prpl-background-blue); - } - - &.badge-group-maintenance { - background: var(--prpl-background-red); - } - - .prpl-badge { - display: flex; - flex-direction: column; - align-items: center; - justify-content: space-between; - flex-wrap: wrap; - min-width: 0; - } - - p { - margin: 0; - font-size: var(--prpl-font-size-xs); - text-align: center; - line-height: 1.2; - } - } - - .prpl-widget-content { - margin-bottom: 1em; - } - - .badge-group-monthly { - background-color: transparent; - } -} - -#prpl-popover-monthly-badges-trigger { - font-size: var(--prpl-font-size-base); - color: var(--prpl-color-link); - text-decoration: underline; - margin-top: 0.75rem; -} - /*------------------------------------*\ Interactive tasks, popover. \*------------------------------------*/ diff --git a/classes/admin/class-page.php b/classes/admin/class-page.php index a0b0215e8..be259927a 100644 --- a/classes/admin/class-page.php +++ b/classes/admin/class-page.php @@ -45,8 +45,9 @@ private function register_hooks() { public function get_widgets() { $widgets = [ \progress_planner()->get_admin__widgets__suggested_tasks(), - \progress_planner()->get_admin__widgets__activity_scores(), + \progress_planner()->get_admin__widgets__monthly_badges(), \progress_planner()->get_admin__widgets__todo(), + \progress_planner()->get_admin__widgets__activity_scores(), \progress_planner()->get_admin__widgets__challenge(), \progress_planner()->get_admin__widgets__latest_badge(), \progress_planner()->get_admin__widgets__badge_streak(), diff --git a/classes/admin/widgets/class-suggested-tasks.php b/classes/admin/widgets/class-suggested-tasks.php index ebcb9ec83..d16d8640f 100644 --- a/classes/admin/widgets/class-suggested-tasks.php +++ b/classes/admin/widgets/class-suggested-tasks.php @@ -19,6 +19,13 @@ final class Suggested_Tasks extends Widget { */ protected $id = 'suggested-tasks'; + /** + * The widget width. + * + * @var int + */ + protected $width = 2; + /** * Enqueue the scripts. * diff --git a/classes/admin/widgets/class-todo.php b/classes/admin/widgets/class-todo.php index 4a67d396e..229707f2e 100644 --- a/classes/admin/widgets/class-todo.php +++ b/classes/admin/widgets/class-todo.php @@ -19,6 +19,13 @@ final class ToDo extends Widget { */ protected $id = 'todo'; + /** + * The widget width. + * + * @var int + */ + protected $width = 2; + /** * Print the widget content. * diff --git a/classes/admin/widgets/class-widget.php b/classes/admin/widgets/class-widget.php index 09b59e9e6..54fb31bd1 100644 --- a/classes/admin/widgets/class-widget.php +++ b/classes/admin/widgets/class-widget.php @@ -14,6 +14,15 @@ */ abstract class Widget { + /** + * The widget width. + * + * Can be 1 or 2. + * + * @var int + */ + protected $width = 1; + /** * Constructor. */ @@ -71,7 +80,7 @@ public function render() { $this->enqueue_styles(); $this->enqueue_scripts(); ?> -
+
the_view( "page-widgets/{$this->id}.php" ); ?>
diff --git a/views/page-widgets/suggested-tasks.php b/views/page-widgets/suggested-tasks.php index 4d9a497f1..8653b14d8 100644 --- a/views/page-widgets/suggested-tasks.php +++ b/views/page-widgets/suggested-tasks.php @@ -30,5 +30,3 @@


- -the_view( 'page-widgets/monthly-badges.php' ); ?> \ No newline at end of file From 211fc90a84ac17ec2dc87270bf10430c3de051a5 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 13:21:59 +0300 Subject: [PATCH 005/204] more fixes --- assets/css/admin.css | 4 ++++ assets/css/page-widgets/monthly-badges.css | 8 ++++++++ classes/admin/class-page.php | 2 +- views/page-widgets/suggested-tasks.php | 1 - 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index bf249d2ae..0a458d7f1 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -416,6 +416,10 @@ button.prpl-info-icon { .prpl-welcome .inner-content .right { display: none !important; } + + .prpl-widget-width-2 { + grid-column: span 1; + } } /*------------------------------------*\ diff --git a/assets/css/page-widgets/monthly-badges.css b/assets/css/page-widgets/monthly-badges.css index 05384e39f..e04a0132a 100644 --- a/assets/css/page-widgets/monthly-badges.css +++ b/assets/css/page-widgets/monthly-badges.css @@ -4,6 +4,14 @@ * Dependencies: progress-planner/web-components/prpl-badge */ +@media all and (min-width: 1400px) { + + .prpl-widget-wrapper.prpl-monthly-badges { + grid-row-start: 1; + grid-column-start: 3; + } +} + .prpl-widget-wrapper.prpl-monthly-badges { /* Remove styling from the widget wrapper (but not in popover view). */ diff --git a/classes/admin/class-page.php b/classes/admin/class-page.php index be259927a..292c5b7ec 100644 --- a/classes/admin/class-page.php +++ b/classes/admin/class-page.php @@ -45,8 +45,8 @@ private function register_hooks() { public function get_widgets() { $widgets = [ \progress_planner()->get_admin__widgets__suggested_tasks(), - \progress_planner()->get_admin__widgets__monthly_badges(), \progress_planner()->get_admin__widgets__todo(), + \progress_planner()->get_admin__widgets__monthly_badges(), \progress_planner()->get_admin__widgets__activity_scores(), \progress_planner()->get_admin__widgets__challenge(), \progress_planner()->get_admin__widgets__latest_badge(), diff --git a/views/page-widgets/suggested-tasks.php b/views/page-widgets/suggested-tasks.php index 8653b14d8..57faac96c 100644 --- a/views/page-widgets/suggested-tasks.php +++ b/views/page-widgets/suggested-tasks.php @@ -28,5 +28,4 @@

-
From b3aaf6f19e8f39b85448cb9a501d55e3debcd2af Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 13:26:26 +0300 Subject: [PATCH 006/204] Merge branch 'develop' into ari/split-widgets --- views/page-widgets/monthly-badges.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/views/page-widgets/monthly-badges.php b/views/page-widgets/monthly-badges.php index 04f65b0e7..8b9417601 100644 --- a/views/page-widgets/monthly-badges.php +++ b/views/page-widgets/monthly-badges.php @@ -41,6 +41,10 @@
get_previous_incomplete_months_badges() ) ) : ?> + get_score()['target'] - $prpl_widget->get_score()['target_score']; + $prpl_days_remaining = (int) \gmdate( 't' ) - (int) \gmdate( 'j' ); + ?>

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

@@ -63,9 +67,10 @@ class="prpl-previous-month-badge-progress-bar-wrapper" progress_callback()['remaining'] + /* translators: %1$d: The number of points. %2$d: The number of days. */ + \esc_html__( '%1$d more points to go in the next %2$d days', 'progress-planner' ), + (int) $prpl_remaining_points, + (int) $prpl_days_remaining ); ?> From cd15e399f8b993f65965cef7582caa4e0cfdeb74 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 23 Jun 2025 13:34:14 +0300 Subject: [PATCH 007/204] Missed migrating this line on merge --- views/page-widgets/monthly-badges.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/page-widgets/monthly-badges.php b/views/page-widgets/monthly-badges.php index 8b9417601..d7ef98710 100644 --- a/views/page-widgets/monthly-badges.php +++ b/views/page-widgets/monthly-badges.php @@ -49,6 +49,7 @@

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?> + progress_callback()['remaining']; ?>
Date: Wed, 25 Jun 2025 15:19:13 +0200 Subject: [PATCH 008/204] fix fatal error on WP dashboard page --- views/dashboard-widgets/score.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/dashboard-widgets/score.php b/views/dashboard-widgets/score.php index 72cd4ab18..6f5ff376b 100644 --- a/views/dashboard-widgets/score.php +++ b/views/dashboard-widgets/score.php @@ -18,10 +18,10 @@ contentPadding="var(--prpl-padding)" marginBottom="0" data-max="" - data-value="get_admin__widgets__suggested_tasks()->get_score()['target_score']; ?>" + data-value="get_admin__widgets__monthly_badges()->get_score()['target_score']; ?>" data-badge-id="" > - + Date: Wed, 25 Jun 2025 15:54:29 +0200 Subject: [PATCH 009/204] WIP: missed badges widget --- classes/admin/class-page.php | 1 + classes/admin/widgets/class-missed-badges.php | 93 +++++++++++++++++++ .../admin/widgets/class-monthly-badges.php | 23 ----- views/page-widgets/missed-badges.php | 56 +++++++++++ views/page-widgets/monthly-badges.php | 41 -------- 5 files changed, 150 insertions(+), 64 deletions(-) create mode 100644 classes/admin/widgets/class-missed-badges.php create mode 100644 views/page-widgets/missed-badges.php diff --git a/classes/admin/class-page.php b/classes/admin/class-page.php index 260a5a6d4..87f865176 100644 --- a/classes/admin/class-page.php +++ b/classes/admin/class-page.php @@ -50,6 +50,7 @@ public function get_widgets() { \progress_planner()->get_admin__widgets__activity_scores(), \progress_planner()->get_admin__widgets__challenge(), \progress_planner()->get_admin__widgets__latest_badge(), + \progress_planner()->get_admin__widgets__missed_badges(), \progress_planner()->get_admin__widgets__badge_streak(), \progress_planner()->get_admin__widgets__content_activity(), \progress_planner()->get_admin__widgets__whats_new(), diff --git a/classes/admin/widgets/class-missed-badges.php b/classes/admin/widgets/class-missed-badges.php new file mode 100644 index 000000000..48ab49699 --- /dev/null +++ b/classes/admin/widgets/class-missed-badges.php @@ -0,0 +1,93 @@ + The scores. + */ + public function get_score() { + $activities = \progress_planner()->get_activities__query()->query_activities( + [ + 'category' => 'suggested_task', + 'start_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-01' ) ), + 'end_date' => \DateTime::createFromFormat( 'Y-m-d', \gmdate( 'Y-m-t' ) ), + ] + ); + + $score = 0; + foreach ( $activities as $activity ) { + $score += $activity->get_points( $activity->date ); + } + + return [ + 'score' => (int) $score, + 'target' => (int) Monthly::TARGET_POINTS, + 'target_score' => (int) \min( Monthly::TARGET_POINTS, \max( 0, \floor( $score ) ) ), + ]; + } + + /** + * Get previous month badge. + * + * @return \Progress_Planner\Badges\Monthly[] + */ + public function get_previous_incomplete_months_badges() { + $previous_incomplete_month_badges = []; + + $minus_one_month = ( new DateTime() )->modify( 'first day of previous month' ); + $minus_one_month_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_one_month ) ); + if ( $minus_one_month_badge && $minus_one_month_badge->progress_callback()['progress'] < 100 ) { + $previous_incomplete_month_badges[] = $minus_one_month_badge; + } + + $minus_two_months = ( new DateTime() )->modify( 'first day of previous month' )->modify( 'first day of previous month' ); + $minus_two_months_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_two_months ) ); + if ( $minus_two_months_badge && $minus_two_months_badge->progress_callback()['progress'] < 100 ) { + $previous_incomplete_month_badges[] = $minus_two_months_badge; + } + + return $previous_incomplete_month_badges; + } + + /** + * Get the stylesheet dependencies. + * + * @return array + */ + public function get_stylesheet_dependencies() { + // Register styles for the web-component. + \wp_register_style( + 'progress-planner-suggested-task', + \constant( 'PROGRESS_PLANNER_URL' ) . '/assets/css/suggested-task.css', + [], + \progress_planner()->get_file_version( \constant( 'PROGRESS_PLANNER_DIR' ) . '/assets/css/suggested-task.css' ) + ); + + return [ + 'progress-planner-suggested-task', + ]; + } +} diff --git a/classes/admin/widgets/class-monthly-badges.php b/classes/admin/widgets/class-monthly-badges.php index a7e0c7580..31b865d01 100644 --- a/classes/admin/widgets/class-monthly-badges.php +++ b/classes/admin/widgets/class-monthly-badges.php @@ -48,29 +48,6 @@ public function get_score() { ]; } - /** - * Get previous month badge. - * - * @return \Progress_Planner\Badges\Monthly[] - */ - public function get_previous_incomplete_months_badges() { - $previous_incomplete_month_badges = []; - - $minus_one_month = ( new DateTime() )->modify( 'first day of previous month' ); - $minus_one_month_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_one_month ) ); - if ( $minus_one_month_badge && $minus_one_month_badge->progress_callback()['progress'] < 100 ) { - $previous_incomplete_month_badges[] = $minus_one_month_badge; - } - - $minus_two_months = ( new DateTime() )->modify( 'first day of previous month' )->modify( 'first day of previous month' ); - $minus_two_months_badge = Monthly::get_instance_from_id( Monthly::get_badge_id_from_date( $minus_two_months ) ); - if ( $minus_two_months_badge && $minus_two_months_badge->progress_callback()['progress'] < 100 ) { - $previous_incomplete_month_badges[] = $minus_two_months_badge; - } - - return $previous_incomplete_month_badges; - } - /** * Enqueue the scripts. * diff --git a/views/page-widgets/missed-badges.php b/views/page-widgets/missed-badges.php new file mode 100644 index 000000000..c3edfb010 --- /dev/null +++ b/views/page-widgets/missed-badges.php @@ -0,0 +1,56 @@ +get_admin__widgets__missed_badges(); +?> + +get_previous_incomplete_months_badges() ) ) : ?> + get_score()['target'] - $prpl_widget->get_score()['target_score']; + $prpl_days_remaining = (int) \gmdate( 't' ) - (int) \gmdate( 'j' ); + ?> +
+

+

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

+ get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?> + progress_callback()['remaining']; ?> +
+ + +
+ + progress_callback()['points']; ?>pt + + + + +
+
+ +
+ diff --git a/views/page-widgets/monthly-badges.php b/views/page-widgets/monthly-badges.php index 77d595990..5bf0edf92 100644 --- a/views/page-widgets/monthly-badges.php +++ b/views/page-widgets/monthly-badges.php @@ -40,47 +40,6 @@
- get_previous_incomplete_months_badges() ) ) : ?> - get_score()['target'] - $prpl_widget->get_score()['target_score']; - $prpl_days_remaining = (int) \gmdate( 't' ) - (int) \gmdate( 'j' ); - ?> -
-

-

Collect the surplus of points you earn, and get your badge!', 'progress-planner' ), [ 'strong' => [] ] ); ?>

- get_previous_incomplete_months_badges() as $prpl_previous_incomplete_month_badge ) : ?> - progress_callback()['remaining']; ?> -
- - -
- - progress_callback()['points']; ?>pt - - - - -
-
- -
- -
From 16188492c447c85829de8041d8bf525a1bf3c5e3 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Thu, 26 Jun 2025 11:19:33 +0200 Subject: [PATCH 010/204] WIP: hover controls --- assets/css/admin.css | 4 + assets/css/page-widgets/suggested-tasks.css | 40 ++++- assets/css/page-widgets/todo.css | 2 +- assets/css/suggested-task.css | 19 ++- assets/css/web-components/prpl-tooltip.css | 2 +- assets/js/web-components/prpl-tooltip.js | 1 + views/js-templates/suggested-task.html | 165 +++++++++++--------- views/page-widgets/todo.php | 2 +- 8 files changed, 150 insertions(+), 85 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 0a458d7f1..a18430e9c 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -98,6 +98,10 @@ .prpl-widget-width-2 { grid-column: span 2; + + .prpl-widget-description { + max-width: 640px; + } } .prpl-widget-title { diff --git a/assets/css/page-widgets/suggested-tasks.css b/assets/css/page-widgets/suggested-tasks.css index 13f827413..2fec9020d 100644 --- a/assets/css/page-widgets/suggested-tasks.css +++ b/assets/css/page-widgets/suggested-tasks.css @@ -53,7 +53,7 @@ } .prpl-suggested-task:nth-child(odd) { - background-color: #f9fafb; + background-color: #f6f7f9; } /* If task has disabled checkbox it's title should be italic. */ @@ -72,7 +72,8 @@ } /* Disabled checkbox styles. */ - .prpl-suggested-task-disabled-checkbox-tooltip { + .prpl-suggested-task-disabled-checkbox-tooltip, + .tooltip-actions { & > button { padding: 0; @@ -88,6 +89,41 @@ } } } + + /* Style for "hover" links. */ + .tooltip-actions { + gap: 0.4rem; + + .tooltip-action { + display: inline-flex; + position: relative; + + &:not(:first-child) { + padding-left: 0.4rem; /* same as gap */ + + &::before { + position: absolute; + top: 50%; + transform: translateY(-50%); + left: 0; + + content: ""; + display: inline-block; + width: 1px; + background: var(--prpl-color-gray-5); + height: 0.75rem; + } + } + + .prpl-tooltip-action-text { + color: var(--prpl-color-link); + } + + button { + line-height: 1; /* we dont use icons here anymore */ + } + + } } /*------------------------------------*\ diff --git a/assets/css/page-widgets/todo.css b/assets/css/page-widgets/todo.css index 6c72876a9..40c457c30 100644 --- a/assets/css/page-widgets/todo.css +++ b/assets/css/page-widgets/todo.css @@ -48,7 +48,7 @@ border: 1px solid #796da2; background-color: #f9fafb; - .prpl-suggested-task-actions { + .prpl-suggested-task-points-wrapper { &::after { content: ""; diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index d9263d3f9..c5be321df 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -2,12 +2,23 @@ margin: 0; padding: 0.5rem; display: flex; - justify-content: space-between; - align-items: center; + flex-direction: column; + gap: 0.5rem; + position: relative; - gap: 1rem; line-height: 1.5; + .prpl-suggested-task-title-wrapper { + display: flex; + align-items: center; + gap: 0.5rem; + justify-content: space-between; + } + + .prpl-suggested-task-actions-wrapper { + padding-left: 1.5rem; + } + h3 { font-size: 1rem; margin: 0; @@ -44,7 +55,7 @@ text-decoration-color: transparent; } - .prpl-suggested-task-actions { + .prpl-suggested-task-points-wrapper { display: flex; gap: 0.5rem; flex-shrink: 0; /* Prevent the actions from shrinking when the task title is too long */ diff --git a/assets/css/web-components/prpl-tooltip.css b/assets/css/web-components/prpl-tooltip.css index ff30d576d..4b910e2cc 100644 --- a/assets/css/web-components/prpl-tooltip.css +++ b/assets/css/web-components/prpl-tooltip.css @@ -1,5 +1,5 @@ .tooltip-actions { - justify-content: flex-end; + justify-content: flex-start; gap: 0.5em; display: flex; position: relative; diff --git a/assets/js/web-components/prpl-tooltip.js b/assets/js/web-components/prpl-tooltip.js index d9cefe08b..12b0b9174 100644 --- a/assets/js/web-components/prpl-tooltip.js +++ b/assets/js/web-components/prpl-tooltip.js @@ -67,6 +67,7 @@ customElements.define( // Find the close button (or create a default one) let closeButton = closeSlot?.firstElementChild; + console.log( closeButton ); if ( ! closeButton ) { closeButton = document.createElement( 'button' ); closeButton.type = 'button'; diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index b8ecdfe06..ad5955e03 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -4,40 +4,32 @@ var categorySlug = prplTerms.getTerm( data.post[ prplTerms.category ][0], prplTerms.category ).slug; #>
  • - <# if ( data.useCheckbox ) { #> - <# if ( ! data.post.meta.prpl_dismissable ) { #> - - - disabled<# } #> <# if ( 'trash' === data.post.status || 'pending' === data.post.status ) { #>checked<# } #>> - - {{{ data.l10n.disabledRRCheckboxTooltip }}} - - <# } else { #> - - <# } #> - <# } #> - -

    - contenteditable="plaintext-only" onkeydown="prplSuggestedTask.updateTaskTitle( this );" data-post-id="{{ data.post.id }}"<# } #>><# if ( data.post.meta.prpl_url ) { #>{{{ data.post.title.rendered }}}<# } else if ( data.post.meta.prpl_popover_id ) { #>{{{ data.post.title.rendered }}}<# } else { #>{{{ data.post.title.rendered }}}<# } #> -

    - -
    -
    - <# if ( data.post.content.rendered !== '' ) { #> - +
    + <# if ( data.useCheckbox ) { #> + <# if ( ! data.post.meta.prpl_dismissable ) { #> + - + disabled<# } #> <# if ( 'trash' === data.post.status || 'pending' === data.post.status ) { #>checked<# } #>> - {{{ data.post.content.rendered }}} + {{{ data.l10n.disabledRRCheckboxTooltip }}} + <# } else { #> + <# } #> + <# } #> + +

    + contenteditable="plaintext-only" onkeydown="prplSuggestedTask.updateTaskTitle( this );" data-post-id="{{ data.post.id }}"<# } #>><# if ( data.post.meta.prpl_url ) { #>{{{ data.post.title.rendered }}}<# } else if ( data.post.meta.prpl_popover_id ) { #>{{{ data.post.title.rendered }}}<# } else { #>{{{ data.post.title.rendered }}}<# } #> +

    + + +
    + <# if ( 'user' === categorySlug ) { #> +
    + + +
    + <# } #> + + <# if ( data.post.meta.prpl_points ) { #> + + +{{ data.post.meta.prpl_points }} + + <# } #> +
    +
    + + <# if ( 'user' !== categorySlug ) { #> +
    +
    + <# if ( data.post.content.rendered !== '' ) { #> + + + + + + {{{ data.post.content.rendered }}} + + <# } #> <# if ( data.post.meta.prpl_snoozable ) { #> - - - - - -
    - - {{ data.l10n.snoozeThisTask }} - - -
    - <# _.each( { - '1-week': data.l10n.snoozeDurationOneWeek, - '1-month': data.l10n.snoozeDurationOneMonth, - '3-months': data.l10n.snoozeDurationThreeMonths, - '6-months': data.l10n.snoozeDurationSixMonths, - '1-year': data.l10n.snoozeDurationOneYear, - 'forever': data.l10n.snoozeDurationForever, - }, function( value, key ) { #> - - <# }); #> -
    -
    -
    -
    + + + + + + +
    + + {{ data.l10n.snoozeThisTask }} + + +
    + <# _.each( { + '1-week': data.l10n.snoozeDurationOneWeek, + '1-month': data.l10n.snoozeDurationOneMonth, + '3-months': data.l10n.snoozeDurationThreeMonths, + '6-months': data.l10n.snoozeDurationSixMonths, + '1-year': data.l10n.snoozeDurationOneYear, + 'forever': data.l10n.snoozeDurationForever, + }, function( value, key ) { #> + + <# }); #> +
    +
    +
    +
    +
    <# } #> <# if ( data.post.meta.prpl_dismissable && ! data.useCheckbox ) { #> @@ -93,21 +118,9 @@

    {{ data.l10n.markAsComplete }} <# } #> - - <# if ( 'user' === categorySlug ) { #> - - <# } #>

    - - <# if ( data.post.meta.prpl_points ) { #> - - +{{ data.post.meta.prpl_points }} - - <# } #>
    + <# } #> <# document.dispatchEvent( new CustomEvent( 'prpl/suggestedTask/itemInjected', { detail: data } ) ); #>
  • \ No newline at end of file diff --git a/views/page-widgets/todo.php b/views/page-widgets/todo.php index 406c28e69..2f1eb25c8 100644 --- a/views/page-widgets/todo.php +++ b/views/page-widgets/todo.php @@ -17,7 +17,7 @@ -

    +

    From 3b6ba6edeccfa200b61f9fcb1aae8ad1068c6e0a Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Thu, 26 Jun 2025 12:00:14 +0200 Subject: [PATCH 011/204] "Mark as completed" button --- assets/css/page-widgets/suggested-tasks.css | 593 ++++++++++---------- assets/css/suggested-task.css | 4 +- assets/js/suggested-task.js | 5 + assets/js/web-components/prpl-tooltip.js | 1 - views/js-templates/suggested-task.html | 17 +- 5 files changed, 314 insertions(+), 306 deletions(-) diff --git a/assets/css/page-widgets/suggested-tasks.css b/assets/css/page-widgets/suggested-tasks.css index 2fec9020d..cda08e6f2 100644 --- a/assets/css/page-widgets/suggested-tasks.css +++ b/assets/css/page-widgets/suggested-tasks.css @@ -102,380 +102,383 @@ padding-left: 0.4rem; /* same as gap */ &::before { - position: absolute; - top: 50%; - transform: translateY(-50%); - left: 0; - - content: ""; - display: inline-block; - width: 1px; - background: var(--prpl-color-gray-5); - height: 0.75rem; + position: absolute; + top: 50%; + transform: translateY(-50%); + left: 0; + + content: ""; + display: inline-block; + width: 1px; + background: var(--prpl-color-gray-5); + height: 0.75rem; + } } - } - .prpl-tooltip-action-text { - color: var(--prpl-color-link); - } + .prpl-tooltip-action-text { + line-height: 1.2; + font-size: var(--prpl-font-size-small); + color: var(--prpl-color-link); + } - button { - line-height: 1; /* we dont use icons here anymore */ - } + button { + line-height: 1; /* we dont use icons here anymore */ + } + } } -} -/*------------------------------------*\ + /*------------------------------------*\ Interactive tasks, popover. \*------------------------------------*/ -.prpl-popover.prpl-popover-interactive { - padding: 24px 24px 14px 24px; /* 14px is needed for the "next" button hover state. */ - box-sizing: border-box; + .prpl-popover.prpl-popover-interactive { + padding: 24px 24px 14px 24px; /* 14px is needed for the "next" button hover state. */ + box-sizing: border-box; - * { - max-width: calc(100% - 1px); - } - - .prpl-columns-wrapper-flex { - display: flex; - flex-wrap: wrap; - gap: 40px; - overflow: hidden; - padding-bottom: 10px; /* Needed for the "next" button hover state. */ - - > * { - flex-grow: 1; - flex-basis: 300px; - position: relative; + * { + max-width: calc(100% - 1px); + } - &:not(:first-child) { + .prpl-columns-wrapper-flex { + display: flex; + flex-wrap: wrap; + gap: 40px; + overflow: hidden; + padding-bottom: 10px; /* Needed for the "next" button hover state. */ + + > * { + flex-grow: 1; + flex-basis: 300px; + position: relative; - &::before, - &::after { - content: ""; - display: block; - position: absolute; - top: 0; - left: -20px; - width: 1px; - height: 100%; - background-color: var(--prpl-color-gray-2); - } + &:not(:first-child) { + + &::before, + &::after { + content: ""; + display: block; + position: absolute; + top: 0; + left: -20px; + width: 1px; + height: 100%; + background-color: var(--prpl-color-gray-2); + } - &::after { - top: -20px; - left: 0; - width: 100%; - height: 1px; + &::after { + top: -20px; + left: 0; + width: 100%; + height: 1px; + } } } } - } - .prpl-column { + .prpl-column { - /* Set margin for headings and paragraphs. */ - h1, - h2, - h3, - h4, - h5, - h6 { + /* Set margin for headings and paragraphs. */ + h1, + h2, + h3, + h4, + h5, + h6 { - &:first-child { - margin-top: 0; + &:first-child { + margin-top: 0; + } } - } - p { - margin-bottom: 1rem; + p { + margin-bottom: 1rem; - &:first-child { - margin-top: 0; - } + &:first-child { + margin-top: 0; + } - &:last-child { - margin-bottom: 0; + &:last-child { + margin-bottom: 0; + } } - } - .prpl-interactive-task-title { - font-size: 18px; - line-height: 22px; + .prpl-interactive-task-title { + font-size: 18px; + line-height: 22px; - & + p { - margin-top: 4px; + & + p { + margin-top: 4px; + } } - } - - /* Set padding and background color for content column (description text). */ - &.prpl-column-content { - padding: 20px; - border-radius: var(--prpl-border-radius-big); - background-color: var(--prpl-background-purple); - } - .prpl-note { - margin-bottom: 1rem; - display: flex; - align-items: flex-start; - gap: 0.5rem; - padding: 0.75rem; - color: #854d0e; - font-size: var(--prpl-font-size-small); - border-radius: 6px; - background-color: #fefce8; - - .prpl-note-icon { - display: flex; - flex-shrink: 0; - align-items: center; - justify-content: center; - width: 20px; - height: 20px; - color: #eab308; - - svg { - width: 100%; - height: 100%; - } + /* Set padding and background color for content column (description text). */ + &.prpl-column-content { + padding: 20px; + border-radius: var(--prpl-border-radius-big); + background-color: var(--prpl-background-purple); } - &.prpl-note-error { - color: #9f0712; - background-color: var(--prpl-background-red); + .prpl-note { + margin-bottom: 1rem; + display: flex; + align-items: flex-start; + gap: 0.5rem; + padding: 0.75rem; + color: #854d0e; + font-size: var(--prpl-font-size-small); + border-radius: 6px; + background-color: #fefce8; .prpl-note-icon { - color: var(--prpl-color-notification-red); + display: flex; + flex-shrink: 0; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + color: #eab308; + + svg { + width: 100%; + height: 100%; + } } - } - } + &.prpl-note-error { + color: #9f0712; + background-color: var(--prpl-background-red); - /* To align the buttons to the bottom of the column. */ - &:not(.prpl-column-content) { - display: flex; - flex-direction: column; - } + .prpl-note-icon { + color: var(--prpl-color-notification-red); + } - /* Inputs. */ - input[type="text"], - input[type="email"], - input[type="number"], - input[type="url"], - input[type="tel"], - input[type="search"] { - height: 44px; - padding: 1rem; /* WIP */ - width: 100%; - min-width: 300px; /* WIP */ - border-radius: 6px; - border: 1px solid var(--prpl-color-gray-2); - } + } + } - .prpl-button { - padding: 0.75rem 1.25rem; - border: none; - color: var(--prpl-color-gray-6); - font-weight: 600; - border-radius: var(--prpl-border-radius); - background-color: var(--prpl-color-400-orange); /* WIP: pick exact color */ - transition: all 0.25s ease-in-out; - position: relative; + /* To align the buttons to the bottom of the column. */ + &:not(.prpl-column-content) { + display: flex; + flex-direction: column; + } - &::after { - content: ""; - display: block; + /* Inputs. */ + input[type="text"], + input[type="email"], + input[type="number"], + input[type="url"], + input[type="tel"], + input[type="search"] { + height: 44px; + padding: 1rem; /* WIP */ width: 100%; - height: 100%; - background: var(--prpl-color-400-orange); /* WIP: pick exact color */ - position: absolute; - top: 0; - left: 0; - z-index: -1; + min-width: 300px; /* WIP */ border-radius: 6px; - transition: all 0.25s ease-in-out; + border: 1px solid var(--prpl-color-gray-2); } - &:hover, - &:focus { - background: var(--prpl-color-400-orange); /* WIP: pick exact color */ + .prpl-button { + padding: 0.75rem 1.25rem; + border: none; + color: var(--prpl-color-gray-6); + font-weight: 600; + border-radius: var(--prpl-border-radius); + background-color: var(--prpl-color-400-orange); /* WIP: pick exact color */ + transition: all 0.25s ease-in-out; + position: relative; &::after { + content: ""; + display: block; + width: 100%; + height: 100%; background: var(--prpl-color-400-orange); /* WIP: pick exact color */ - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15); - width: calc(100% + 4px); - height: calc(100% + 4px); - margin: -2px; + position: absolute; + top: 0; + left: 0; + z-index: -1; + border-radius: 6px; + transition: all 0.25s ease-in-out; } - } - } - - textarea { - width: 100%; - min-height: 100px; - border-radius: 6px; - box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.05); - border: 1px solid var(--prpl-color-gray-2); - } - - /* Used for radio and checkbox inputs. */ - .radios { - padding-left: 3px; /* To prevent custom radio and checkbox from being cut off. */ - display: flex; - flex-direction: column; - gap: 0.5rem; - .prpl-radio-wrapper { - display: flex; - align-items: center; - } - - --prpl-input-green: #3bb3a6; - --prpl-input-gray: #8b99a6; + &:hover, + &:focus { + background: var(--prpl-color-400-orange); /* WIP: pick exact color */ - /* Hide the default input, because WP has it's own styles (which include pseudo-elements). */ - .prpl-custom-checkbox input[type="checkbox"], - .prpl-custom-radio input[type="radio"] { - position: absolute; - opacity: 0; - width: 0; - height: 0; + &::after { + background: var(--prpl-color-400-orange); /* WIP: pick exact color */ + box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.15); + width: calc(100% + 4px); + height: calc(100% + 4px); + margin: -2px; + } + } } - /* Shared styles for the custom control */ - .prpl-custom-control { - display: inline-block; - vertical-align: middle; - margin-right: 12px; - width: 20px; - height: 20px; - box-sizing: border-box; - position: relative; - transition: border-color 0.2s, background 0.2s; + textarea { + width: 100%; + min-height: 100px; + border-radius: 6px; + box-shadow: 1px 2px 4px 0 rgba(0, 0, 0, 0.05); + border: 1px solid var(--prpl-color-gray-2); } - /* Label text styling */ - .prpl-custom-checkbox, - .prpl-custom-radio { + /* Used for radio and checkbox inputs. */ + .radios { + padding-left: 3px; /* To prevent custom radio and checkbox from being cut off. */ display: flex; - align-items: center; - margin-bottom: 0.5rem; - cursor: pointer; - user-select: none; - } + flex-direction: column; + gap: 0.5rem; + + .prpl-radio-wrapper { + display: flex; + align-items: center; + } - /* Checkbox styles */ - .prpl-custom-checkbox { + --prpl-input-green: #3bb3a6; + --prpl-input-gray: #8b99a6; + + /* Hide the default input, because WP has it's own styles (which include pseudo-elements). */ + .prpl-custom-checkbox input[type="checkbox"], + .prpl-custom-radio input[type="radio"] { + position: absolute; + opacity: 0; + width: 0; + height: 0; + } + /* Shared styles for the custom control */ .prpl-custom-control { - border: 1px solid var(--prpl-input-gray); - border-radius: 6px; - background: #fff; + display: inline-block; + vertical-align: middle; + margin-right: 12px; + width: 20px; + height: 20px; + box-sizing: border-box; + position: relative; + transition: border-color 0.2s, background 0.2s; } - input[type="checkbox"] { + /* Label text styling */ + .prpl-custom-checkbox, + .prpl-custom-radio { + display: flex; + align-items: center; + margin-bottom: 0.5rem; + cursor: pointer; + user-select: none; + } - /* Checkbox hover (off) */ - &:hover + .prpl-custom-control { - box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); - } + /* Checkbox styles */ + .prpl-custom-checkbox { - /* Checkbox checked (on) */ - &:checked + .prpl-custom-control { - background: var(--prpl-input-green); - border-color: var(--prpl-input-green); - box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + .prpl-custom-control { + border: 1px solid var(--prpl-input-gray); + border-radius: 6px; + background: #fff; } - } - /* Checkmark */ - .prpl-custom-control::after { - content: ""; - position: absolute; - left: 6px; - top: 2px; - width: 4px; - height: 9px; - border: solid #fff; - border-width: 0 2px 2px 0; - opacity: 0; - transform: scale(0.8) rotate(45deg); - transition: opacity 0.2s, transform 0.2s; - } + input[type="checkbox"] { - input[type="checkbox"]:checked + .prpl-custom-control::after { - opacity: 1; - transform: scale(1) rotate(45deg); - } - } + /* Checkbox hover (off) */ + &:hover + .prpl-custom-control { + box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + } - /* Radio styles */ - .prpl-custom-radio { + /* Checkbox checked (on) */ + &:checked + .prpl-custom-control { + background: var(--prpl-input-green); + border-color: var(--prpl-input-green); + box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + } + } - .prpl-custom-control { - border: 1px solid var(--prpl-input-gray); - border-radius: 50%; - background: #fff; + /* Checkmark */ + .prpl-custom-control::after { + content: ""; + position: absolute; + left: 6px; + top: 2px; + width: 4px; + height: 9px; + border: solid #fff; + border-width: 0 2px 2px 0; + opacity: 0; + transform: scale(0.8) rotate(45deg); + transition: opacity 0.2s, transform 0.2s; + } + + input[type="checkbox"]:checked + .prpl-custom-control::after { + opacity: 1; + transform: scale(1) rotate(45deg); + } } - /* Radio hover (off) */ - input[type="radio"] { + /* Radio styles */ + .prpl-custom-radio { - &:hover + .prpl-custom-control { - box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + .prpl-custom-control { + border: 1px solid var(--prpl-input-gray); + border-radius: 50%; + background: #fff; } - /* Radio checked (on) */ - &:checked + .prpl-custom-control { - background: var(--prpl-input-green); - border-color: var(--prpl-input-green); - box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + /* Radio hover (off) */ + input[type="radio"] { + + &:hover + .prpl-custom-control { + box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + } + + /* Radio checked (on) */ + &:checked + .prpl-custom-control { + background: var(--prpl-input-green); + border-color: var(--prpl-input-green); + box-shadow: 0 0 0 2px #f7f8fa, 0 0 0 3px var(--prpl-input-green); + } } - } - /* Radio dot */ - .prpl-custom-control::after { - content: ""; - position: absolute; - top: 5px; - left: 5px; - width: 8px; - height: 8px; - background: #fff; - border-radius: 50%; - opacity: 0; - transition: opacity 0.2s; - } + /* Radio dot */ + .prpl-custom-control::after { + content: ""; + position: absolute; + top: 5px; + left: 5px; + width: 8px; + height: 8px; + background: #fff; + border-radius: 50%; + opacity: 0; + transition: opacity 0.2s; + } - input[type="radio"]:checked + .prpl-custom-control::after { - opacity: 1; - background: #fff; + input[type="radio"]:checked + .prpl-custom-control::after { + opacity: 1; + background: #fff; + } } } - } - /* Used for next step button. */ - .prpl-steps-nav-wrapper { - margin-top: auto; - padding-top: 1rem; - display: flex; - justify-content: flex-end; - gap: 1rem; - align-self: flex-end; - width: 100%; + /* Used for next step button. */ + .prpl-steps-nav-wrapper { + margin-top: auto; + padding-top: 1rem; + display: flex; + justify-content: flex-end; + gap: 1rem; + align-self: flex-end; + width: 100%; - .prpl-button { - cursor: pointer; + .prpl-button { + cursor: pointer; - /* If the button has empty data-action attribute disable it. */ - &[data-action=""] { - pointer-events: none; - opacity: 0.5; + /* If the button has empty data-action attribute disable it. */ + &[data-action=""] { + pointer-events: none; + opacity: 0.5; + } } - } + } } } } diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index c5be321df..8f76d7f28 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -226,8 +226,8 @@ &[data-task-action="celebrate"] { - .prpl-suggested-task-button[data-action="snooze"] { - display: none; + .tooltip-actions { + pointer-events: none; /* Prevent clicking on actions while celebrating */ } } diff --git a/assets/js/suggested-task.js b/assets/js/suggested-task.js index 630b4b701..2cb4cb8ee 100644 --- a/assets/js/suggested-task.js +++ b/assets/js/suggested-task.js @@ -305,6 +305,11 @@ prplSuggestedTask = { ).removeAttribute( 'disabled' ); }, 2000 ); } else { + // Check the chekcbox, since completing task can be triggered in different ways ("Mark as done" button), without triggering the onchange event. + el.querySelector( + '.prpl-suggested-task-checkbox' + ).checked = true; + /** * Strike completed tasks and remove them from the DOM. */ diff --git a/assets/js/web-components/prpl-tooltip.js b/assets/js/web-components/prpl-tooltip.js index 12b0b9174..d9cefe08b 100644 --- a/assets/js/web-components/prpl-tooltip.js +++ b/assets/js/web-components/prpl-tooltip.js @@ -67,7 +67,6 @@ customElements.define( // Find the close button (or create a default one) let closeButton = closeSlot?.firstElementChild; - console.log( closeButton ); if ( ! closeButton ) { closeButton = document.createElement( 'button' ); closeButton.type = 'button'; diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index ad5955e03..a85459822 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -27,7 +27,6 @@

    - <# if ( 'user' === categorySlug ) { #>
    @@ -59,6 +58,15 @@

    <# if ( 'user' !== categorySlug ) { #>
    + <# if ( data.post.meta.prpl_dismissable ) { #> + + + + <# } #> + <# if ( data.post.content.rendered !== '' ) { #> @@ -111,13 +119,6 @@

    <# } #> - - <# if ( data.post.meta.prpl_dismissable && ! data.useCheckbox ) { #> - - <# } #>

    <# } #> From 860972bd0ea94cc5e97af513b9461cf9577e14f9 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Fri, 27 Jun 2025 08:36:50 +0300 Subject: [PATCH 012/204] CSS tweak --- assets/css/suggested-task.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index 8f76d7f28..3b514a69a 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -78,7 +78,8 @@ visibility: hidden; } - &:hover { + &:hover, + &:focus-within { .tooltip-actions { visibility: visible; From 023cfbc47e5d034a9fff986e2f6f5ac8670d1ffd Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Fri, 27 Jun 2025 09:46:18 +0200 Subject: [PATCH 013/204] CSS tweaks --- assets/css/page-widgets/suggested-tasks.css | 5 ++++- assets/css/suggested-task.css | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/css/page-widgets/suggested-tasks.css b/assets/css/page-widgets/suggested-tasks.css index cda08e6f2..61480807a 100644 --- a/assets/css/page-widgets/suggested-tasks.css +++ b/assets/css/page-widgets/suggested-tasks.css @@ -92,6 +92,7 @@ /* Style for "hover" links. */ .tooltip-actions { + padding-top: 2px; gap: 0.4rem; .tooltip-action { @@ -121,8 +122,10 @@ color: var(--prpl-color-link); } + /* we dont use icons here anymore */ button { - line-height: 1; /* we dont use icons here anymore */ + padding: 0; + line-height: 1; } } diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index 3b514a69a..5f528007e 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -2,8 +2,7 @@ margin: 0; padding: 0.5rem; display: flex; - flex-direction: column; - gap: 0.5rem; + flex-direction: column; /* For RR */ position: relative; line-height: 1.5; @@ -16,7 +15,7 @@ } .prpl-suggested-task-actions-wrapper { - padding-left: 1.5rem; + padding-left: 1.7rem; } h3 { From f1d5fd519b321bf773eac66aec89674aec8652eb Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Mon, 21 Jul 2025 12:28:43 +0200 Subject: [PATCH 014/204] blog post design adjustments --- assets/css/page-widgets/whats-new.css | 25 +++++++++++++++++++++---- views/page-widgets/whats-new.php | 12 ++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/assets/css/page-widgets/whats-new.css b/assets/css/page-widgets/whats-new.css index 46d3f4e1e..58691e5b4 100644 --- a/assets/css/page-widgets/whats-new.css +++ b/assets/css/page-widgets/whats-new.css @@ -12,8 +12,10 @@ h3 { margin-top: 0; - font-size: 1.15em; + font-size: var(--prpl-font-size-lg); + line-height: 1.25; font-weight: 600; + margin-bottom: 6px; > a { color: var(--prpl-color-headings); @@ -22,6 +24,11 @@ .prpl-external-link-icon { margin-inline-start: 0.15em; } + + &:hover { + color: var(--prpl-color-link); + text-decoration: underline; + } } } @@ -33,6 +40,11 @@ .prpl-widget-footer { display: flex; justify-content: flex-end; + + a { + text-decoration: none; + color: var(--prpl-color-gray-6); + } } } @@ -41,9 +53,14 @@ min-height: 120px; aspect-ratio: 16 / 9; background-size: cover; - margin-bottom: 1em; - border-radius: var(--prpl-border-radius); - box-shadow: 5px 5px 5px var(--prpl-color-gray-2); + margin-bottom: 0.75rem; + border-radius: var(--prpl-border-radius-big); border: 1px solid var(--prpl-color-gray-2); background-color: var(--prpl-color-gray-1); /* Fallback, if remote host image is not accessible */ + transition: transform 0.2s, box-shadow 0.2s; + + &:hover { + transform: scale(1.01); + box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.2); + } } diff --git a/views/page-widgets/whats-new.php b/views/page-widgets/whats-new.php index 986b765a7..1e0afd82d 100644 --- a/views/page-widgets/whats-new.php +++ b/views/page-widgets/whats-new.php @@ -15,7 +15,7 @@

    - +
      get_blog_feed() as $prpl_blog_post ) : ?>
    • -

      - - - -

      +

      + + + +


    • From f12a46e601db0401e2ba366d71693b323299468b Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Tue, 29 Jul 2025 13:45:04 +0300 Subject: [PATCH 015/204] Indentation fix --- views/js-templates/suggested-task.html | 162 ++++++++++++------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index 82eedf484..08368729a 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -28,99 +28,99 @@

      <# if ( 'user' === categorySlug ) { #> -
      - - - - +
      + + + + - -
      + +
      <# } #> <# if ( data.post.meta.prpl_points ) { #> - - +{{ data.post.meta.prpl_points }} - + + +{{ data.post.meta.prpl_points }} + <# } #>

    <# if ( 'user' !== categorySlug ) { #> -
    -
    - <# if ( data.post.meta.prpl_dismissable ) { #> - - - - <# } #> +
    +
    + <# if ( data.post.meta.prpl_dismissable ) { #> + + + + <# } #> - <# if ( data.post.content.rendered !== '' ) { #> - - - - - - {{{ data.post.content.rendered }}} - - - <# } #> + <# if ( data.post.content.rendered !== '' ) { #> + + + + + + {{{ data.post.content.rendered }}} + + + <# } #> - <# if ( data.post.meta.prpl_snoozable ) { #> - - - - - - -
    - - {{ data.l10n.snoozeThisTask }} - - -
    - <# _.each( { - '1-week': data.l10n.snoozeDurationOneWeek, - '1-month': data.l10n.snoozeDurationOneMonth, - '3-months': data.l10n.snoozeDurationThreeMonths, - '6-months': data.l10n.snoozeDurationSixMonths, - '1-year': data.l10n.snoozeDurationOneYear, - 'forever': data.l10n.snoozeDurationForever, - }, function( value, key ) { #> - - <# }); #> -
    -
    -
    -
    -
    - <# } #> + <# if ( data.post.meta.prpl_snoozable ) { #> + + + + + + +
    + + {{ data.l10n.snoozeThisTask }} + + +
    + <# _.each( { + '1-week': data.l10n.snoozeDurationOneWeek, + '1-month': data.l10n.snoozeDurationOneMonth, + '3-months': data.l10n.snoozeDurationThreeMonths, + '6-months': data.l10n.snoozeDurationSixMonths, + '1-year': data.l10n.snoozeDurationOneYear, + 'forever': data.l10n.snoozeDurationForever, + }, function( value, key ) { #> + + <# }); #> +
    +
    +
    +
    +
    + <# } #> +
    -
    <# } #> <# document.dispatchEvent( new CustomEvent( 'prpl/suggestedTask/itemInjected', { detail: data } ) ); #> From d9212e52a16780050f3c63588e6446aac4d8cace Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 30 Jul 2025 09:10:15 +0300 Subject: [PATCH 016/204] refactor todos template --- assets/js/suggested-task.js | 2 + classes/admin/class-enqueue.php | 1 + views/js-templates/suggested-task.html | 140 +++++++++++++------------ 3 files changed, 74 insertions(+), 69 deletions(-) diff --git a/assets/js/suggested-task.js b/assets/js/suggested-task.js index 8da968d46..c65690f3b 100644 --- a/assets/js/suggested-task.js +++ b/assets/js/suggested-task.js @@ -24,6 +24,8 @@ prplSuggestedTask = { snoozeDurationForever: prplL10n( 'snoozeDurationForever' ), disabledRRCheckboxTooltip: prplL10n( 'disabledRRCheckboxTooltip' ), markAsComplete: prplL10n( 'markAsComplete' ), + taskDelete: prplL10n( 'taskDelete' ), + delete: prplL10n( 'delete' ), }, /** diff --git a/classes/admin/class-enqueue.php b/classes/admin/class-enqueue.php index 392766eee..793e64560 100644 --- a/classes/admin/class-enqueue.php +++ b/classes/admin/class-enqueue.php @@ -368,6 +368,7 @@ public function get_localized_strings() { 'taskCompleted' => \esc_html__( "Task '%s' completed and moved to the bottom", 'progress-planner' ), /* translators: %s: The task content. */ 'taskDelete' => \esc_html__( "Delete task '%s'", 'progress-planner' ), + 'delete' => \esc_html__( 'Delete', 'progress-planner' ), 'taskMovedDown' => \esc_html__( 'Task moved down', 'progress-planner' ), 'taskMovedUp' => \esc_html__( 'Task moved up', 'progress-planner' ), /* translators: %s: The task content. */ diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index 08368729a..a219a8f80 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -39,11 +39,6 @@

    {{ data.l10n.moveDown }} - -

    <# } #> @@ -55,73 +50,80 @@

    - <# if ( 'user' !== categorySlug ) { #> -
    -
    - <# if ( data.post.meta.prpl_dismissable ) { #> - - - - <# } #> +
    +
    + <# if ( data.post.meta.prpl_dismissable ) { #> + + + + <# } #> - <# if ( data.post.content.rendered !== '' ) { #> - - - - - - {{{ data.post.content.rendered }}} - - - <# } #> + <# if ( data.post.content.rendered !== '' ) { #> + + + + + + {{{ data.post.content.rendered }}} + + + <# } #> - <# if ( data.post.meta.prpl_snoozable ) { #> - - - - - - -
    - - {{ data.l10n.snoozeThisTask }} - - -
    - <# _.each( { - '1-week': data.l10n.snoozeDurationOneWeek, - '1-month': data.l10n.snoozeDurationOneMonth, - '3-months': data.l10n.snoozeDurationThreeMonths, - '6-months': data.l10n.snoozeDurationSixMonths, - '1-year': data.l10n.snoozeDurationOneYear, - 'forever': data.l10n.snoozeDurationForever, - }, function( value, key ) { #> - - <# }); #> -
    -
    -
    -
    -
    - <# } #> -
    + <# if ( data.post.meta.prpl_snoozable ) { #> + + + + + + +
    + + {{ data.l10n.snoozeThisTask }} + + +
    + <# _.each( { + '1-week': data.l10n.snoozeDurationOneWeek, + '1-month': data.l10n.snoozeDurationOneMonth, + '3-months': data.l10n.snoozeDurationThreeMonths, + '6-months': data.l10n.snoozeDurationSixMonths, + '1-year': data.l10n.snoozeDurationOneYear, + 'forever': data.l10n.snoozeDurationForever, + }, function( value, key ) { #> + + <# }); #> +
    +
    +
    +
    +
    + <# } #> + + <# if ( 'user' === categorySlug ) { #> + + +
    + <# } #>
    - <# } #> +
    <# document.dispatchEvent( new CustomEvent( 'prpl/suggestedTask/itemInjected', { detail: data } ) ); #> From 14a79bb143b594e6dff703073023f86961e35e98 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 30 Jul 2025 09:13:36 +0300 Subject: [PATCH 017/204] remove transition --- assets/css/suggested-task.css | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index 5f528007e..d303adf88 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -119,7 +119,6 @@ color: var(--prpl-color-gray-3); cursor: pointer; box-shadow: none; - transition: all 0.1s; margin-top: 1px; } From f7d254db7e52a589e3836789c9da5228aaa84a5d Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 30 Jul 2025 09:29:44 +0300 Subject: [PATCH 018/204] Move points-wrapper & use a CSS grid to center things --- assets/css/suggested-task.css | 9 +++--- views/js-templates/suggested-task.html | 43 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index d303adf88..4a666f6df 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -1,9 +1,9 @@ .prpl-suggested-task { margin: 0; padding: 0.5rem; - display: flex; - flex-direction: column; /* For RR */ - + display: grid; + grid-template-columns: 1fr 2rem; + gap: 0 0.5rem; position: relative; line-height: 1.5; @@ -57,7 +57,8 @@ .prpl-suggested-task-points-wrapper { display: flex; gap: 0.5rem; - flex-shrink: 0; /* Prevent the actions from shrinking when the task title is too long */ + align-items: center; + grid-row-end: span 2; } .prpl-suggested-task-points { diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index a219a8f80..7a31961cb 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -24,30 +24,29 @@

    contenteditable="plaintext-only" onkeydown="prplSuggestedTask.preventEnterKey( event ); prplSuggestedTask.updateTaskTitle( this );" data-post-id="{{ data.post.id }}"<# } #>><# if ( data.post.meta.prpl_url ) { #>{{{ data.post.title.rendered }}}<# } else if ( data.post.meta.prpl_popover_id ) { #>{{{ data.post.title.rendered }}}<# } else { #>{{{ data.post.title.rendered }}}<# } #>

    + - -
    - <# if ( 'user' === categorySlug ) { #> -
    - - - - -
    - <# } #> - - <# if ( data.post.meta.prpl_points ) { #> - - +{{ data.post.meta.prpl_points }} +
    + <# if ( 'user' === categorySlug ) { #> +
    + + + - <# } #> -
    +
    + <# } #> + + <# if ( data.post.meta.prpl_points ) { #> + + +{{ data.post.meta.prpl_points }} + + <# } #>
    From a5f5c3edc32694e4f210b73eda454129233e0df2 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 30 Jul 2025 10:33:11 +0300 Subject: [PATCH 019/204] Reorder items and improve the grid --- assets/css/suggested-task.css | 22 ++++++--------- views/js-templates/suggested-task.html | 38 ++++++++++++++------------ 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/assets/css/suggested-task.css b/assets/css/suggested-task.css index 4a666f6df..984f9a5e7 100644 --- a/assets/css/suggested-task.css +++ b/assets/css/suggested-task.css @@ -2,7 +2,7 @@ margin: 0; padding: 0.5rem; display: grid; - grid-template-columns: 1fr 2rem; + grid-template-columns: 1.5rem 1fr 2rem; gap: 0 0.5rem; position: relative; line-height: 1.5; @@ -15,7 +15,8 @@ } .prpl-suggested-task-actions-wrapper { - padding-left: 1.7rem; + grid-column: 2 / span 1; + display: flex; } h3 { @@ -123,20 +124,15 @@ margin-top: 1px; } - .trash { - width: 1.25rem; - height: 1.25rem; - - &:hover svg path { - fill: var(--prpl-color-accent-red); - } - } - - .prpl-move-buttons { - padding: 0 0.5em; + .prpl-move-buttons, + .prpl-suggested-task-checkbox-wrapper, + .prpl-suggested-task-checkbox-wrapper label { display: flex; + width: 100%; gap: 0; flex-direction: column; + align-items: center; + justify-content: center; } .move-up, diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index 7a31961cb..7a60c3e46 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -4,44 +4,31 @@ var categorySlug = prplTerms.getTerm( data.post[ prplTerms.category ][0], prplTerms.category ).slug; #>
  • -
    +
    <# if ( data.useCheckbox ) { #> <# if ( ! data.post.meta.prpl_dismissable ) { #> - disabled<# } #> <# if ( 'trash' === data.post.status || 'pending' === data.post.status ) { #>checked<# } #>> + disabled<# } #> <# if ( 'trash' === data.post.status || 'pending' === data.post.status ) { #>checked<# } #>> {{{ data.l10n.disabledRRCheckboxTooltip }}} <# } else { #> <# } #> <# } #> +
    +

    contenteditable="plaintext-only" onkeydown="prplSuggestedTask.preventEnterKey( event ); prplSuggestedTask.updateTaskTitle( this );" data-post-id="{{ data.post.id }}"<# } #>><# if ( data.post.meta.prpl_url ) { #>{{{ data.post.title.rendered }}}<# } else if ( data.post.meta.prpl_popover_id ) { #>{{{ data.post.title.rendered }}}<# } else { #>{{{ data.post.title.rendered }}}<# } #>

    - <# if ( 'user' === categorySlug ) { #> -
    - - - - -
    - <# } #> - <# if ( data.post.meta.prpl_points ) { #> +{{ data.post.meta.prpl_points }} @@ -49,6 +36,21 @@

    <# } #>

    + <# if ( 'user' === categorySlug ) { #> +
    + + + + +
    + <# } #> +
    <# if ( data.post.meta.prpl_dismissable ) { #> From c372920e0f229013bd66e2c9bd3be7b824b45cf8 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Thu, 7 Aug 2025 07:48:21 +0300 Subject: [PATCH 020/204] trigger resize after removing items at the end of a celebration --- assets/js/celebrate.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/js/celebrate.js b/assets/js/celebrate.js index 05479ac62..643d823b7 100644 --- a/assets/js/celebrate.js +++ b/assets/js/celebrate.js @@ -99,7 +99,10 @@ document.addEventListener( 'prpl/removeCelebratedTasks', () => { item.classList.add( 'prpl-suggested-task-celebrated' ); // Remove the item from the DOM. - setTimeout( () => item.remove(), 2000 ); + setTimeout( () => { + item.remove(); + window.dispatchEvent( new CustomEvent( 'prpl/grid/resize' ) ); + }, 2000 ); } ); } ); From fc38269c2ddcc1b60ce5864d0df66ace9c234aff Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Fri, 8 Aug 2025 13:39:02 +0300 Subject: [PATCH 021/204] Use arrows --- assets/js/suggested-task.js | 11 +++++++++++ assets/js/widgets/todo.js | 6 ++++++ views/js-templates/suggested-task.html | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/assets/js/suggested-task.js b/assets/js/suggested-task.js index c65690f3b..da8347e77 100644 --- a/assets/js/suggested-task.js +++ b/assets/js/suggested-task.js @@ -82,6 +82,8 @@ prplSuggestedTask = { item, listId: 'prpl-suggested-tasks-list', insertPosition: 'beforeend', + useCheckbox: false, + useArrow: true, }, } ) ); @@ -116,6 +118,8 @@ prplSuggestedTask = { item, listId: 'prpl-suggested-tasks-list', insertPosition: 'beforeend', + useCheckbox: false, + useArrow: true, }, } ) ); @@ -150,10 +154,12 @@ prplSuggestedTask = { * * @param {Object} post The post object. * @param {boolean} useCheckbox Whether to use a checkbox. + * @param {boolean} useArrow Whether to use an arrow. */ getNewItemTemplatePromise: ( { post = {}, useCheckbox = true, + useArrow = false, listId = '', } ) => new Promise( ( resolve ) => { @@ -183,6 +189,7 @@ prplSuggestedTask = { post, terms, useCheckbox, + useArrow, listId, assets: prplSuggestedTask.assets, action: 'pending' === post.status ? 'celebrate' : '', @@ -543,6 +550,8 @@ document.addEventListener( 'prpl/suggestedTask/injectItem', ( event ) => { .getNewItemTemplatePromise( { post: event.detail.item, listId: event.detail.listId, + useCheckbox: event.detail.useCheckbox || false, + useArrow: event.detail.useArrow || true, } ) .then( ( itemHTML ) => { /** @@ -579,6 +588,8 @@ document.addEventListener( 'prpl/suggestedTask/injectItem', ( event ) => { item: event.detail.item, listId: event.detail.listId, insertPosition: event.detail.insertPosition, + useCheckbox: event.detail.useCheckbox || true, + useArrow: event.detail.useArrow || false, }, } ) ); diff --git a/assets/js/widgets/todo.js b/assets/js/widgets/todo.js index e2d295118..592a22696 100644 --- a/assets/js/widgets/todo.js +++ b/assets/js/widgets/todo.js @@ -61,6 +61,8 @@ const prplTodoWidget = { item.status === 'publish' ? 'todo-list' : 'todo-list-completed', + useCheckbox: true, + useArrow: false, }, } ) ); @@ -96,6 +98,8 @@ const prplTodoWidget = { item.status === 'publish' ? 'todo-list' : 'todo-list-completed', + useCheckbox: true, + useArrow: false, }, } ) ); @@ -163,6 +167,8 @@ const prplTodoWidget = { ? 'afterbegin' : 'beforeend', // Add golden task to the start of the list. listId: 'todo-list', + useCheckbox: true, + useArrow: false, }, } ) ); diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index 7a60c3e46..1730c55cd 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -19,6 +19,10 @@ {{{ data.post.title.rendered }}}: {{ data.l10n.markAsComplete }} <# } #> + <# } else if ( data.useArrow ) { #> + + + <# } #>
    From 3b547cf3a81a60910053f81fc36d7236b6403a84 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Fri, 8 Aug 2025 15:00:03 +0200 Subject: [PATCH 022/204] color: var(--prpl-color-link); --- assets/css/page-widgets/whats-new.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/page-widgets/whats-new.css b/assets/css/page-widgets/whats-new.css index 58691e5b4..d78af57ab 100644 --- a/assets/css/page-widgets/whats-new.css +++ b/assets/css/page-widgets/whats-new.css @@ -43,7 +43,7 @@ a { text-decoration: none; - color: var(--prpl-color-gray-6); + color: var(--prpl-color-link); } } } From 9aec916a2c9243f13ef177944c5d1a4b4dca5aaf Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Mon, 11 Aug 2025 11:40:46 +0200 Subject: [PATCH 023/204] blog "read all posts" styling & divider color --- assets/css/admin.css | 1 + assets/css/page-widgets/whats-new.css | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 6e4e6bdfa..507a52af4 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -245,6 +245,7 @@ button.prpl-info-icon { hr { margin-top: 1.25rem; margin-bottom: 1.25rem; + border-top-color: var(--prpl-color-gray-2); } } diff --git a/assets/css/page-widgets/whats-new.css b/assets/css/page-widgets/whats-new.css index d78af57ab..15b790b6a 100644 --- a/assets/css/page-widgets/whats-new.css +++ b/assets/css/page-widgets/whats-new.css @@ -42,8 +42,13 @@ justify-content: flex-end; a { - text-decoration: none; color: var(--prpl-color-link); + text-decoration: underline; + + &:hover { + color: var(--prpl-color-gray-6); + text-decoration: none; + } } } } From 1debf9ad756b9a0c2ba51386bac4c90878ce5274 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Mon, 18 Aug 2025 15:30:16 +0200 Subject: [PATCH 024/204] blog post image aspect-ratio: 3 / 2; --- assets/css/page-widgets/whats-new.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/page-widgets/whats-new.css b/assets/css/page-widgets/whats-new.css index 15b790b6a..598f4e2ce 100644 --- a/assets/css/page-widgets/whats-new.css +++ b/assets/css/page-widgets/whats-new.css @@ -56,7 +56,7 @@ .prpl-blog-post-image { width: 100%; min-height: 120px; - aspect-ratio: 16 / 9; + aspect-ratio: 3 / 2; background-size: cover; margin-bottom: 0.75rem; border-radius: var(--prpl-border-radius-big); From d976c73ed378ed138274a37becea75aa996c77ff Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Tue, 19 Aug 2025 10:12:17 +0300 Subject: [PATCH 025/204] Implement "Why is this important?" links --- assets/js/suggested-task.js | 1 + classes/admin/class-enqueue.php | 3 ++ classes/class-suggested-tasks-db.php | 1 + classes/class-suggested-tasks.php | 21 +++++---- .../providers/class-blog-description.php | 13 +++--- .../providers/class-collaborator.php | 27 +++++------ .../providers/class-content-create.php | 20 +++------ .../providers/class-content-review.php | 27 +++++------ .../providers/class-core-update.php | 13 +++--- .../providers/class-debug-display.php | 12 +++-- .../class-disable-comment-pagination.php | 12 +++-- .../providers/class-disable-comments.php | 14 ++++-- .../providers/class-email-sending.php | 1 + .../providers/class-fewer-tags.php | 12 +++-- .../providers/class-hello-world.php | 21 ++++++--- .../providers/class-permalink-structure.php | 13 +++--- .../providers/class-php-version.php | 12 +++-- .../class-remove-inactive-plugins.php | 13 +++--- .../class-rename-uncategorized-category.php | 13 +++--- .../providers/class-sample-page.php | 21 ++++++--- .../class-search-engine-visibility.php | 13 +++--- .../class-set-valuable-post-types.php | 13 +++--- .../providers/class-site-icon.php | 13 +++--- .../providers/class-tasks-interactive.php | 7 +-- .../suggested-tasks/providers/class-tasks.php | 45 +++++++++++++------ .../yoast/class-archive-author.php | 13 +++--- .../integrations/yoast/class-archive-date.php | 13 +++--- .../yoast/class-archive-format.php | 13 +++--- .../yoast/class-cornerstone-workout.php | 13 +++--- .../class-crawl-settings-emoji-scripts.php | 13 +++--- .../class-crawl-settings-feed-authors.php | 13 +++--- ...ss-crawl-settings-feed-global-comments.php | 13 +++--- .../yoast/class-fix-orphaned-content.php | 13 +++--- .../integrations/yoast/class-media-pages.php | 13 +++--- .../yoast/class-organization-logo.php | 22 +++++---- .../yoast/class-orphaned-content-workout.php | 13 +++--- classes/wp-cli/class-task-command.php | 2 + views/js-templates/suggested-task.html | 6 +++ 38 files changed, 330 insertions(+), 191 deletions(-) diff --git a/assets/js/suggested-task.js b/assets/js/suggested-task.js index da8347e77..d706cb7b6 100644 --- a/assets/js/suggested-task.js +++ b/assets/js/suggested-task.js @@ -26,6 +26,7 @@ prplSuggestedTask = { markAsComplete: prplL10n( 'markAsComplete' ), taskDelete: prplL10n( 'taskDelete' ), delete: prplL10n( 'delete' ), + whyIsThisImportant: prplL10n( 'whyIsThisImportant' ), }, /** diff --git a/classes/admin/class-enqueue.php b/classes/admin/class-enqueue.php index 5823cee00..eaee9b10f 100644 --- a/classes/admin/class-enqueue.php +++ b/classes/admin/class-enqueue.php @@ -238,6 +238,8 @@ public function localize_script( $handle, $localize_data = [] ) { ] ); + $tasks_providers = \progress_planner()->get_suggested_tasks()->get_tasks_manager()->get_task_providers(); + $localize_data = [ 'name' => 'prplSuggestedTask', 'data' => [ @@ -390,6 +392,7 @@ public function get_localized_strings() { 'watchVideo' => \esc_html__( 'Watch video', 'progress-planner' ), 'disabledRRCheckboxTooltip' => \esc_html__( 'Don\'t worry! This task will be checked off automatically when you\'ve completed it.', 'progress-planner' ), 'opensInNewWindow' => \esc_html__( 'Opens in new window', 'progress-planner' ), + 'whyIsThisImportant' => \esc_html__( 'Why is this important?', 'progress-planner' ), /* translators: %s: The plugin name. */ 'installPlugin' => \esc_html__( 'Install and activate the "%s" plugin', 'progress-planner' ), /* translators: %s: The plugin name. */ diff --git a/classes/class-suggested-tasks-db.php b/classes/class-suggested-tasks-db.php index 960886cf9..f5ba2a653 100644 --- a/classes/class-suggested-tasks-db.php +++ b/classes/class-suggested-tasks-db.php @@ -176,6 +176,7 @@ public function update_recommendation( $id, $data ) { case 'points': case 'prpl_points': case 'prpl_popover_id': + case 'prpl_external_link_url': $update_meta[ 'prpl_' . \str_replace( 'prpl_', '', (string) $key ) ] = $value; break; diff --git a/classes/class-suggested-tasks.php b/classes/class-suggested-tasks.php index 1adcf03c9..7d556745c 100644 --- a/classes/class-suggested-tasks.php +++ b/classes/class-suggested-tasks.php @@ -287,43 +287,48 @@ public function register_post_type() { ); $rest_meta_fields = [ - 'prpl_points' => [ + 'prpl_points' => [ 'type' => 'number', 'single' => true, 'show_in_rest' => true, ], - 'prpl_task_id' => [ + 'prpl_task_id' => [ 'type' => 'string', 'single' => true, 'show_in_rest' => true, ], - 'prpl_url' => [ + 'prpl_url' => [ 'type' => 'string', 'single' => true, 'show_in_rest' => true, ], - 'prpl_url_target' => [ + 'prpl_url_target' => [ 'type' => 'string', 'single' => true, 'show_in_rest' => true, ], - 'prpl_dismissable' => [ + 'prpl_dismissable' => [ 'type' => 'boolean', 'single' => true, 'show_in_rest' => true, ], - 'prpl_snoozable' => [ + 'prpl_snoozable' => [ 'type' => 'boolean', 'single' => true, 'show_in_rest' => true, ], - 'menu_order' => [ + 'menu_order' => [ 'type' => 'number', 'single' => true, 'show_in_rest' => true, 'default' => 0, ], - 'prpl_popover_id' => [ + 'prpl_popover_id' => [ + 'type' => 'string', + 'single' => true, + 'show_in_rest' => true, + ], + 'prpl_external_link_url' => [ 'type' => 'string', 'single' => true, 'show_in_rest' => true, diff --git a/classes/suggested-tasks/providers/class-blog-description.php b/classes/suggested-tasks/providers/class-blog-description.php index 3af16ffaf..166d5f13e 100644 --- a/classes/suggested-tasks/providers/class-blog-description.php +++ b/classes/suggested-tasks/providers/class-blog-description.php @@ -33,6 +33,13 @@ class Blog_Description extends Tasks_Interactive { */ const POPOVER_ID = 'core-blogdescription'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/set-tagline'; + /** * Get the task title. * @@ -48,11 +55,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s:tagline link */ - \esc_html__( 'Set the %s to make your website look more professional.', 'progress-planner' ), - '' . \esc_html__( 'tagline', 'progress-planner' ) . '' - ); + return \esc_html__( 'Set the tagline to make your website look more professional.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-collaborator.php b/classes/suggested-tasks/providers/class-collaborator.php index 556ddfca0..c155626f1 100644 --- a/classes/suggested-tasks/providers/class-collaborator.php +++ b/classes/suggested-tasks/providers/class-collaborator.php @@ -90,19 +90,20 @@ public function get_task_details( $task_data = [] ) { return \wp_parse_args( $task, [ - 'task_id' => '', - 'title' => '', - 'parent' => 0, - 'provider_id' => $this->get_provider_id(), - 'category' => $this->get_provider_category(), - 'priority' => 'medium', - 'points' => 0, - 'url' => '', - 'url_target' => '_self', - 'description' => '', - 'link_setting' => [], - 'dismissable' => true, - 'snoozable' => false, + 'task_id' => '', + 'title' => '', + 'parent' => 0, + 'provider_id' => $this->get_provider_id(), + 'category' => $this->get_provider_category(), + 'priority' => 'medium', + 'points' => 0, + 'url' => '', + 'url_target' => '_self', + 'description' => '', + 'link_setting' => [], + 'dismissable' => true, + 'snoozable' => false, + 'external_link_url' => $this->get_external_link_url(), ] ); } diff --git a/classes/suggested-tasks/providers/class-content-create.php b/classes/suggested-tasks/providers/class-content-create.php index d45c22c2e..a46cebd47 100644 --- a/classes/suggested-tasks/providers/class-content-create.php +++ b/classes/suggested-tasks/providers/class-content-create.php @@ -42,6 +42,13 @@ class Content_Create extends Tasks { */ protected const DATA_COLLECTOR_CLASS = Last_Published_Post_Data_Collector::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/valuable-content'; + /** * Whether the task is repetitive. * @@ -74,19 +81,6 @@ protected function get_title() { return \esc_html__( 'Create valuable content', 'progress-planner' ); } - /** - * Get the task description. - * - * @return string - */ - protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Time to add more valuable content to your site! Check our blog for inspiration. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); - } - /** * Add task data. * diff --git a/classes/suggested-tasks/providers/class-content-review.php b/classes/suggested-tasks/providers/class-content-review.php index 7174bf4cc..3e2d8c651 100644 --- a/classes/suggested-tasks/providers/class-content-review.php +++ b/classes/suggested-tasks/providers/class-content-review.php @@ -314,19 +314,20 @@ public function get_tasks_to_inject() { } $task_to_inject[] = [ - 'task_id' => $this->get_task_id( [ 'target_post_id' => $task_data['target_post_id'] ] ), - 'provider_id' => $this->get_provider_id(), - 'category' => $this->get_provider_category(), - 'target_post_id' => $task_data['target_post_id'], - 'target_post_type' => $task_data['target_post_type'], - 'date' => \gmdate( 'YW' ), - 'post_title' => $this->get_title_with_data( $task_data ), - 'description' => $this->get_description_with_data( $task_data ), - 'url' => $this->get_url_with_data( $task_data ), - 'url_target' => $this->get_url_target(), - 'dismissable' => $this->is_dismissable(), - 'snoozable' => $this->is_snoozable, - 'points' => $this->get_points(), + 'task_id' => $this->get_task_id( [ 'target_post_id' => $task_data['target_post_id'] ] ), + 'provider_id' => $this->get_provider_id(), + 'category' => $this->get_provider_category(), + 'target_post_id' => $task_data['target_post_id'], + 'target_post_type' => $task_data['target_post_type'], + 'date' => \gmdate( 'YW' ), + 'post_title' => $this->get_title_with_data( $task_data ), + 'description' => $this->get_description_with_data( $task_data ), + 'url' => $this->get_url_with_data( $task_data ), + 'url_target' => $this->get_url_target(), + 'dismissable' => $this->is_dismissable(), + 'snoozable' => $this->is_snoozable, + 'points' => $this->get_points(), + 'external_link_url' => $this->get_external_link_url(), ]; } diff --git a/classes/suggested-tasks/providers/class-core-update.php b/classes/suggested-tasks/providers/class-core-update.php index 5564821a4..87a2e0bf3 100644 --- a/classes/suggested-tasks/providers/class-core-update.php +++ b/classes/suggested-tasks/providers/class-core-update.php @@ -33,6 +33,13 @@ class Core_Update extends Tasks { */ protected const CAPABILITY = 'update_core'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/perform-all-updates'; + /** * Whether the task is repetitive. * @@ -82,11 +89,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s:See why we recommend this link */ - \esc_html__( 'Regular updates improve security and performance. %s.', 'progress-planner' ), - '' . \esc_html__( 'See why we recommend this', 'progress-planner' ) . '' - ); + return \esc_html__( 'Regular updates improve security and performance.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-debug-display.php b/classes/suggested-tasks/providers/class-debug-display.php index c0789c055..ad8d3fc41 100644 --- a/classes/suggested-tasks/providers/class-debug-display.php +++ b/classes/suggested-tasks/providers/class-debug-display.php @@ -26,6 +26,13 @@ class Debug_Display extends Tasks { */ protected const PROVIDER_ID = 'wp-debug-display'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/set-wp-debug'; + /** * Get the task title. * @@ -43,10 +50,9 @@ protected function get_title() { */ protected function get_description( $task_data = [] ) { return \sprintf( - // translators: %1$s is the name of the WP_DEBUG_DISPLAY constant, %2$s We recommend link. - \esc_html__( '%1$s is enabled. This means that errors are shown to users. %2$s disabling it.', 'progress-planner' ), + // translators: %s is the name of the WP_DEBUG_DISPLAY constant. + \esc_html__( '%s is enabled. This means that errors are shown to users. We recommend disabling it.', 'progress-planner' ), 'WP_DEBUG_DISPLAY', - '' . \esc_html__( 'We recommend', 'progress-planner' ) . '' ); } diff --git a/classes/suggested-tasks/providers/class-disable-comment-pagination.php b/classes/suggested-tasks/providers/class-disable-comment-pagination.php index cc36d4ed7..277bf6579 100644 --- a/classes/suggested-tasks/providers/class-disable-comment-pagination.php +++ b/classes/suggested-tasks/providers/class-disable-comment-pagination.php @@ -33,6 +33,13 @@ class Disable_Comment_Pagination extends Tasks_Interactive { */ const POPOVER_ID = 'disable-comment-pagination'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/disable-comment-pagination'; + /** * Get the task URL. * @@ -70,10 +77,9 @@ protected function get_title() { */ protected function get_description() { return \sprintf( - /* translators: %d is the number of comments per page, %s is the "recommend to disable comment pagination" link */ - \esc_html__( 'When comment pagination is enabled, your site creates a new page for every %1$d comments. This is not helping your website in search engines, and can break up the ongoing conversation. That\'s why we %2$s.', 'progress-planner' ), + /* translators: %d is the number of comments per page.*/ + \esc_html__( 'When comment pagination is enabled, your site creates a new page for every %d comments. This is not helping your website in search engines, and can break up the ongoing conversation. That\'s why we recommend to disable comment pagination.', 'progress-planner' ), (int) \get_option( 'comments_per_page' ), - '' . \esc_html__( 'recommend to disable comment pagination', 'progress-planner' ) . '' ); } diff --git a/classes/suggested-tasks/providers/class-disable-comments.php b/classes/suggested-tasks/providers/class-disable-comments.php index 9fdbe5064..27f4e9b6a 100644 --- a/classes/suggested-tasks/providers/class-disable-comments.php +++ b/classes/suggested-tasks/providers/class-disable-comments.php @@ -33,6 +33,13 @@ class Disable_Comments extends Tasks_Interactive { */ const POPOVER_ID = 'disable-comments'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/disable-comments'; + /** * Get the task URL. * @@ -71,16 +78,15 @@ protected function get_title() { protected function get_description() { return \sprintf( \esc_html( - // translators: %d is the number of approved comments, %s is the disabling them link. + // translators: %d is the number of approved comments. \_n( - 'There is %1$d comment. If you don\'t need comments on your site, consider %2$s.', - 'There are %1$d comments. If you don\'t need comments on your site, consider %2$s.', + 'There is %1$d comment. If you don\'t need comments on your site, consider disabling them.', + 'There are %1$d comments. If you don\'t need comments on your site, consider disabling them.', (int) \wp_count_comments()->approved, 'progress-planner' ) ), (int) \wp_count_comments()->approved, - '' . \esc_html__( 'disabling them', 'progress-planner' ) . '', ); } diff --git a/classes/suggested-tasks/providers/class-email-sending.php b/classes/suggested-tasks/providers/class-email-sending.php index 5b2872f9c..549d4ece7 100644 --- a/classes/suggested-tasks/providers/class-email-sending.php +++ b/classes/suggested-tasks/providers/class-email-sending.php @@ -283,6 +283,7 @@ public function the_popover_content() { 'popovers/email-sending.php', [ 'prpl_popover_id' => static::POPOVER_ID, + 'prpl_external_link_url' => $this->get_external_link_url(), 'prpl_provider_id' => $this->get_provider_id(), 'prpl_email_subject' => $this->email_subject, 'prpl_email_error' => $this->email_error, diff --git a/classes/suggested-tasks/providers/class-fewer-tags.php b/classes/suggested-tasks/providers/class-fewer-tags.php index 0bdf17cf2..824910668 100644 --- a/classes/suggested-tasks/providers/class-fewer-tags.php +++ b/classes/suggested-tasks/providers/class-fewer-tags.php @@ -37,6 +37,13 @@ class Fewer_Tags extends Tasks { */ const PROVIDER_ID = 'fewer-tags'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/install-fewer-tags'; + /** * The task priority. * @@ -113,11 +120,10 @@ protected function get_title() { */ protected function get_description() { return \sprintf( - // translators: %1$s is the number of tags, %2$s is the number of published posts, %3$s Read more link. - \esc_html__( 'We detected that you have %1$s tags and %2$s published posts. Consider installing the "Fewer Tags" plugin. %3$s', 'progress-planner' ), + // translators: %1$s is the number of tags, %2$s is the number of published posts. + \esc_html__( 'We detected that you have %1$s tags and %2$s published posts. Consider installing the "Fewer Tags" plugin.', 'progress-planner' ), $this->post_tag_count_data_collector->collect(), $this->published_post_count_data_collector->collect(), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' ); } diff --git a/classes/suggested-tasks/providers/class-hello-world.php b/classes/suggested-tasks/providers/class-hello-world.php index 59317f634..f074c9283 100644 --- a/classes/suggested-tasks/providers/class-hello-world.php +++ b/classes/suggested-tasks/providers/class-hello-world.php @@ -49,6 +49,13 @@ class Hello_World extends Tasks_Interactive { */ const POPOVER_ID = 'hello-world'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/delete-hello-world-post'; + /** * Get the task URL. * @@ -97,15 +104,17 @@ protected function get_description() { $hello_world_post_url = (string) \get_permalink( $hello_world_post_id ); - return '

    ' . \sprintf( + $content = '

    '; + $content .= \sprintf( /* translators: %s: Link to the post. */ \esc_html__( 'On install, WordPress creates a "Hello World!" post. You can find yours at %s.', 'progress-planner' ), '' . \esc_html( $hello_world_post_url ) . '', - ) . '

    ' . \sprintf( - /* translators: %s: URL to https://prpl.fyi/delete-sample-page */ - \__( 'This post does not add value to your website and solely exists to show what a post can look like. Therefore, "Hello World!" is not needed and should be deleted.', 'progress-planner' ), - 'https://prpl.fyi/delete-hello-world-post' - ) . '

    '; + ); + $content .= '

    '; + $content .= \esc_html__( 'This post does not add value to your website and solely exists to show what a post can look like. Therefore, "Hello World!" is not needed and should be deleted.', 'progress-planner' ); + $content .= '

    '; + + return $content; } /** diff --git a/classes/suggested-tasks/providers/class-permalink-structure.php b/classes/suggested-tasks/providers/class-permalink-structure.php index f0993387d..903b0f005 100644 --- a/classes/suggested-tasks/providers/class-permalink-structure.php +++ b/classes/suggested-tasks/providers/class-permalink-structure.php @@ -26,6 +26,13 @@ class Permalink_Structure extends Tasks { */ protected const PROVIDER_ID = 'core-permalink-structure'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/change-default-permalink-structure'; + /** * Get the task URL. * @@ -77,11 +84,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %1$s We recommend link */ - \esc_html__( 'On install, WordPress sets the permalink structure to a format that is not SEO-friendly. %1$s changing it.', 'progress-planner' ), - '' . \esc_html__( 'We recommend', 'progress-planner' ) . '', - ); + return \esc_html__( 'On install, WordPress sets the permalink structure to a format that is not SEO-friendly. We recommend changing it.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-php-version.php b/classes/suggested-tasks/providers/class-php-version.php index 8a97dc06f..1b86daab2 100644 --- a/classes/suggested-tasks/providers/class-php-version.php +++ b/classes/suggested-tasks/providers/class-php-version.php @@ -33,6 +33,13 @@ class Php_Version extends Tasks { */ protected const RECOMMENDED_PHP_VERSION = '8.2'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/update-php-version'; + /** * Get the title. * @@ -50,10 +57,9 @@ protected function get_title() { */ protected function get_description( $task_data = [] ) { return \sprintf( - /* translators: %1$s: php version, %2$s: We recommend link. %3$s: minimum PHP version recommended. */ - \esc_html__( 'Your site is running on PHP version %1$s. %2$s updating to PHP version %3$s or higher.', 'progress-planner' ), + /* translators: %1$s: php version, %2$s: minimum PHP version recommended. */ + \esc_html__( 'Your site is running on PHP version %1$s. We recommend updating to PHP version %2$s or higher.', 'progress-planner' ), \phpversion(), - '' . \esc_html__( 'We recommend', 'progress-planner' ) . '', \esc_html( self::RECOMMENDED_PHP_VERSION ) ); } diff --git a/classes/suggested-tasks/providers/class-remove-inactive-plugins.php b/classes/suggested-tasks/providers/class-remove-inactive-plugins.php index 5145b0de1..1ff4baeba 100644 --- a/classes/suggested-tasks/providers/class-remove-inactive-plugins.php +++ b/classes/suggested-tasks/providers/class-remove-inactive-plugins.php @@ -35,6 +35,13 @@ class Remove_Inactive_Plugins extends Tasks { */ protected const DATA_COLLECTOR_CLASS = Inactive_Plugins_Data_Collector::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/remove-inactive-plugins'; + /** * Get the task URL. * @@ -59,11 +66,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %1$s removing any plugins link */ - \esc_html__( 'You have inactive plugins. Consider %1$s that are not activated to free up resources, and improve security.', 'progress-planner' ), - '' . \esc_html__( 'removing any plugins', 'progress-planner' ) . '', - ); + return \esc_html__( 'You have inactive plugins. Consider removing any plugins that are not activated to free up resources, and improve security.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-rename-uncategorized-category.php b/classes/suggested-tasks/providers/class-rename-uncategorized-category.php index f0ef97be5..079918f19 100644 --- a/classes/suggested-tasks/providers/class-rename-uncategorized-category.php +++ b/classes/suggested-tasks/providers/class-rename-uncategorized-category.php @@ -42,6 +42,13 @@ class Rename_Uncategorized_Category extends Tasks { */ protected const DATA_COLLECTOR_CLASS = Uncategorized_Category_Data_Collector::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/rename-uncategorized-category'; + /** * Get the task URL. * @@ -66,11 +73,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %1$s We recommend link */ - \esc_html__( 'The Uncategorized category is used for posts that don\'t have a category. %1$s renaming it to something that fits your site better.', 'progress-planner' ), - '' . \esc_html__( 'We recommend', 'progress-planner' ) . '', - ); + return \esc_html__( 'The Uncategorized category is used for posts that don\'t have a category. We recommend renaming it to something that fits your site better.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-sample-page.php b/classes/suggested-tasks/providers/class-sample-page.php index 39e848f3b..2b5180a9e 100644 --- a/classes/suggested-tasks/providers/class-sample-page.php +++ b/classes/suggested-tasks/providers/class-sample-page.php @@ -49,6 +49,13 @@ class Sample_Page extends Tasks_Interactive { */ const POPOVER_ID = 'sample-page'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/delete-sample-page'; + /** * Get the task URL. * @@ -96,15 +103,17 @@ protected function get_description() { $sample_page_url = (string) \get_permalink( $sample_page_id ); - return '

    ' . \sprintf( + $content = '

    '; + $content .= \sprintf( /* translators: %s: Link to the post. */ \esc_html__( 'On install, WordPress creates a "Sample Page" page. You can find yours at %s.', 'progress-planner' ), '' . \esc_html( $sample_page_url ) . '', - ) . '

    ' . \sprintf( - /* translators: %s: URL to https://prpl.fyi/delete-sample-page */ - \__( 'This page does not add value to your website and solely exists to show what a page can look like. Therefore, "Sample Page" is not needed and should be deleted.', 'progress-planner' ), - 'https://prpl.fyi/delete-sample-page' - ) . '

    '; + ); + $content .= '

    '; + $content .= \esc_html__( 'This page does not add value to your website and solely exists to show what a page can look like. Therefore, "Sample Page" is not needed and should be deleted.', 'progress-planner' ); + $content .= '

    '; + + return $content; } /** diff --git a/classes/suggested-tasks/providers/class-search-engine-visibility.php b/classes/suggested-tasks/providers/class-search-engine-visibility.php index d94ff4bde..f72fd1809 100644 --- a/classes/suggested-tasks/providers/class-search-engine-visibility.php +++ b/classes/suggested-tasks/providers/class-search-engine-visibility.php @@ -26,6 +26,13 @@ class Search_Engine_Visibility extends Tasks { */ protected const PROVIDER_ID = 'search-engine-visibility'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/blog-indexing-settings'; + /** * Get the task URL. * @@ -62,11 +69,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %1$s allowing search engines link */ - \esc_html__( 'Your site is not currently visible to search engines. Consider %1$s to index your site.', 'progress-planner' ), - '' . \esc_html__( 'allowing search engines', 'progress-planner' ) . '', - ); + return \esc_html__( 'Your site is not currently visible to search engines. Consider allowing search engines to index your site.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-set-valuable-post-types.php b/classes/suggested-tasks/providers/class-set-valuable-post-types.php index 35d0db935..151faa08b 100644 --- a/classes/suggested-tasks/providers/class-set-valuable-post-types.php +++ b/classes/suggested-tasks/providers/class-set-valuable-post-types.php @@ -26,6 +26,13 @@ class Set_Valuable_Post_Types extends Tasks { */ protected const IS_ONBOARDING_TASK = false; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/valuable-content'; + /** * The task priority. * @@ -77,11 +84,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s:Read more link */ - \esc_html__( 'Tell us which post types matter most for your site. Go to your settings and select your valuable content types. %s', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Tell us which post types matter most for your site. Go to your settings and select your valuable content types.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-site-icon.php b/classes/suggested-tasks/providers/class-site-icon.php index 619ac9371..a8a59fa89 100644 --- a/classes/suggested-tasks/providers/class-site-icon.php +++ b/classes/suggested-tasks/providers/class-site-icon.php @@ -26,6 +26,13 @@ class Site_Icon extends Tasks { */ protected const PROVIDER_ID = 'core-siteicon'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/set-site-icon'; + /** * Get the link setting. * @@ -62,11 +69,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s:site icon link */ - \esc_html__( 'Set the %s to make your website look more professional.', 'progress-planner' ), - '' . \esc_html__( 'site icon', 'progress-planner' ) . '' - ); + return \esc_html__( 'Set the site icon to make your website look more professional.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/class-tasks-interactive.php b/classes/suggested-tasks/providers/class-tasks-interactive.php index c4b80b1db..6eb5fbe5b 100644 --- a/classes/suggested-tasks/providers/class-tasks-interactive.php +++ b/classes/suggested-tasks/providers/class-tasks-interactive.php @@ -124,9 +124,10 @@ public function the_popover_content() { '/views/popovers/interactive-task.php', ], [ - 'prpl_task_object' => $this, - 'prpl_popover_id' => static::POPOVER_ID, - 'prpl_provider_id' => $this->get_provider_id(), + 'prpl_task_object' => $this, + 'prpl_popover_id' => static::POPOVER_ID, + 'prpl_external_link_url' => $this->get_external_link_url(), + 'prpl_provider_id' => $this->get_provider_id(), ] ); } diff --git a/classes/suggested-tasks/providers/class-tasks.php b/classes/suggested-tasks/providers/class-tasks.php index fc0a5497f..917af9059 100644 --- a/classes/suggested-tasks/providers/class-tasks.php +++ b/classes/suggested-tasks/providers/class-tasks.php @@ -59,6 +59,13 @@ abstract class Tasks implements Tasks_Interface { */ protected const DEPENDENCIES = []; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = ''; + /** * Whether the task is repetitive. * @@ -255,6 +262,15 @@ public function get_provider_id() { return static::PROVIDER_ID; } + /** + * Get external link URL. + * + * @return string + */ + public function get_external_link_url() { + return static::EXTERNAL_LINK_URL; + } + /** * Get the task ID. * @@ -518,20 +534,21 @@ protected function modify_evaluated_task_data( $task_data ) { */ public function get_task_details( $task_data = [] ) { return [ - 'task_id' => $this->get_task_id( $task_data ), - 'provider_id' => $this->get_provider_id(), - 'post_title' => $this->get_title_with_data( $task_data ), - 'description' => $this->get_description_with_data( $task_data ), - 'parent' => $this->get_parent(), - 'priority' => $this->get_priority(), - 'category' => $this->get_provider_category(), - 'points' => $this->get_points(), - 'date' => \gmdate( 'YW' ), - 'url' => $this->get_url_with_data( $task_data ), - 'url_target' => $this->get_url_target(), - 'link_setting' => $this->get_link_setting(), - 'dismissable' => $this->is_dismissable(), - 'snoozable' => $this->is_snoozable(), + 'task_id' => $this->get_task_id( $task_data ), + 'provider_id' => $this->get_provider_id(), + 'post_title' => $this->get_title_with_data( $task_data ), + 'description' => $this->get_description_with_data( $task_data ), + 'parent' => $this->get_parent(), + 'priority' => $this->get_priority(), + 'category' => $this->get_provider_category(), + 'points' => $this->get_points(), + 'date' => \gmdate( 'YW' ), + 'url' => $this->get_url_with_data( $task_data ), + 'url_target' => $this->get_url_target(), + 'link_setting' => $this->get_link_setting(), + 'dismissable' => $this->is_dismissable(), + 'snoozable' => $this->is_snoozable(), + 'external_link_url' => $this->get_external_link_url(), ]; } diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-archive-author.php b/classes/suggested-tasks/providers/integrations/yoast/class-archive-author.php index ce13c6994..30632e6e9 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-archive-author.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-archive-author.php @@ -35,6 +35,13 @@ class Archive_Author extends Yoast_Provider { */ protected const DATA_COLLECTOR_CLASS = Post_Author::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-author-archive'; + /** * Get the task URL. * @@ -59,11 +66,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Yoast SEO can disable the author archive when you have only one author, as it is the same as the homepage. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Yoast SEO can disable the author archive when you have only one author, as it is the same as the homepage.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-archive-date.php b/classes/suggested-tasks/providers/integrations/yoast/class-archive-date.php index e5f0eba52..cb1092add 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-archive-date.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-archive-date.php @@ -19,6 +19,13 @@ class Archive_Date extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-date-archive'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-date-archive'; + /** * Get the task URL. * @@ -43,11 +50,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Yoast SEO can disable the date archive, which is really only useful for news sites and blogs. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Yoast SEO can disable the date archive, which is really only useful for news sites and blogs.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-archive-format.php b/classes/suggested-tasks/providers/integrations/yoast/class-archive-format.php index 69bcc55a0..90b978cb0 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-archive-format.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-archive-format.php @@ -35,6 +35,13 @@ class Archive_Format extends Yoast_Provider { */ protected const DATA_COLLECTOR_CLASS = Archive_Format_Data_Collector::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-format-archive'; + /** * Get the task URL. * @@ -59,11 +66,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'WordPress creates an archive for each post format. This is not useful and can be disabled in the Yoast SEO settings. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'WordPress creates an archive for each post format. This is not useful and can be disabled in the Yoast SEO settings.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-cornerstone-workout.php b/classes/suggested-tasks/providers/integrations/yoast/class-cornerstone-workout.php index 060331598..7a26ecc0e 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-cornerstone-workout.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-cornerstone-workout.php @@ -30,6 +30,13 @@ class Cornerstone_Workout extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-cornerstone-workout'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/run-cornerstone-content-workout'; + /** * The task priority. * @@ -122,11 +129,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Improve your most important pages with Yoast SEO\'s Cornerstone Content Workout. %s.', 'progress-planner' ), - '' . \esc_html__( 'Learn more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Improve your most important pages with Yoast SEO\'s Cornerstone Content Workout.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-emoji-scripts.php b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-emoji-scripts.php index 4c1675d62..e6f293228 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-emoji-scripts.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-emoji-scripts.php @@ -19,6 +19,13 @@ class Crawl_Settings_Emoji_Scripts extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-crawl-settings-emoji-scripts'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-crawl-optimization-emoji-scripts'; + /** * Get the task URL. * @@ -43,11 +50,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Remove JavaScript used for converting emoji characters in older browsers. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Remove JavaScript used for converting emoji characters in older browsers.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-authors.php b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-authors.php index abcad1074..8689eadf6 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-authors.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-authors.php @@ -35,6 +35,13 @@ class Crawl_Settings_Feed_Authors extends Yoast_Provider { */ protected const DATA_COLLECTOR_CLASS = Post_Author::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-crawl-optimization-feed-authors'; + /** * Get the task URL. * @@ -59,11 +66,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Remove URLs which provide information about recent posts by specific authors. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Remove URLs which provide information about recent posts by specific authors.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-global-comments.php b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-global-comments.php index a4d512ad5..76d09ff5d 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-global-comments.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-crawl-settings-feed-global-comments.php @@ -19,6 +19,13 @@ class Crawl_Settings_Feed_Global_Comments extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-crawl-settings-feed-global-comments'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-crawl-optimization-feed-global-comments'; + /** * Get the task URL. * @@ -43,11 +50,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Remove URLs which provide an overview of recent comments on your site. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Remove URLs which provide an overview of recent comments on your site.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-fix-orphaned-content.php b/classes/suggested-tasks/providers/integrations/yoast/class-fix-orphaned-content.php index ca9d8602f..df7f4a909 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-fix-orphaned-content.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-fix-orphaned-content.php @@ -57,6 +57,13 @@ class Fix_Orphaned_Content extends Yoast_Provider { */ protected const DATA_COLLECTOR_CLASS = Yoast_Orphaned_Content::class; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/fix-orphaned-content'; + /** * Initialize the task provider. * @@ -87,11 +94,7 @@ protected function get_title_with_data( $task_data = [] ) { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Yoast SEO detected that this article has no links pointing to it. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Yoast SEO detected that this article has no links pointing to it.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-media-pages.php b/classes/suggested-tasks/providers/integrations/yoast/class-media-pages.php index c97bf383f..2172abbd9 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-media-pages.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-media-pages.php @@ -19,6 +19,13 @@ class Media_Pages extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-media-pages'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/yoast-media-pages'; + /** * Get the task URL. * @@ -43,11 +50,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Yoast SEO can disable the media / attachment pages, which are the pages that show the media files. You really don\'t need them, except when you are displaying photos or art on your site through them. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Yoast SEO can disable the media / attachment pages, which are the pages that show the media files. You really don\'t need them, except when you are displaying photos or art on your site through them.', 'progress-planner' ); } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-organization-logo.php b/classes/suggested-tasks/providers/integrations/yoast/class-organization-logo.php index 90c7e22f3..5dee018b4 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-organization-logo.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-organization-logo.php @@ -60,15 +60,19 @@ protected function get_title() { */ protected function get_description() { return $this->yoast_seo->helpers->options->get( 'company_or_person', 'company' ) !== 'person' - ? \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'To make Yoast SEO output the correct Schema, you need to set your organization logo in the Yoast SEO settings. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ) : \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'To make Yoast SEO output the correct Schema, you need to set your person logo in the Yoast SEO settings. %s.', 'progress-planner' ), - '' . \esc_html__( 'Read more', 'progress-planner' ) . '' - ); + ? \esc_html__( 'To make Yoast SEO output the correct Schema, you need to set your organization logo in the Yoast SEO settings.', 'progress-planner' ) + : \esc_html__( 'To make Yoast SEO output the correct Schema, you need to set your person logo in the Yoast SEO settings.', 'progress-planner' ); + } + + /** + * Get external link URL. + * + * @return string + */ + public function get_external_link_url() { + return $this->yoast_seo->helpers->options->get( 'company_or_person', 'company' ) !== 'person' + ? 'https://prpl.fyi/yoast-person-logo' + : 'https://prpl.fyi/yoast-organization-logo'; } /** diff --git a/classes/suggested-tasks/providers/integrations/yoast/class-orphaned-content-workout.php b/classes/suggested-tasks/providers/integrations/yoast/class-orphaned-content-workout.php index effdeeb57..80fbaff73 100644 --- a/classes/suggested-tasks/providers/integrations/yoast/class-orphaned-content-workout.php +++ b/classes/suggested-tasks/providers/integrations/yoast/class-orphaned-content-workout.php @@ -30,6 +30,13 @@ class Orphaned_Content_Workout extends Yoast_Provider { */ protected const PROVIDER_ID = 'yoast-orphaned-content-workout'; + /** + * The external link URL. + * + * @var string + */ + protected const EXTERNAL_LINK_URL = 'https://prpl.fyi/run-orphaned-content-workout'; + /** * The task priority. * @@ -125,11 +132,7 @@ protected function get_title() { * @return string */ protected function get_description() { - return \sprintf( - /* translators: %s: "Read more" link. */ - \esc_html__( 'Improve your internal linking structure with Yoast SEO\'s Orphaned Content Workout. %s.', 'progress-planner' ), - '' . \esc_html__( 'Lean more', 'progress-planner' ) . '' - ); + return \esc_html__( 'Improve your internal linking structure with Yoast SEO\'s Orphaned Content Workout.', 'progress-planner' ); } /** diff --git a/classes/wp-cli/class-task-command.php b/classes/wp-cli/class-task-command.php index f05b724cf..5bc3db4e8 100644 --- a/classes/wp-cli/class-task-command.php +++ b/classes/wp-cli/class-task-command.php @@ -325,6 +325,7 @@ public function create( $args, $assoc_args ) { $is_completed_callback = isset( $assoc_args['is_completed_callback'] ) ? $assoc_args['is_completed_callback'] : null; $dismissable = isset( $assoc_args['dismissable'] ) ? $assoc_args['dismissable'] : true; $snoozable = isset( $assoc_args['snoozable'] ) ? $assoc_args['snoozable'] : true; + $external_link_url = isset( $assoc_args['external_link_url'] ) ? $assoc_args['external_link_url'] : ''; if ( empty( $task_id ) || empty( $title ) ) { \WP_CLI::error( 'task_id and title are required.' ); // @phpstan-ignore-line @@ -344,6 +345,7 @@ public function create( $args, $assoc_args ) { 'dismissable' => $dismissable, 'snoozable' => $snoozable, 'is_completed_callback' => $is_completed_callback, + 'external_link_url' => $external_link_url, ] ); diff --git a/views/js-templates/suggested-task.html b/views/js-templates/suggested-task.html index 16c368a84..b5d3ba5f5 100644 --- a/views/js-templates/suggested-task.html +++ b/views/js-templates/suggested-task.html @@ -119,6 +119,12 @@

    <# } #> + <# if ( data.post.meta.prpl_external_link_url ) { #> + + {{ data.l10n.whyIsThisImportant }} + + <# } #> + <# if ( 'user' === categorySlug ) { #> -

    - -
    -
    - - - -

    get_name() ); ?>

    -
    - -
    + + + +

    get_name() ); ?>

    +
    +
    - -
    - -
    - +
    From 39c8e8f29dca185da002f72c1b72c0d518a267a0 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Tue, 26 Aug 2025 09:15:33 +0200 Subject: [PATCH 042/204] update font size and badge spacing --- assets/css/page-widgets/monthly-badges.css | 9 +++++---- assets/css/web-components/prpl-badge.css | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/css/page-widgets/monthly-badges.css b/assets/css/page-widgets/monthly-badges.css index d7cd9134c..35dd1e8e0 100644 --- a/assets/css/page-widgets/monthly-badges.css +++ b/assets/css/page-widgets/monthly-badges.css @@ -34,7 +34,7 @@ p { margin: 0; - font-size: var(--prpl-font-size-xs); + font-size: var(--prpl-font-size-small); text-align: center; line-height: 1.2; } @@ -105,6 +105,7 @@ } } +/* This is the badge streak widget. */ .prpl-widget-wrapper.prpl-badge-streak { display: flex; flex-direction: column; @@ -117,7 +118,7 @@ .progress-wrapper { display: grid; grid-template-columns: 1fr 1fr 1fr; - gap: calc(var(--prpl-gap) / 2); + gap: calc(var(--prpl-gap) / 4); padding: calc(var(--prpl-padding) / 2); border-radius: var(--prpl-border-radius-big); @@ -137,14 +138,14 @@ display: flex; flex-direction: column; align-items: center; - justify-content: space-between; + justify-content: flex-start; flex-wrap: wrap; min-width: 0; } p { margin: 0; - font-size: var(--prpl-font-size-xs); + font-size: var(--prpl-font-size-small); text-align: center; line-height: 1.2; } diff --git a/assets/css/web-components/prpl-badge.css b/assets/css/web-components/prpl-badge.css index 7bfe1e1cc..f654efcd6 100644 --- a/assets/css/web-components/prpl-badge.css +++ b/assets/css/web-components/prpl-badge.css @@ -3,7 +3,7 @@ grid-template-columns: 1fr; min-width: 0; - gap: 10px; + gap: 0.5rem; > * { align-self: center; @@ -58,7 +58,6 @@ prpl-badge { width: 100%; - margin-bottom: 1rem; /* This applies only to the monthly badges. */ .prpl-previous-month-badge-progress-bars-wrapper &, From d39ebeffcebf628b2807469f4eb29ad3ff63bf11 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 27 Aug 2025 12:16:42 +0300 Subject: [PATCH 043/204] WIP --- assets/js/grid-masonry.js | 184 ++++++++++++++---- .../widgets/class-badge-streak-content.php | 7 + .../class-badge-streak-maintenance.php | 7 + classes/admin/widgets/class-widget.php | 12 +- 4 files changed, 176 insertions(+), 34 deletions(-) diff --git a/assets/js/grid-masonry.js b/assets/js/grid-masonry.js index d510abf24..1bd6e965f 100644 --- a/assets/js/grid-masonry.js +++ b/assets/js/grid-masonry.js @@ -27,46 +27,164 @@ window.addEventListener( 'resize', prplTriggerGridResize ); // Fire event after all images are loaded. window.addEventListener( 'load', prplTriggerGridResize ); -// Listen for the event. +/** + * Update the grid masonry item. + * + * @param {HTMLElement} item The item to update. + */ +const prplUpdateGridMasonryItem = ( item ) => { + if ( ! item || item.classList.contains( 'in-popover' ) ) { + return; + } + const innerContainer = item.querySelector( '.widget-inner-container' ); + if ( ! innerContainer ) { + return; + } + const rowSpan = Math.ceil( + ( innerContainer.getBoundingClientRect().height + + parseInt( + window + .getComputedStyle( item ) + .getPropertyValue( 'padding-top' ) + ) + + parseInt( + window + .getComputedStyle( item ) + .getPropertyValue( 'padding-bottom' ) + ) ) / + parseInt( + window + .getComputedStyle( + document.querySelector( '.prpl-widgets-container' ) + ) + .getPropertyValue( 'grid-auto-rows' ) + ) + ); + item.style.gridRowEnd = 'span ' + ( rowSpan + 1 ); +}; + window.addEventListener( 'prpl/grid/resize', () => { document .querySelectorAll( '.prpl-widget-wrapper' ) .forEach( ( item ) => { - if ( ! item || item.classList.contains( 'in-popover' ) ) { - return; - } - const innerContainer = item.querySelector( - '.widget-inner-container' - ); - if ( ! innerContainer ) { - return; - } - const rowSpan = Math.ceil( - ( innerContainer.getBoundingClientRect().height + - parseInt( - window - .getComputedStyle( item ) - .getPropertyValue( 'padding-top' ) - ) + - parseInt( - window - .getComputedStyle( item ) - .getPropertyValue( 'padding-bottom' ) - ) ) / - parseInt( - window - .getComputedStyle( - document.querySelector( - '.prpl-widgets-container' - ) - ) - .getPropertyValue( 'grid-auto-rows' ) - ) - ); - item.style.gridRowEnd = 'span ' + ( rowSpan + 1 ); + prplPopulateOriginalGridOrderData( item ); + prplPopulateGridColumnsX( item ); + } ); + + document + .querySelectorAll( '.prpl-widget-wrapper' ) + .forEach( ( item ) => { + prplPopulateGridColumnsXItem( item ); + prplMaybeForceItemToLastColumn( item ); + } ); + + document + .querySelectorAll( '.prpl-widget-wrapper' ) + .forEach( ( item ) => { + prplUpdateGridMasonryItem( item ); } ); }, false ); + +/** + * Populate the original grid order data. Adds a data attribute to the item + * that contains the original order of the item. + * + * @param {HTMLElement} item The item to populate. + */ +const prplPopulateOriginalGridOrderData = ( item ) => { + if ( + ! item || + item.classList.contains( 'in-popover' ) || + ! item.querySelector( '.widget-inner-container' ) + ) { + return; + } + + if ( 'undefined' === typeof window.prplGridOrderLastItem ) { + window.prplGridOrderLastItem = 0; + } else { + window.prplGridOrderLastItem++; + } + + if ( ! item.dataset.order ) { + item.dataset.order = window.prplGridOrderLastItem; + } +}; + +/** + * Populate the grid columns X data in window.prplGridColumnsX. + * + * @param {HTMLElement} item The item to populate. + */ +const prplPopulateGridColumnsX = ( item ) => { + if ( + ! item || + item.classList.contains( 'in-popover' ) || + ! item.querySelector( '.widget-inner-container' ) + ) { + return; + } + + window.prplGridColumnsX = window.prplGridColumnsX || []; + + // Get the item's X position. + const itemX = parseInt( item.getBoundingClientRect().left ); + + // Check if the item is already in the array. + if ( ! window.prplGridColumnsX.includes( itemX ) ) { + window.prplGridColumnsX.push( itemX ); + } + + // Sort the array. + window.prplGridColumnsX.sort( ( a, b ) => a - b ); +}; + +/** + * Populate the grid columns X data for an item. Adds a data attribute to the + * item that contains the column index of the item in the array. + * + * @param {HTMLElement} item The item to populate. + */ +const prplPopulateGridColumnsXItem = ( item ) => { + if ( + ! item || + item.classList.contains( 'in-popover' ) || + ! item.querySelector( '.widget-inner-container' ) + ) { + return; + } + + const innerContainer = item.querySelector( '.widget-inner-container' ); + if ( ! innerContainer ) { + return; + } + + // Get the item's X position. + const itemX = parseInt( item.getBoundingClientRect().left ); + + // Get the index of the item in the array. + item.dataset.gridColumn = window.prplGridColumnsX.indexOf( itemX ); +}; + +/** + * Force item to be in the last column. + * + * @param {HTMLElement} item The item to force. + */ +const prplMaybeForceItemToLastColumn = ( item ) => { + if ( + ! item || + item.classList.contains( 'in-popover' ) || + ! item.querySelector( '.widget-inner-container' ) + ) { + return; + } + const forceLastColumn = item.dataset.forceLastColumn; + if ( '1' === forceLastColumn ) { + item.style.gridColumnStart = window.prplGridColumnsX.length; + } +}; diff --git a/classes/admin/widgets/class-badge-streak-content.php b/classes/admin/widgets/class-badge-streak-content.php index 0e906b252..fe5d1ed10 100644 --- a/classes/admin/widgets/class-badge-streak-content.php +++ b/classes/admin/widgets/class-badge-streak-content.php @@ -19,6 +19,13 @@ final class Badge_Streak_Content extends Badge_Streak { */ protected $id = 'badge-streak-content'; + /** + * Whether the widget should be forced to the last column. + * + * @var bool + */ + protected $force_last_column = true; + /** * Enqueue styles. * diff --git a/classes/admin/widgets/class-badge-streak-maintenance.php b/classes/admin/widgets/class-badge-streak-maintenance.php index a59c77163..31c518a3e 100644 --- a/classes/admin/widgets/class-badge-streak-maintenance.php +++ b/classes/admin/widgets/class-badge-streak-maintenance.php @@ -19,6 +19,13 @@ final class Badge_Streak_Maintenance extends Badge_Streak { */ protected $id = 'badge-streak-maintenance'; + /** + * Whether the widget should be forced to the last column. + * + * @var bool + */ + protected $force_last_column = true; + /** * Enqueue styles. * diff --git a/classes/admin/widgets/class-widget.php b/classes/admin/widgets/class-widget.php index 54fb31bd1..9dac376c9 100644 --- a/classes/admin/widgets/class-widget.php +++ b/classes/admin/widgets/class-widget.php @@ -23,6 +23,13 @@ abstract class Widget { */ protected $width = 1; + /** + * Whether the widget should be forced to the last column. + * + * @var bool + */ + protected $force_last_column = false; + /** * Constructor. */ @@ -80,7 +87,10 @@ public function render() { $this->enqueue_styles(); $this->enqueue_scripts(); ?> -
    +
    the_view( "page-widgets/{$this->id}.php" ); ?>
    From 604f918fff5976df007ca4083d3f935bd17cdd25 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 27 Aug 2025 11:36:50 +0200 Subject: [PATCH 044/204] admin pages background tweaks --- assets/css/admin.css | 17 ++++++++-- assets/css/settings-page.css | 47 +++++++++++++++++++--------- views/admin-page-settings.php | 50 +++++++++++++++--------------- views/page-settings/license.php | 2 +- views/page-settings/pages.php | 36 ++++++++++----------- views/page-settings/post-types.php | 2 +- views/page-settings/settings.php | 2 +- 7 files changed, 91 insertions(+), 65 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 507a52af4..2add826b1 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -50,14 +50,23 @@ --prpl-font-size-6xl: 4.5rem; /* 72px */ } +/*------------------------------------*\ + Progress Planner dashboard page. +\*------------------------------------*/ +/* stylelint-disable-next-line selector-class-pattern */ +body.toplevel_page_progress-planner { + + #wpwrap { + background-color: #f9fafb; + } +} + /*------------------------------------*\ Styles for the container of the page. \*------------------------------------*/ .prpl-wrap { - background: #fff; - border: 1px solid var(--prpl-color-gray-2); border-radius: var(--prpl-border-radius); - padding: var(--prpl-settings-page-gap) calc(var(--prpl-padding) * 2); + padding: var(--prpl-settings-page-gap) var(--prpl-padding); max-width: var(--prpl-container-max-width); color: var(--prpl-color-text); font-size: var(--prpl-font-size-base); @@ -190,6 +199,7 @@ button.prpl-info-icon { padding: 0.4em; /* color: var(--prpl-color-gray-2); */ + background-color: #fff; border: 1px solid var(--prpl-color-gray-2); border-radius: var(--prpl-border-radius); @@ -234,6 +244,7 @@ button.prpl-info-icon { Generic styles for individual widgets. \*------------------------------------*/ .prpl-widget-wrapper { + background-color: #fff; border: 1px solid var(--prpl-color-gray-2); border-radius: var(--prpl-border-radius); padding: var(--prpl-padding); diff --git a/assets/css/settings-page.css b/assets/css/settings-page.css index 638834814..b9d3ddf3f 100644 --- a/assets/css/settings-page.css +++ b/assets/css/settings-page.css @@ -2,7 +2,7 @@ .progress-planner_page_progress-planner-settings { #wpwrap { - background: #fff !important; + background-color: #f9fafb; } ul#adminmenu { @@ -21,22 +21,9 @@ h1 { display: flex; align-items: center; - gap: 0.5rem; - background: var(--prpl-background-orange); padding: 1.2rem; - border-radius: 0.5rem; margin-bottom: 2rem; - .icon { - width: 1.25em; - height: 1.25em; - color: var(--prpl-color-accent-orange); - - svg path { - fill: currentcolor; - } - } - span { font-weight: 600; } @@ -50,11 +37,27 @@ } } + .prpl-settings-form-wrap { + background-color: #fff; + + border: 1px solid var(--prpl-color-gray-2); + border-radius: var(--prpl-border-radius); + padding: var(--prpl-padding); + box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.07), -2px 0 6px rgba(0, 0, 0, 0.07); + } + + .prpl-settings-section-wrapper { + border: 1px solid var(--prpl-color-gray-2); + border-radius: var(--prpl-border-radius); + padding: var(--prpl-padding); + flex-grow: 1; + } + .prpl-settings-section-title { display: flex; align-items: center; gap: 0.5rem; - background: var(--prpl-background-purple); + background: var(--prpl-background-orange); padding: 1.2rem; border-radius: 0.5rem; margin-bottom: var(--prpl-settings-page-gap); @@ -170,6 +173,20 @@ } } + .prpl-column-pages { + margin-bottom: var(--prpl-gap); + + .prpl-settings-section-title { + + .icon { + + path { + fill: var(--prpl-color-accent-orange); + } + } + } + } + .prpl-pages-list { display: flex; flex-wrap: wrap; diff --git a/views/admin-page-settings.php b/views/admin-page-settings.php index ab6c23d09..a42d11dc4 100644 --- a/views/admin-page-settings.php +++ b/views/admin-page-settings.php @@ -23,33 +23,33 @@ ?>
    -

    - - the_asset( 'images/icon_settings.svg' ); ?> - - - - -

    -
    - the_view( 'page-settings/pages.php' ); ?> +
    +

    + + + +

    -
    - the_view( 'page-settings/post-types.php' ); ?> - the_view( 'page-settings/settings.php' ); ?> - the_view( 'page-settings/license.php' ); ?> -
    + + the_view( 'page-settings/pages.php' ); ?> + +
    + the_view( 'page-settings/post-types.php' ); ?> + the_view( 'page-settings/settings.php' ); ?> + the_view( 'page-settings/license.php' ); ?> +
    - + - - + + +
  • diff --git a/views/page-settings/license.php b/views/page-settings/license.php index 0012f44c8..2a2193b01 100644 --- a/views/page-settings/license.php +++ b/views/page-settings/license.php @@ -16,7 +16,7 @@ ?>
    -
    +

    the_asset( 'images/icon_key.svg' ); ?> diff --git a/views/page-settings/pages.php b/views/page-settings/pages.php index dee0d2f65..990f84b17 100644 --- a/views/page-settings/pages.php +++ b/views/page-settings/pages.php @@ -12,24 +12,22 @@ ?>
    -
    -

    - - the_asset( 'images/icon_pages.svg' ); ?> - - - - -

    -

    - -

    -
    - get_admin__page_settings()->get_settings() as $prpl_setting ) { - \progress_planner()->the_view( "setting/{$prpl_setting['type']}.php", [ 'prpl_setting' => $prpl_setting ] ); - } - ?> -
    +

    + + the_asset( 'images/icon_pages.svg' ); ?> + + + + +

    +

    + +

    +
    + get_admin__page_settings()->get_settings() as $prpl_setting ) { + \progress_planner()->the_view( "setting/{$prpl_setting['type']}.php", [ 'prpl_setting' => $prpl_setting ] ); + } + ?>
    diff --git a/views/page-settings/post-types.php b/views/page-settings/post-types.php index e76b79d18..458d26d60 100644 --- a/views/page-settings/post-types.php +++ b/views/page-settings/post-types.php @@ -23,7 +23,7 @@ ?>
    > -
    +

    the_asset( 'images/icon_copywriting.svg' ); ?> diff --git a/views/page-settings/settings.php b/views/page-settings/settings.php index e80038127..00e84cfa9 100644 --- a/views/page-settings/settings.php +++ b/views/page-settings/settings.php @@ -14,7 +14,7 @@ ?>