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
#3566: add support for switching active sidebar panel via brick; automatically switch when using Page Editor #3567
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3567 +/- ##
==========================================
- Coverage 45.27% 45.16% -0.11%
==========================================
Files 790 791 +1
Lines 23215 23293 +78
Branches 4819 4843 +24
==========================================
+ Hits 10510 10521 +11
- Misses 11823 11878 +55
- Partials 882 894 +12
Continue to review full report at Codecov.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export function getHTMLElement(): JQuery { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to a utility file because it's not specific to the sidebar
@@ -133,6 +130,8 @@ export function showSidebar(callbacks = extensionCallbacks): string { | |||
|
|||
let nonce = container?.dataset?.nonce; | |||
|
|||
const isShowing = Boolean(nonce); | |||
|
|||
if (!nonce) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
if (!nonce) { | |
if (!isShowing) { |
@@ -151,15 +150,57 @@ export function showSidebar(callbacks = extensionCallbacks): string { | |||
} | |||
} | |||
|
|||
if (!isEmpty(activateOptions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why activateOptions
can't be null
by default? Then the check will be simpler:
if (!isEmpty(activateOptions)) { | |
if (activateOptions != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why activateOptions can't be null by default? Then the check will be simpler
I think keeping track of null vs. non-null is generally more error-prone. If there's a valid "empty"/default value I like to use that instead
); | ||
}); | ||
} | ||
|
||
// TODO: Drop `nonce` if not used by the caller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this TODO still relevant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this TODO still relevant?
Not sure, didn't want to spend the time double-checking all the call sites. It's not hurting anything to leave the value in
@@ -29,7 +29,7 @@ import { | |||
hideSidebarForm, | |||
PANEL_HIDING_EVENT, | |||
showSidebarForm, | |||
} from "@/contentScript/sidebar"; | |||
} from "@/contentScript/sidebarController"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
What does this PR do?
forcePanel
andpanelHeading
options to the Show Sidebar brickConsiderations/Discussion
Reviewer Notes
Tasks Remaining
Out of scope
Checklist