(core) Revealing hidden pages with visible children.

Summary:
When a page is hidden, all its nested pages are shown as children of
a different page that happens to be before (as in pagePos) that page.

This diff shows those pages as CENSORED.

Test Plan: Updated

Reviewers: alexmojaki

Reviewed By: alexmojaki

Subscribers: alexmojaki

Differential Revision: https://phab.getgrist.com/D3670
This commit is contained in:
Jarosław Sadziński
2022-10-28 10:04:59 +02:00
parent b263d83122
commit 7c9cb9843e
9 changed files with 295 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ import { cssEditorInput } from "app/client/ui/HomeLeftPane";
import { itemHeader, itemHeaderWrapper, treeViewContainer } from "app/client/ui/TreeViewComponentCss";
import { theme } from "app/client/ui2018/cssVars";
import { icon } from "app/client/ui2018/icons";
import { hoverTooltip } from 'app/client/ui/tooltips';
import { menu, menuItem, menuText } from "app/client/ui2018/menus";
import { dom, domComputed, DomElementArg, makeTestId, observable, Observable, styled } from "grainjs";
@@ -106,6 +107,20 @@ export function buildPageDom(name: Observable<string>, actions: PageActions, ...
));
}
export function buildCensoredPage() {
return cssPageItem(
cssPageInitial(
testId('initial'),
dom.text('C'),
),
cssCensoredPageName(
dom.text('CENSORED'),
testId('label'),
),
hoverTooltip('This page is censored due to access rules.'),
);
}
const cssPageItem = styled('a', `
display: flex;
flex-direction: row;
@@ -143,6 +158,10 @@ const cssPageName = styled('div', `
}
`);
const cssCensoredPageName = styled(cssPageName, `
color: ${theme.disabledPageFg};
`);
function onHoverSupport(yesNo: boolean) {
// On desktop, we show page menu button on hover over page link. This isn't usable on mobile,
// and interferes with clicks on iOS; so instead we show the button when the page is selected.