make sendToDrive hidable (#493)

Make "sendToDrive" button from share menu hidable.
This commit is contained in:
Vinschni 2023-04-15 22:22:56 +02:00 committed by GitHub
parent 5959db9584
commit bcb5916434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -260,7 +260,7 @@ GRIST_DEFAULT_PRODUCT | if set, this controls enabled features and limits of ne
GRIST_DEFAULT_LOCALE | Locale to use as fallback when Grist cannot honour the browser locale. GRIST_DEFAULT_LOCALE | Locale to use as fallback when Grist cannot honour the browser locale.
GRIST_DOMAIN | in hosted Grist, Grist is served from subdomains of this domain. Defaults to "getgrist.com". GRIST_DOMAIN | in hosted Grist, Grist is served from subdomains of this domain. Defaults to "getgrist.com".
GRIST_EXPERIMENTAL_PLUGINS | enables experimental plugins GRIST_EXPERIMENTAL_PLUGINS | enables experimental plugins
GRIST_HIDE_UI_ELEMENTS | comma-separated list of parts of the UI to hide. Allowed names of parts: `helpCenter,billing,templates,multiSite,multiAccounts` GRIST_HIDE_UI_ELEMENTS | comma-separated list of parts of the UI to hide. Allowed names of parts: `helpCenter,billing,templates,multiSite,multiAccounts,sendToDrive`
GRIST_HOME_INCLUDE_STATIC | if set, home server also serves static resources GRIST_HOME_INCLUDE_STATIC | if set, home server also serves static resources
GRIST_HOST | hostname to use when listening on a port. GRIST_HOST | hostname to use when listening on a port.
GRIST_ID_PREFIX | for subdomains of form o-*, expect or produce o-${GRIST_ID_PREFIX}*. GRIST_ID_PREFIX | for subdomains of form o-*, expect or produce o-${GRIST_ID_PREFIX}*.

View File

@ -11,7 +11,7 @@ import {primaryButton} from 'app/client/ui2018/buttons';
import {mediaXSmall, testId, theme} from 'app/client/ui2018/cssVars'; import {mediaXSmall, testId, theme} from 'app/client/ui2018/cssVars';
import {icon} from 'app/client/ui2018/icons'; import {icon} from 'app/client/ui2018/icons';
import {menu, menuAnnotate, menuDivider, menuIcon, menuItem, menuItemLink, menuText} from 'app/client/ui2018/menus'; import {menu, menuAnnotate, menuDivider, menuIcon, menuItem, menuItemLink, menuText} from 'app/client/ui2018/menus';
import {buildUrlId, parseUrlId} from 'app/common/gristUrls'; import {buildUrlId, parseUrlId, shouldHideUiElement} from 'app/common/gristUrls';
import * as roles from 'app/common/roles'; import * as roles from 'app/common/roles';
import {Document} from 'app/common/UserAPI'; import {Document} from 'app/common/UserAPI';
import {dom, DomContents, styled} from 'grainjs'; import {dom, DomContents, styled} from 'grainjs';
@ -244,8 +244,8 @@ function menuExports(doc: Document, pageModel: DocPageModel) {
href: pageModel.appModel.api.getDocAPI(doc.id).getDownloadXlsxUrl(), href: pageModel.appModel.api.getDocAPI(doc.id).getDownloadXlsxUrl(),
target: '_blank', download: '' target: '_blank', download: ''
}, menuIcon('Download'), t("Export XLSX"), testId('tb-share-option')), }, menuIcon('Download'), t("Export XLSX"), testId('tb-share-option')),
menuItem(() => sendToDrive(doc, pageModel), (shouldHideUiElement("sendToDrive") ? null : menuItem(() => sendToDrive(doc, pageModel),
menuIcon('Download'), t("Send to Google Drive"), testId('tb-share-option')), menuIcon('Download'), t("Send to Google Drive"), testId('tb-share-option'))),
]; ];
} }

View File

@ -614,7 +614,8 @@ export interface GristLoadConfig {
userLocale?: string; userLocale?: string;
} }
export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts"); export const HideableUiElements = StringUnion("helpCenter", "billing", "templates", "multiSite", "multiAccounts",
"sendToDrive");
export type IHideableUiElement = typeof HideableUiElements.type; export type IHideableUiElement = typeof HideableUiElements.type;
export function shouldHideUiElement(elem: IHideableUiElement): boolean { export function shouldHideUiElement(elem: IHideableUiElement): boolean {