Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate headway and canny #1427

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,78 @@ span.pro-icon:hover .wpuf-pro-field-tooltip {
position: absolute;
right: 5px;
}
.headway-header {
display: flex;
justify-content: space-between;
}
.headway-header ul {
display: flex;
justify-content: flex-end;
align-items: center;
margin: 10px 0;
}
.headway-header ul li.headway-icon {
background: #eea6d0;
margin-right: 1rem;
border-radius: 20px;
width: 10px;
height: 10px;
position: relative;
margin-top: 2px;
}
.headway-header ul li.headway-icon:hover {
background: #ee62b4;
}
.headway-header ul li.headway-icon span#HW_badge_cont {
position: absolute;
top: -6px;
left: -6px;
}
.headway-header ul li a {
font-size: 1rem;
text-decoration: none;
}
.headway-header ul li a:hover {
text-decoration: underline;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon {
display: flex;
justify-content: space-between;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon .flex-end,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon .flex-end,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon .flex-end {
display: flex;
align-items: center;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon .flex-end .HW_badge.HW_softHidden,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon .flex-end .HW_badge.HW_softHidden,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon .flex-end .HW_badge.HW_softHidden {
background: #eea6d0 !important;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon .flex-end .flex-end .headway-icon:hover .HW_badge.HW_softHidden,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon .flex-end .flex-end .headway-icon:hover .HW_badge.HW_softHidden,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon .flex-end .flex-end .headway-icon:hover .HW_badge.HW_softHidden {
background: #ee62b4 !important;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon .flex-end a.canny-link,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon .flex-end a.canny-link,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon .flex-end a.canny-link {
font-size: 1rem;
text-decoration: none;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon .flex-end a.canny-link:hover,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon .flex-end a.canny-link:hover,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon .flex-end a.canny-link:hover {
text-decoration: underline;
}
.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon #HW_frame_cont,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon #HW_frame_cont,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon #HW_frame_cont {
top: 78px !important;
}
@media only screen and (max-width: 1399px) {
a.wpuf-button.button-upgrade-to-pro {
padding: 10px;
Expand Down
76 changes: 76 additions & 0 deletions assets/less/admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,82 @@ span.pro-icon:hover .wpuf-pro-field-tooltip {
right: 5px;
}

.headway-header {
display: flex;
justify-content: space-between;

ul {
display: flex;
justify-content: flex-end;
align-items: center;
margin: 10px 0;

li {
&.headway-icon {
background: #eea6d0;
margin-right: 1rem;
border-radius: 20px;
width: 10px;
height: 10px;
position: relative;
margin-top: 2px;

&:hover {
background: #ee62b4;
}

span#HW_badge_cont {
position: absolute;
top: -6px;
left: -6px;
}
}

a {
font-size: 1rem;
text-decoration: none;

&:hover {
text-decoration: underline;
}
}
}
}
}

.user-frontend_page_wpuf-post-forms .wrap h2.with-headway-icon,
.user-frontend_page_wpuf-profile-forms .wrap h2.with-headway-icon,
.user-frontend_page_wpuf-settings .wrap h2.with-headway-icon {
display: flex;
justify-content: space-between;

.flex-end {
display: flex;
align-items: center;

.HW_badge.HW_softHidden {
background: #eea6d0 !important;
}

.flex-end .headway-icon:hover .HW_badge.HW_softHidden {
background: #ee62b4 !important;
}

a.canny-link {
font-size: 1rem;
text-decoration: none;

&:hover {
text-decoration: underline;
}
}
}

#HW_frame_cont {
top: 78px !important;
}
}

@media only screen and (max-width: 1399px) {
a.wpuf-button.button-upgrade-to-pro {
padding: 10px;
Expand Down
48 changes: 46 additions & 2 deletions includes/Admin/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function admin_menu() {
* @return void
*/
public function wpuf_post_forms_page() {
add_action( 'admin_footer', [ $this, 'load_headway_badge' ] );
// phpcs:ignore WordPress.Security.NonceVerification
$action = ! empty( $_GET['action'] ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : null;
$add_new_page_url = admin_url( 'admin.php?page=wpuf-post-forms&action=add-new' );
Expand All @@ -109,6 +110,38 @@ public function wpuf_post_forms_page() {
}
}

/**
* Load the Headway badge
*
* @since WPUF_SINCE
*
* @return void
*/
public function load_headway_badge() {
?>
<script>
const HW_config = {
selector: '.headway-icon',
account: 'JPqPQy',
callbacks: {
onWidgetReady: function ( widget ) {
if ( widget.getUnseenCount() === 0 ) {
document.querySelector('.headway-header ul li.headway-icon span#HW_badge_cont.HW_visible')
.style = 'opacity: 0';
}
},
onHideWidget: function(){
document.querySelector('.headway-header ul li.headway-icon span#HW_badge_cont.HW_visible')
.style = 'opacity: 0';
}
}
};

</script>
<script async src="//cdn.headwayapp.co/widget.js"></script>
<?php
}

/**
* The action to run just after the menu is created.
*
Expand Down Expand Up @@ -273,6 +306,8 @@ public function enqueue_settings_page_scripts() {
wp_enqueue_script( 'wpuf-admin' );
wp_enqueue_script( 'wpuf-subscriptions' );
wp_enqueue_script( 'wpuf-settings' );

add_action( 'admin_footer', [ $this, 'load_headway_badge' ] );
}

/**
Expand All @@ -283,8 +318,17 @@ public function enqueue_settings_page_scripts() {
public function plugin_settings_page() {
?>
<div class="wrap">

<h2 style="margin-bottom: 15px;"><?php esc_html_e( 'Settings', 'wp-user-frontend' ); ?></h2>
<h2 class="with-headway-icon">
<span class="title-area">
<?php esc_html_e( 'Settings', 'wp-user-frontend' ); ?>
</span>
<span class="flex-end">
<span class="headway-icon"></span>
<a class="canny-link" target="_blank" href="<?php echo esc_url( 'https://wpuf.canny.io/ideas' ); ?>">💡 <?php esc_html_e(
'Submit Ideas', 'wp-user-frontend'
); ?></a>
</span>
</h2>
<div class="wpuf-settings-wrap">
<?php
settings_errors();
Expand Down
26 changes: 15 additions & 11 deletions includes/Admin/views/post-forms-list-table-view.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<div class="wrap">
<h2>
<?php
esc_html_e( 'Post Forms', 'wp-user-frontend' );

if ( current_user_can( wpuf_admin_role() ) ) {
?>
<a href="<?php echo esc_url( $add_new_page_url ); ?>" id="new-wpuf-post-form" class="page-title-action add-form"><?php esc_html_e( 'Add Form', 'wp-user-frontend' ); ?></a>
<h2 class="with-headway-icon">
<span class="title-area">
<?php
}
?>
esc_html_e( 'Post Forms', 'wp-user-frontend' );

if ( current_user_can( wpuf_admin_role() ) ) {
?>
<a href="<?php echo esc_url( $add_new_page_url ); ?>" id="new-wpuf-post-form" class="page-title-action add-form"><?php esc_html_e( 'Add Form', 'wp-user-frontend' ); ?></a>
<?php
}
?>
</span>
<span class="flex-end">
<span class="headway-icon"></span>
<a class="canny-link" target="_blank" href="<?php echo esc_url( 'https://wpuf.canny.io/ideas' ); ?>">💡 <?php esc_html_e( 'Submit Ideas', 'wp-user-frontend' ); ?></a>
</span>
</h2>


<div class="list-table-wrap wpuf-post-form-wrap">
<div class="list-table-inner wpuf-post-form-wrap-inner">

<form method="get">
<input type="hidden" name="page" value="wpuf-post-forms">
<?php
Expand Down
Loading