Skip to content

Commit 9d2bb49

Browse files
committed
UX changes in main nav bar for browse as user;
Toggle new type added - HIDE_LABELS;
1 parent ad8684c commit 9d2bb49

File tree

2 files changed

+17
-29
lines changed

2 files changed

+17
-29
lines changed

src/components/BrowserMenu/BrowserMenu.scss

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,6 @@
108108
background: none;
109109
}
110110
}
111-
112-
&.active {
113-
background: $blue;
114-
115-
&:hover {
116-
background: white;
117-
color: $blue;
118-
}
119-
}
120-
121-
&.greenActive {
122-
background: $green;
123-
124-
&:hover {
125-
background: white;
126-
color: $blue;
127-
}
128-
}
129111
}
130112

131113
.separator {

src/dashboard/Data/Browser/BrowserToolbar.react.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,23 @@ let BrowserToolbar = ({
246246
className={classNameForEditors}
247247
blacklistedFilters={onAddRow ? [] : ['unique']}
248248
/>
249+
<div className={styles.toolbarSeparator} />
250+
<LoginDialog
251+
ref={loginDialogRef}
252+
currentUser={currentUser}
253+
login={login}
254+
logout={logout}
255+
/>
256+
<BrowserMenu
257+
setCurrent={setCurrent}
258+
title={currentUser ? "Browsing" : "Browse"}
259+
icon="users-solid"
260+
active={!!currentUser}
261+
>
262+
<MenuItem text={currentUser ? 'Switch User' : 'As User'} onClick={showLogin} />
263+
{currentUser ? <MenuItem text={<span>Use Master Key <Toggle type={Toggle.Types.HIDE_LABELS} value={useMasterKey} onChange={toggleMasterKeyUsage} switchNoMargin={true} additionalStyles={{ display: 'inline', lineHeight: 0, margin: 0, paddingLeft: 5 }} /></span>} onClick={toggleMasterKeyUsage} /> : <noscript />}
264+
{currentUser ? <MenuItem text={<span>Stop browsing (<b>{currentUser.get('username')}</b>)</span>} onClick={logout} /> : <noscript />}
265+
</BrowserMenu>
249266
{onAddRow && <div className={styles.toolbarSeparator} />}
250267
{perms && enableSecurityDialog ? (
251268
<SecurityDialog
@@ -275,26 +292,15 @@ let BrowserToolbar = ({
275292
icon='locked-solid'
276293
onEditPermissions={onEditPermissions}
277294
/>
278-
<LoginDialog
279-
ref={loginDialogRef}
280-
currentUser={currentUser}
281-
login={login}
282-
logout={logout}
283-
/>
284295
{enableSecurityDialog ? (
285296
<BrowserMenu
286297
setCurrent={setCurrent}
287298
title="Security"
288299
icon="locked-solid"
289300
disabled={!!relation || !!isUnique}
290-
active={!!currentUser}
291301
>
292302
<MenuItem text={'Class Level Permissions'} onClick={showCLP} />
293303
<MenuItem text={'Protected Fields'} onClick={showProtected} />
294-
<Separator />
295-
<MenuItem text={currentUser ? 'Switch Parse.User' : 'Browse as Parse.User'} onClick={showLogin} active={!!currentUser} />
296-
{currentUser ? <MenuItem text={useMasterKey ? <span>Browsing with <b>Master Key</b></span> : <span>Browse with <s>Master Key</s></span>} onClick={toggleMasterKeyUsage} active={!!currentUser} greenActive={useMasterKey} /> : <noscript />}
297-
{currentUser ? <MenuItem text={<span>Logout (<b>{currentUser.get('username')}</b>)</span>} onClick={logout} active={!!currentUser} /> : <noscript />}
298304
</BrowserMenu>
299305
) : (
300306
<noscript />

0 commit comments

Comments
 (0)