Skip to content

Commit

Permalink
Add new notice about latest release (#2798)
Browse files Browse the repository at this point in the history
Co-authored-by: gikaragia <53191348+gikaragia@users.noreply.github.com>
  • Loading branch information
yscik and gikaragia committed Apr 17, 2024
1 parent 1fcc71f commit f51a22e
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 36 deletions.
3 changes: 0 additions & 3 deletions .psalm/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@
<InvalidReturnStatement>
<code><![CDATA[new WP_Error( 'error', $e->getMessage() )]]></code>
</InvalidReturnStatement>
<ParadoxicalCondition>
<code><![CDATA[! defined( 'ABSPATH' )]]></code>
</ParadoxicalCondition>
</file>
<file src="includes/class-wp-job-manager-install.php">
<UndefinedPropertyFetch>
Expand Down
56 changes: 55 additions & 1 deletion assets/css/admin-notices.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ $notice-success: #43af99;
aspect-ratio: 1;
}

&__label {
font-weight: 600;
background: var(--wpjm-brand-color-shade-4);
color: var(--wpjm-brand-color-primary);
border-radius: 40px;
padding: 6px 12px;
display: inline-block;
text-transform: uppercase;
align-self: flex-start;
font-size: 12px;
}

&__heading {
margin: 0 0 8px 0;
font-weight: 700;
font-size: 16px;
letter-spacing: -0.36px;
Expand All @@ -62,12 +73,26 @@ $notice-success: #43af99;
&__message {
flex: 1 1 min-content;
align-self: center;
display: flex;
flex-direction: column;
gap: 10px;
min-width: min(100%, 400px);
line-height: 1.5;

&, p {
font-size: 14px;
}

ul {
margin: 0;
padding-left: 10px;
list-style-type: '';
}
li {
padding-left: 10px;
}


}

&__actions {
Expand Down Expand Up @@ -108,6 +133,35 @@ $notice-success: #43af99;
}
}

&--landing {
padding: 40px 40px;
align-items: flex-start;
flex-direction: row;
justify-content: space-between;
}
&--landing &__top {
flex-direction: column;
gap: 20px;
align-items: flex-start;
}

&--landing &__message {
gap: 20px;
}

&--landing &__heading {
font-size: 40px;
letter-spacing: -0.8px;
}

&--landing &__image {
max-width: 50%;
}
&--landing &__image img {
max-width: 100%;
max-height: 400px;
}

}

.wpjm-addon-update-notice-info {
Expand Down
98 changes: 98 additions & 0 deletions includes/admin/class-release-notice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php
/**
* File containing the class \WP_Job_Manager\Admin\Release_Notice.
*
* @package wp-job-manager
*/

namespace WP_Job_Manager\Admin;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Admin notice about changes and new features introduced in the latest release.
* Update this class for each release to highlight new features or changes.
*/
class Release_Notice {
public const NOTICE_ID = 'release_notice_2_3_0';

/**
* Set up notice.
*/
public static function init() {
add_filter( 'wpjm_admin_notices', [ __CLASS__, 'add_release_notice' ] );
add_action( 'job_manager_action_enable_stats', [ self::class, 'enable_feature' ] );
}

/**
* Enable the highlighted feature.
*
* @return void
*/
public static function enable_feature() {
\WP_Job_Manager_Settings::instance()->set_setting( \WP_Job_Manager\Stats::OPTION_ENABLE_STATS, '1' );
}

/**
* Add a release notice for the 2.3.0 release.
*
* @param array $notices
*
* @return array
*/
public static function add_release_notice( $notices ) {

// Make sure to update the version number in the notice ID when changing this notice for a new release.
$action_url = \WP_Job_Manager_Admin_Notices::get_action_url( 'enable_stats', self::NOTICE_ID );
$notices[ self::NOTICE_ID ] = [
'type' => 'site-wide',
'label' => 'New',
'heading' => 'Job Statistics',
'message' => '<div>' . __(
'
<p>Collect analytics about site visitors for each job listing. Display the detailed statistics in the refreshed jobs dashboard.</p>
<ul>
<li>Tracks page views and unique visitors, search impressions and apply button clicks.</li>
<li>Adds a new overlay to the employer dashboard with aggregated statistics and a daily breakdown chart.</li>
<li>Integrates with Job Alerts, Applications, and Bookmarks add-ons.</li>
<li>GDPR-compliant, with no personal user information collected.</li>
</ul>
',
'wp-job-manager'
) . '</div>',
'actions' => [
[
'label' => __( 'Enable', 'wp-job-manager' ),
'url' => $action_url,
'primary' => true,
],
[
'label' => __( 'Dismiss', 'wp-job-manager' ),
'url' => \WP_Job_Manager_Admin_Notices::get_dismiss_url( self::NOTICE_ID ),
'primary' => false,
],
[
'label' => __( 'See what\'s new in 2.3', 'wp-job-manager' ),
'url' => 'https://wpjobmanager.com/2024/03/27/new-in-2-3-job-statistics/',
'class' => 'is-link',
],
],
'icon' => false,
'level' => 'landing',
'image' => 'https://wpjobmanager.com/wp-content/uploads/2024/03/jm-230-release.png',
'dismissible' => false,
'extra_details' => '',
'conditions' => [
[
'type' => 'screens',
'screens' => [ 'edit-job_listing' ],
],
],
];

return $notices;
}

}
Loading

0 comments on commit f51a22e

Please sign in to comment.