-
Notifications
You must be signed in to change notification settings - Fork 22
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
#9222 Add policy for hiding the sidebar logo #9224
Conversation
Playwright test resultsDetails Open report ↗︎ Flaky testschrome › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod Skipped testschrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9224 +/- ##
==========================================
+ Coverage 74.24% 74.82% +0.57%
==========================================
Files 1332 1367 +35
Lines 40817 42197 +1380
Branches 7634 7893 +259
==========================================
+ Hits 30306 31574 +1268
- Misses 10511 10623 +112 ☔ View full report in Codecov by Sentry. |
…b.com/pixiebrix/pixiebrix-extension into feature/9222_hide_sidebar_logo_policy merge origin
{showSidebarLogo && ( | ||
// `mx-auto` centers the logo | ||
<div className="mx-auto"> | ||
<div className="mx-auto"> |
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.
Always include a placeholder for the image so that it still fills the space when hidden; before the extension buttons (e.g. the cog button) were left-aligned instead of staying in place
src/hooks/useTheme.ts
Outdated
const { data: cachedTheme, isLoading: isCachedThemeLoading } = | ||
useAsyncExternalStore(themeStorageSubscribe, themeStorage.get); | ||
|
||
const { data: hideSidebarLogo, isLoading: isManagedStorageLoading } = |
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: instead of using useAsyncState with readManagedStorageByKey, we might consider using useManagedStorageState (and standardizing that hook return value use theAsyncState shape)
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.
TIL we have a useManagedStorageState hook. Since we're releasing tomorrow, let's merge this as-is.
@mnholtz before you move on to something else, can you open up a follow-up PR to leverage useManageStorageState, including the enhancement to return AsyncState?
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.
Ticket here: #9227
@Pashaminkovsky @mnholtz reminder that this PR will require our public documentation to be updated |
@twschiller to update the docs would we add a new section here: https://docs.pixiebrix.com/enterprise-it-setup/browser-extension-installation-and-configuration/browser-extension-configuration-policy/extension-authentication-configuration |
That sub-page is for the extension configuration. It might be the parent page: https://docs.pixiebrix.com/enterprise-it-setup/browser-extension-installation-and-configuration/browser-extension-configuration-policy Although currently we just point people to the JSON Schema there: The custom branding page might be a place to mention it and link to the extension configuration page: https://docs.pixiebrix.com/enterprise-it-setup/custom-branding-and-themes. (The custom branding page is also slightly out of date, e.g., it doesn't mention changing the toolbar icon logo) |
* Hides the logo in the PixieBrix sidebar, overriding the team theme. | ||
* @since 2.1.4 | ||
*/ | ||
hideSidebarLogo?: boolean; |
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.
Should this be:
hideSidebarLogo?: boolean; | |
hideSidebarLogo: boolean; |
Since the schema says it defaults to false? Or does that default not actually do anything?
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.
That's a great question. Upon manual inspection the default
value doesn't seem to do anything. I also wasn't able to find mention of this value in the docs anywhere https://developer.chrome.com/docs/extensions/reference/manifest/storage
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.
That's a great question. Upon manual inspection the default value doesn't seem to do anything. I also wasn't able to find mention of this value in the docs anywhere
That's correct - the default does not flow through to Chrome. In general, default
in JSON Schemas don't have runtime implications. It's a hint to tools. See: https://json-schema.org/understanding-json-schema/reference/annotations#annotations
The default keyword specifies a default value. This value is not used to fill in missing values during the validation process. Non-validation tools such as documentation generators or form generators may use this value to give hints to users about how to use a value. However, default is typically used to express that if a value is missing, then the value is semantically the same as if the value was present with the default value. The value of default should validate against the schema in which it resides, but that isn't required.
@Pashaminkovsky FYI, for documentation purposes the new policy name is |
src/hooks/useTheme.test.ts
Outdated
expect(activateTheme).toHaveBeenCalledOnce(); | ||
}); | ||
|
||
it.each([{ policyValue: true }, { policyValue: false }])( |
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.
For completeness, we should update this to be something like:
[
{ policyValue: true, themeValue: true, expectedValue: true },
{ policyValue: true, themeValue: false, expectedValue: true },
{ policyValue: false, themeValue: true, expectedValue: false },
{ policyValue: false, themeValue: false, expectedValue: false },
{ policyValue: undefined, themeValue: true, expectedValue: true },
{ policyValue: undefined, themeValue: false, expectedValue: false }
]
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.
LGTM. See comment about improving the tests
When the PR is merged, the first loom link found on this PR will be posted to |
What does this PR do?
showSidebarLogo
policy is set in managed storageDemo
https://www.loom.com/share/032d1216eb8d4175a46c15debd8dc00c