mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Tweak navbar, breadcrumbs, and sign-in buttons
Summary: The changes are intended to smooth over some sharp edges when a signed-out user is using Grist (particularly while on the templates site). Test Plan: Browser tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3957
This commit is contained in:
@@ -24,6 +24,8 @@ import {Computed, dom, DomElementArg, makeTestId, MultiHolder, Observable, style
|
||||
const t = makeT('TopBar');
|
||||
|
||||
export function createTopBarHome(appModel: AppModel) {
|
||||
const isAnonymous = !appModel.currentValidUser;
|
||||
|
||||
return [
|
||||
cssFlexSpace(),
|
||||
appModel.supportGristNudge.showButton(),
|
||||
@@ -40,7 +42,7 @@ export function createTopBarHome(appModel: AppModel) {
|
||||
),
|
||||
|
||||
buildLanguageMenu(appModel),
|
||||
buildNotifyMenuButton(appModel.notifier, appModel),
|
||||
isAnonymous ? null : buildNotifyMenuButton(appModel.notifier, appModel),
|
||||
dom('div', dom.create(AccountWidget, appModel)),
|
||||
];
|
||||
}
|
||||
@@ -78,6 +80,8 @@ export function createTopBarDoc(owner: MultiHolder, appModel: AppModel, pageMode
|
||||
return !use(undoStack.isDisabled);
|
||||
});
|
||||
|
||||
const isAnonymous = !pageModel.appModel.currentValidUser;
|
||||
|
||||
return [
|
||||
// TODO Before gristDoc is loaded, we could show doc-name without the page. For now, we delay
|
||||
// showing of breadcrumbs until gristDoc is loaded.
|
||||
@@ -96,6 +100,8 @@ export function createTopBarDoc(owner: MultiHolder, appModel: AppModel, pageMode
|
||||
isFiddle: Computed.create(owner, (use) => use(pageModel.isPrefork)),
|
||||
isSnapshot: pageModel.isSnapshot,
|
||||
isPublic: Computed.create(owner, doc, (use, _doc) => Boolean(_doc && _doc.public)),
|
||||
isTemplate: pageModel.isTemplate,
|
||||
isAnonymous,
|
||||
})
|
||||
)
|
||||
),
|
||||
@@ -121,23 +127,21 @@ export function createTopBarDoc(owner: MultiHolder, appModel: AppModel, pageMode
|
||||
const model = use(searchModelObs);
|
||||
return model && use(moduleObs)?.searchBar(model, makeTestId('test-tb-search-'));
|
||||
}),
|
||||
|
||||
buildShareMenuButton(pageModel),
|
||||
|
||||
dom.maybe(use =>
|
||||
(
|
||||
use(pageModel.gristDoc)
|
||||
&& !use(use(pageModel.gristDoc)!.isReadonly)
|
||||
&& use(COMMENTS())
|
||||
dom.maybe(use => !(use(pageModel.isTemplate) && isAnonymous), () => [
|
||||
buildShareMenuButton(pageModel),
|
||||
dom.maybe(use =>
|
||||
(
|
||||
use(pageModel.gristDoc)
|
||||
&& !use(use(pageModel.gristDoc)!.isReadonly)
|
||||
&& use(COMMENTS())
|
||||
),
|
||||
() => buildShowDiscussionButton(pageModel)),
|
||||
dom.update(
|
||||
buildNotifyMenuButton(appModel.notifier, appModel),
|
||||
cssHideForNarrowScreen.cls(''),
|
||||
),
|
||||
() => buildShowDiscussionButton(pageModel)),
|
||||
|
||||
dom.update(
|
||||
buildNotifyMenuButton(appModel.notifier, appModel),
|
||||
cssHideForNarrowScreen.cls(''),
|
||||
),
|
||||
|
||||
dom('div', dom.create(AccountWidget, appModel, pageModel))
|
||||
]),
|
||||
dom('div', dom.create(AccountWidget, appModel, pageModel)),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user