-
Notifications
You must be signed in to change notification settings - Fork 602
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
Add a better admin bar #1664
Add a better admin bar #1664
Conversation
Autotagging @bigcommerce/storefront-team @davidchin |
7193408
to
512b2d6
Compare
} | ||
|
||
// Set admin cookie if appropriate | ||
if (window.URLSearchParams && window.URL && (new URL(document.location)).searchParams.get('ctk')) { |
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.
I'm simply matching on the query param used when we launch the storefront from the CP. While this would be easy to forge, it doesn't really reveal anything particularly sensitive - every button you can click loads the CP, which is behind the merchant login.
@@ -1 +1 @@ | |||
<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><title>Logo B</title><path d="M17.647 12.125h-3.323c-.11 0-.197.087-.197.194v2.327c0 .107.087.193.197.193h3.323c.95 0 1.542-.524 1.542-1.357 0-.795-.594-1.358-1.543-1.358zm-2.62-2.423h3.233c2.51 0 3.988 1.57 3.988 3.296 0 1.35-.915 2.345-1.885 2.78-.155.07-.15.283.01.346 1.128.443 1.94 1.623 1.94 3 0 1.96-1.305 3.512-3.837 3.512h-6.96c-.11 0-.197-.087-.197-.194v-9.03L.237 24.49c-.51.508-.148 1.378.57 1.378h24.254c.446 0 .808-.362.808-.808V.81c0-.72-.87-1.08-1.38-.572L15.03 9.702zm-.703 7.562c-.11 0-.197.087-.197.194v2.56c0 .106.087.193.197.193h3.44c1.05 0 1.682-.542 1.682-1.472 0-.815-.593-1.474-1.68-1.474h-3.442z" fill="#FFF" fill-rule="evenodd"/></svg> | |||
<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><title>Logo B</title><path d="M17.647 12.125h-3.323c-.11 0-.197.087-.197.194v2.327c0 .107.087.193.197.193h3.323c.95 0 1.542-.524 1.542-1.357 0-.795-.594-1.358-1.543-1.358zm-2.62-2.423h3.233c2.51 0 3.988 1.57 3.988 3.296 0 1.35-.915 2.345-1.885 2.78-.155.07-.15.283.01.346 1.128.443 1.94 1.623 1.94 3 0 1.96-1.305 3.512-3.837 3.512h-6.96c-.11 0-.197-.087-.197-.194v-9.03L.237 24.49c-.51.508-.148 1.378.57 1.378h24.254c.446 0 .808-.362.808-.808V.81c0-.72-.87-1.08-1.38-.572L15.03 9.702zm-.703 7.562c-.11 0-.197.087-.197.194v2.56c0 .106.087.193.197.193h3.44c1.05 0 1.682-.542 1.682-1.472 0-.815-.593-1.474-1.68-1.474h-3.442z" fill="#000" fill-rule="evenodd"/></svg> |
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.
Just changing the fill color to match new design.
512b2d6
to
5a95374
Compare
class: 'adminBar', | ||
}); | ||
|
||
$element.html(`<div class="adminBar-logo"> |
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.
I wonder if we can move the markup into a separate file 🍹
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.
It's probably easier to remove later like this?
assets/js/theme/global.js
Outdated
@@ -26,7 +29,9 @@ export default class Global extends PageManager { | |||
menu(); | |||
mobileMenuToggle(); | |||
privacyCookieNotification(); | |||
maintenanceMode(this.context.maintenanceMode); | |||
if (themeSettings['show-admin-bar']) { | |||
adminBar(storeHash, maintenanceModeSettings, JSON.parse(adminBarLanguage), productId, categoryId); |
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.
Instead of defining all these params would it make sense to pass the entire context along with the page type so we can build contextual links for entities based on page type.
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.
I thought about that, but I didn't want to inject too much as whatever is injected will show up in HTML; IDs seem non-sensitive. And I'm trying to make this easy to remove before too long so we can remove admin bar from the theme entirely.
d9150ee
to
22a887f
Compare
22a887f
to
2e87e6f
Compare
2e87e6f
to
9baf183
Compare
9baf183
to
996bee4
Compare
996bee4
to
a5008a0
Compare
a5008a0
to
77a9ea0
Compare
What?
Adds a persistent admin bar for store control panel users to make it easier to launch actions from the storefront.
Handles 3 different states:
prelaunch
modemaintenance
mode...with appropriate contextual actions for each.
Can be hidden (per-user), and can also be disabled via a theme setting.
Gracefully degrades at various responsive breakpoints.
Tickets / Documentation
Screenshots (if appropriate)
small
breakpoint (completely hidden)medium
breakpoint (condensed)large
breakpoint (everything)A page that doesn't support a contextual action, only opening in Page Builder:
Maintenance mode w/ mouseover tooltip:
Live mode:
ping @bigcommerce/merc-team @bigcommerce/storefront-team