mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Hide workspace in breadcrumbs if doc is unsaved
Summary: Hides the workspace in the breadcrumbs menu if the doc is unsaved and is not a fork. In practice, this should usually be when an anonymous user creates a new document. Test Plan: Browser tests. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2967
This commit is contained in:
parent
4a23b964ed
commit
07bf250592
@ -47,6 +47,7 @@ export function createTopBarDoc(owner: MultiHolder, appModel: AppModel, pageMode
|
||||
isPageNameReadOnly: (use) => use(gristDoc.isReadonly) || typeof use(gristDoc.activeViewId) !== 'number',
|
||||
isDocNameReadOnly: (use) => use(gristDoc.isReadonly) || use(pageModel.isFork),
|
||||
isFork: pageModel.isFork,
|
||||
isBareFork: pageModel.isBareFork,
|
||||
isRecoveryMode: pageModel.isRecoveryMode,
|
||||
userOverride: pageModel.userOverride,
|
||||
isFiddle: Computed.create(owner, (use) => use(pageModel.isPrefork)),
|
||||
|
@ -106,6 +106,7 @@ export function docBreadcrumbs(
|
||||
isDocNameReadOnly?: BindableValue<boolean>,
|
||||
isPageNameReadOnly?: BindableValue<boolean>,
|
||||
isFork: Observable<boolean>,
|
||||
isBareFork: Observable<boolean>,
|
||||
isFiddle: Observable<boolean>,
|
||||
isRecoveryMode: Observable<boolean>,
|
||||
userOverride: Observable<UserOverride|null>,
|
||||
@ -114,25 +115,31 @@ export function docBreadcrumbs(
|
||||
}
|
||||
): Element {
|
||||
return cssBreadcrumbs(
|
||||
cssIcon('Home',
|
||||
dom.domComputed<[boolean, PartialWorkspace|null]>(
|
||||
(use) => [use(options.isBareFork), use(workspace)],
|
||||
([isBareFork, ws]) => {
|
||||
if (isBareFork || !ws) { return null; }
|
||||
return [
|
||||
cssIcon('Home',
|
||||
testId('bc-home'),
|
||||
cssHideForNarrowScreen.cls('')),
|
||||
dom.maybe(workspace, _workspace => [
|
||||
cssWorkspaceName(
|
||||
urlState().setLinkUrl({ws: _workspace.id}),
|
||||
dom.text(_workspace.name),
|
||||
testId('bc-workspace'),
|
||||
cssHideForNarrowScreen.cls('')
|
||||
),
|
||||
cssWorkspaceNarrowScreen(
|
||||
'Expand',
|
||||
urlState().setLinkUrl({ws: _workspace.id}),
|
||||
testId('bc-workspace-ns')
|
||||
),
|
||||
separator(' / ',
|
||||
testId('bc-separator'),
|
||||
cssHideForNarrowScreen.cls(''))
|
||||
]),
|
||||
cssWorkspaceName(
|
||||
urlState().setLinkUrl({ws: ws.id}),
|
||||
dom.text(ws.name),
|
||||
testId('bc-workspace'),
|
||||
cssHideForNarrowScreen.cls('')
|
||||
),
|
||||
cssWorkspaceNarrowScreen(
|
||||
'Expand',
|
||||
urlState().setLinkUrl({ws: ws.id}),
|
||||
testId('bc-workspace-ns')
|
||||
),
|
||||
separator(' / ',
|
||||
testId('bc-separator'),
|
||||
cssHideForNarrowScreen.cls(''))
|
||||
];
|
||||
}
|
||||
),
|
||||
editableLabel(
|
||||
docName, options.docNameSave, testId('bc-doc'), cssEditableName.cls(''),
|
||||
dom.boolAttr('disabled', options.isDocNameReadOnly || false),
|
||||
|
Loading…
Reference in New Issue
Block a user