added Discussions URL

This commit is contained in:
Nikita 2023-08-06 00:16:39 +03:00
parent fd171a3738
commit 94d7d976ad
4 changed files with 24 additions and 6 deletions

View file

@ -80,6 +80,13 @@ class Mind_Admin {
'manage_options', 'manage_options',
'admin.php?page=mind&sub_page=settings' 'admin.php?page=mind&sub_page=settings'
); );
add_submenu_page(
'mind',
'',
esc_html__( 'Discussions', 'mind' ),
'manage_options',
'https://github.com/nk-crew/mind/discussions'
);
} }
/** /**

View file

@ -85,18 +85,23 @@ function PageWrapper() {
Object.keys(pages).forEach((k) => { Object.keys(pages).forEach((k) => {
resultTabs.push( resultTabs.push(
<li key={k}> <li key={k}>
{/* eslint-disable-next-line react/button-has-type */} <a
<button href={(pages[k] && pages[k].href) || '#'}
target={pages[k] && pages[k].href ? '_blank' : null}
rel="noreferrer"
className={clsx( className={clsx(
'mind-admin-tabs-button', 'mind-admin-tabs-button',
activePage === k && 'mind-admin-tabs-button-active' activePage === k && 'mind-admin-tabs-button-active'
)} )}
onClick={() => { onClick={(e) => {
setActivePage(k); if (pages[k] && !pages[k].href) {
e.preventDefault();
setActivePage(k);
}
}} }}
> >
{pages[k].label} {pages[k].label}
</button> </a>
</li> </li>
); );
}); });

View file

@ -18,4 +18,8 @@ export default {
label: __('Settings', 'mind'), label: __('Settings', 'mind'),
block: PageSettings, block: PageSettings,
}, },
discussions: {
label: __('Discussions', 'mind'),
href: 'https://github.com/nk-crew/mind/discussions',
},
}; };

View file

@ -89,7 +89,7 @@
margin: 0; margin: 0;
} }
button { a {
position: relative; position: relative;
padding: 10px; padding: 10px;
margin: 0 2px; margin: 0 2px;
@ -98,6 +98,8 @@
background: none; background: none;
border: none; border: none;
outline: none; outline: none;
text-decoration: none;
color: inherit;
&:hover, &:hover,
&:focus { &:focus {