Skip to content

Commit

Permalink
Add back shopper impersonation banner (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwan-ep authored Feb 21, 2020
1 parent 2975240 commit 158c9fa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elasticpath/store-components",
"version": "1.1.58",
"version": "1.1.59",
"main": "build/cjs/index",
"main:src": "src/index",
"types": "build/types/components/src/index",
Expand Down
9 changes: 9 additions & 0 deletions src/components/src/AppHeader/appheader.main.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
fill: @mainTextColor;
}

.impersonation-notification {
height: 100%;
background-color: #8b1e24;
text-align: center;
color: @mainNavigationColor;
padding: 2px 0;
font-weight: 700;
}

.main-container {
position: relative;
min-height: 60px;
Expand Down
11 changes: 10 additions & 1 deletion src/components/src/AppHeader/appheader.main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ class AppHeaderMain extends Component<AppHeaderMainProps, AppHeaderMainState> {
appModalLoginLinks,
} = this.props;
const availability = Boolean(cartData);
const impersonating = localStorage.getItem(`${Config.cortexApi.scope}_oAuthImpersonationToken`);
const userName = localStorage.getItem(`${Config.cortexApi.scope}_oAuthUserName`) || localStorage.getItem(`${Config.cortexApi.scope}_oAuthUserId`);

const Cart = () => {
const { count, name }: any = useCountState();
Expand All @@ -278,7 +280,14 @@ class AppHeaderMain extends Component<AppHeaderMainProps, AppHeaderMainState> {

return [
<header key="app-header" className="app-header">

{
impersonating ? (
<div className="impersonation-notification">
{intl.get('shopper-impersonation-message')}
{userName}
</div>
) : ''
}
<div className={`main-container ${isInStandaloneMode ? 'in-standalone' : ''}`}>

<div className="main-container-col">
Expand Down

0 comments on commit 158c9fa

Please sign in to comment.