Skip to content
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

Merged
merged 12 commits into from
Oct 3, 2024

Conversation

mnholtz
Copy link
Collaborator

@mnholtz mnholtz commented Oct 2, 2024

What does this PR do?

Demo

https://www.loom.com/share/032d1216eb8d4175a46c15debd8dc00c

Copy link

github-actions bot commented Oct 2, 2024

Playwright test results

passed  127 passed
flaky  7 flaky
skipped  4 skipped

Details

report  Open report ↗︎
stats  138 tests across 45 suites
duration  36 minutes, 31 seconds
commit  cb2355f
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
msedge › tests/pageEditor/addStarterBrick.spec.ts › Add starter brick to mod
chrome › tests/pageEditor/brickActions.spec.ts › brick actions panel behavior
msedge › tests/pageEditor/brickConfiguration.spec.ts › brick configuration
chrome › tests/pageEditor/copyMod.spec.ts › run a copied mod with a built-in integration
msedge › tests/pageEditor/copyMod.spec.ts › run a copied mod with a built-in integration
msedge › tests/pageEditor/logsPane.spec.ts › can view error logs

Skipped tests

chrome › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
msedge › tests/regressions/doNotCloseSidebarOnPageEditorSave.spec.ts › #8104: Do not automatically close the sidebar when saving in the Page Editor
chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.82%. Comparing base (8318d74) to head (cb2355f).
Report is 334 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@mnholtz mnholtz marked this pull request as ready for review October 2, 2024 22:00
{showSidebarLogo && (
// `mx-auto` centers the logo
<div className="mx-auto">
<div className="mx-auto">
Copy link
Collaborator Author

@mnholtz mnholtz Oct 2, 2024

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

@twschiller twschiller added the enhancement New feature or request label Oct 3, 2024
const { data: cachedTheme, isLoading: isCachedThemeLoading } =
useAsyncExternalStore(themeStorageSubscribe, themeStorage.get);

const { data: hideSidebarLogo, isLoading: isManagedStorageLoading } =
Copy link
Contributor

@twschiller twschiller Oct 3, 2024

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)

Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticket here: #9227

@twschiller
Copy link
Contributor

@Pashaminkovsky @mnholtz reminder that this PR will require our public documentation to be updated

@Pashaminkovsky
Copy link
Collaborator

@twschiller
Copy link
Contributor

twschiller commented Oct 3, 2024

@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 Or did you have other docs in mind?

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:

image

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be:

Suggested change
hideSidebarLogo?: boolean;
hideSidebarLogo: boolean;

Since the schema says it defaults to false? Or does that default not actually do anything?

Copy link
Collaborator Author

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

Copy link
Contributor

@twschiller twschiller Oct 3, 2024

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.

@mnholtz
Copy link
Collaborator Author

mnholtz commented Oct 3, 2024

@Pashaminkovsky FYI, for documentation purposes the new policy name is showSidebarLogo and will override the team theme if set in both cases of being true or false

expect(activateTheme).toHaveBeenCalledOnce();
});

it.each([{ policyValue: true }, { policyValue: false }])(
Copy link
Collaborator

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 }
]

Copy link
Collaborator

@grahamlangford grahamlangford left a 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

Copy link

github-actions bot commented Oct 3, 2024

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

@mnholtz mnholtz enabled auto-merge (squash) October 3, 2024 19:38
@mnholtz mnholtz merged commit 41b948a into main Oct 3, 2024
20 checks passed
@mnholtz mnholtz deleted the feature/9222_hide_sidebar_logo_policy branch October 3, 2024 20:17
@mnholtz mnholtz added this to the 2.1.3 milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants