Skip to content

Commit 0ed0311

Browse files
authored
[APP-2070] UI bug fixes (#423)
* fix: button padding * fix: notifications logic was not working properly * update: removed unused async call * update: moved review stars to review module
1 parent f7ff9ef commit 0ed0311

File tree

4 files changed

+37
-60
lines changed

4 files changed

+37
-60
lines changed

modules/core/module.php

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,12 @@ public function enqueue_scripts() : void {
6161
);
6262
}
6363

64-
/**
65-
* Add review link to plugin row meta
66-
*
67-
* @param array $links
68-
* @param string $file
69-
* @return array
70-
*
71-
*/
72-
public function add_plugin_row_meta( $links, $file ) {
73-
74-
if ( ! defined( 'EA11Y_BASE' ) || EA11Y_BASE !== $file ) {
75-
return $links;
76-
}
77-
78-
$links[] = '<a class="wp-ea11y-review"
79-
href="https://wordpress.org/support/plugin/pojo-accessibility/reviews/#new-post"
80-
target="_blank" rel="noopener noreferrer"
81-
title="' . esc_attr__( 'Review our plugin', 'pojo-accessibility' )
82-
. '">
83-
<span>★</span><span>★</span><span>★</span><span>★</span><span>★</span>
84-
</a>';
85-
86-
echo '<style>
87-
.wp-ea11y-review{ display: inline-flex;flex-direction: row-reverse;}
88-
.wp-ea11y-review span{ color:#888}
89-
.wp-ea11y-review span:hover{color:#ffa400}
90-
.wp-ea11y-review span:hover~span{color:#ffa400}
91-
</style>';
92-
93-
return $links;
94-
}
95-
9664
/**
9765
* Module constructor.
9866
*/
9967
public function __construct() {
10068
$this->register_components();
10169
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
10270
add_filter( 'plugin_action_links', [ $this, 'add_plugin_links' ], 10, 2 );
103-
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
10471
}
10572
}

modules/reviews/assets/src/components/dismiss-button.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const DismissButton = ({ variant = 'icon' }) => {
3535
flexDirection="row"
3636
gap={1}
3737
p={currentPage === 'feedback' ? 2 : 0}
38-
pt={currentPage === 'feedback' ? 0 : 2}
3938
width="100%"
4039
justifyContent="end"
4140
>

modules/reviews/assets/src/hooks/use-settings.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ const SettingsProvider = ({ children }) => {
8787
});
8888
}
8989

90-
if (!response?.success && parseInt(rating) < 4) {
90+
if (!response?.success && parseInt(ratingToSubmit) < 4) {
9191
/**
9292
* Show success message if the feedback was already submitted.
9393
*/
94-
await successNotification(
94+
successNotification(
9595
__('Feedback already submitted', 'pojo-accessibility'),
9696
);
97-
} else if (response?.success && parseInt(rating) < 4) {
98-
await successNotification(
97+
} else if (response?.success && parseInt(ratingToSubmit) < 4) {
98+
successNotification(
9999
__('Thank you for your feedback!', 'pojo-accessibility'),
100100
);
101101
}
@@ -139,26 +139,4 @@ const SettingsProvider = ({ children }) => {
139139
);
140140
};
141141

142-
export const useNotifications = () => {
143-
const { setNotificationMessage, setNotificationType, setShowNotification } =
144-
useContext(SettingsContext);
145-
146-
const error = (message) => {
147-
setNotificationMessage(message);
148-
setNotificationType('error');
149-
setShowNotification(true);
150-
};
151-
152-
const success = (message) => {
153-
setNotificationMessage(message);
154-
setNotificationType('success');
155-
setShowNotification(true);
156-
};
157-
158-
return {
159-
success,
160-
error,
161-
};
162-
};
163-
164142
export default SettingsProvider;

modules/reviews/module.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,43 @@ public function maybe_show_review_popup() {
208208
return false;
209209
}
210210

211+
/**
212+
* Add review link to plugin row meta
213+
*
214+
* @param array $links
215+
* @param string $file
216+
* @return array
217+
*
218+
*/
219+
public function add_plugin_row_meta( $links, $file ) {
220+
221+
if ( ! defined( 'EA11Y_BASE' ) || EA11Y_BASE !== $file ) {
222+
return $links;
223+
}
224+
225+
$links[] = '<a class="wp-ea11y-review"
226+
href="https://wordpress.org/support/plugin/pojo-accessibility/reviews/#new-post"
227+
target="_blank" rel="noopener noreferrer"
228+
title="' . esc_attr__( 'Review our plugin', 'pojo-accessibility' )
229+
. '">
230+
<span>★</span><span>★</span><span>★</span><span>★</span><span>★</span>
231+
</a>';
232+
233+
echo '<style>
234+
.wp-ea11y-review{ display: inline-flex;flex-direction: row-reverse;}
235+
.wp-ea11y-review span{ color:#888}
236+
.wp-ea11y-review span:hover{color:#ffa400}
237+
.wp-ea11y-review span:hover~span{color:#ffa400}
238+
</style>';
239+
240+
return $links;
241+
}
242+
211243
public function __construct() {
212244
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
213245
add_action( 'admin_init', [ $this, 'register_base_data' ] );
214246
add_action( 'rest_api_init', [ $this, 'register_settings' ] );
247+
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
215248

216249
$this->register_routes();
217250
}

0 commit comments

Comments
 (0)