Skip to content

Commit

Permalink
Open sidebar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zahardev committed Oct 16, 2024
1 parent 2c04d20 commit afb02a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/admin/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ textarea#episode_embed_code {
.ssp-post-publish__btn a:hover {
background: #eff0f0; }

#ssp-episode-meta-sidebar\:ssp-sidebar .interface-complementary-area-header__title {
#ssp-episode-meta-sidebar\:ssp-episode-meta-sidebar .interface-complementary-area-header__title {
font-size: 12px; }

.ssp-episode-meta-sidebar .ssp-accordion, .ssp-sidebar-panel .ssp-accordion {
Expand Down
2 changes: 1 addition & 1 deletion assets/admin/scss/_episode-meta-sidebar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ssp-episode-meta-sidebar\:ssp-sidebar {
#ssp-episode-meta-sidebar\:ssp-episode-meta-sidebar {
.interface-complementary-area-header__title {
font-size: 12px;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/EpisodeMetaSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const EpisodeMetaSidebar = () => {

return (
<PluginSidebar
name="ssp-sidebar"
name="ssp-episode-meta-sidebar"
title={ __('Seriously Simple Podcasting') }
className="ssp-episode-meta-sidebar"
icon={ <img src={ SSPIcon } className="ssp-open" alt="SSP Icon"/> }
Expand Down
14 changes: 8 additions & 6 deletions src/components/SSPSidebarPanel.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PluginPostStatusInfo } from '@wordpress/edit-post';
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import classnames from 'classnames';
import { useState } from '@wordpress/element';
import { Button } from '@wordpress/components';
import FileIsUploadedSvg from '../img/file-is-uploaded.svg';
import FileNotUploadedSvg from '../img/file-not-uploaded.svg';
import { useDispatch, useSelect } from '@wordpress/data';

const SSPSidebarPanel = () => {
const editor = useSelect(( select ) => select('core/editor'));
Expand All @@ -17,6 +17,12 @@ const SSPSidebarPanel = () => {
const postMeta = editor.getEditedPostAttribute('meta');
const fileIsUploaded = !! postMeta.audio_file;

const { openGeneralSidebar } = useDispatch('core/edit-post');

const openSSPSidebar = () => {
openGeneralSidebar('ssp-episode-meta-sidebar/ssp-episode-meta-sidebar'); // Sidebar slug
};

return (
<PluginPostStatusInfo>
<div className={ 'ssp-sidebar-panel' }>
Expand Down Expand Up @@ -54,11 +60,7 @@ const SSPSidebarPanel = () => {

<Button
className={ 'ssp-open-meta-btn' }
onClick={ () => {
document.querySelectorAll('.ssp-open').forEach(function ( element ) {
element.click();
});
} }
onClick={ openSSPSidebar }
>{ __('Manage your Episode', 'seriously-simple-podcasting') }
</Button>
</div>
Expand Down

0 comments on commit afb02a8

Please sign in to comment.