fix(lab): Be explicit about closing navigation on gist updates
This commit is contained in:
parent
c3b9c07236
commit
4d59cf59be
2 changed files with 12 additions and 12 deletions
|
@ -8,54 +8,54 @@ const View = props => {
|
|||
{
|
||||
name: 'measurements',
|
||||
title: t('measurements'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'measurements')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'measurements', true)
|
||||
},
|
||||
{
|
||||
name: 'draft',
|
||||
title: t('draftPattern', { pattern: props.pattern.config.name }),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'draft')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'draft', true)
|
||||
},
|
||||
{
|
||||
name: 'test',
|
||||
title: t('testPattern', { pattern: props.pattern.config.name }),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'test')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'test', true)
|
||||
},
|
||||
{
|
||||
name: 'printingLayout',
|
||||
title: t('layoutThing', { thing: props.pattern.config.name })
|
||||
+ ': ' + t('forPrinting'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'printingLayout')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'printingLayout', true)
|
||||
},
|
||||
{
|
||||
name: 'cuttingLayout',
|
||||
title: t('layoutThing', { thing: props.pattern.config.name })
|
||||
+ ': ' + t('forCutting'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'cuttingLayout')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'cuttingLayout', true)
|
||||
},
|
||||
{
|
||||
name: 'export',
|
||||
title: t('exportThing', { thing: props.pattern.config.name }),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'export')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'export', true)
|
||||
},
|
||||
{
|
||||
name: 'events',
|
||||
title: t('events'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'events')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'events', true)
|
||||
},
|
||||
{
|
||||
name: 'yaml',
|
||||
title: t('YAML'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'yaml')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'yaml', true)
|
||||
},
|
||||
{
|
||||
name: 'json',
|
||||
title: t('JSON'),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'json')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'json', true)
|
||||
},
|
||||
{
|
||||
name: 'edit',
|
||||
title: t('editThing', { thing: 'YAML' }),
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'edit')
|
||||
onClick: () => props.updateGist(['_state', 'view'], 'edit', true)
|
||||
},
|
||||
{
|
||||
name: 'clear',
|
||||
|
|
|
@ -82,12 +82,12 @@ const WorkbenchWrapper = ({ app, pattern, preload=false, from=false, layout=fals
|
|||
}, [preload, from])
|
||||
|
||||
// Helper methods to manage the gist state
|
||||
const updateGist = (path, content) => {
|
||||
const updateGist = (path, content, closeNav=false) => {
|
||||
const newGist = {...gist}
|
||||
set(newGist, path, content)
|
||||
setGist(newGist)
|
||||
// Force close of menu on mobile if it is open
|
||||
if (app.primaryMenu) app.setPrimaryMenu(false)
|
||||
if (closeNav && app.primaryMenu) app.setPrimaryMenu(false)
|
||||
}
|
||||
const unsetGist = (path) => {
|
||||
const newGist = {...gist}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue