Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/client/components/AceEditorCompletions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ace, {Ace} from 'ace-builds';
import {ISuggestionWithValue} from 'app/common/ActiveDocAPI';
import {commonUrls} from 'app/common/gristUrls';

export interface ICompletionOptions {
getSuggestions(prefix: string): Promise<ISuggestionWithValue[]>;
Expand Down Expand Up @@ -271,7 +270,7 @@ function retokenizeAceCompleterRow(rowData: AceSuggestion, tokens: Ace.Token[]):

// Include into new tokens a special token that will be hidden, but include the link URL. On
// click, we find it to know what URL to open.
const href = `${commonUrls.functions}/#` +
const href = `${window.gristConfig.commonUrls.functions}/#` +
rowData.funcname.slice(linkStart, linkEnd).toLowerCase();
newTokens.push({value: href, type: 'grist_link_hidden'});

Expand Down
7 changes: 7 additions & 0 deletions app/client/declarations/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {GristLoadConfig} from "app/common/gristUrls";

declare global {
export interface Window {
gristConfig: GristLoadConfig;
}
}
6 changes: 3 additions & 3 deletions app/client/ui/AccountWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
menuItemLink,
menuSubHeader,
} from 'app/client/ui2018/menus';
import {commonUrls, isFeatureEnabled} from 'app/common/gristUrls';
import {isFeatureEnabled} from 'app/common/gristUrls';
import {FullUser} from 'app/common/LoginSessionAPI';
import * as roles from 'app/common/roles';
import {Disposable, dom, DomElementArg, styled} from 'grainjs';
Expand Down Expand Up @@ -126,7 +126,7 @@ export class AccountWidget extends Disposable {
menuItemLink({href: getLoginOrSignupUrl()}, t("Sign in")),
menuDivider(),
documentSettingsItem,
menuItemLink({href: commonUrls.plans}, t("Pricing")),
menuItemLink({href: window.gristConfig.commonUrls.plans}, t("Pricing")),
mobileModeToggle,
];
}
Expand Down Expand Up @@ -249,7 +249,7 @@ export class AccountWidget extends Disposable {
const isEnabled = (deploymentType === 'core') && isFeatureEnabled("supportGrist");
if (isEnabled) {
return menuItemLink(t('Support Grist'), ' 💛',
{href: commonUrls.githubSponsorGristLabs, target: '_blank'},
{href: window.gristConfig.commonUrls.githubSponsorGristLabs, target: '_blank'},
testId('usermenu-support-grist'),
);
}
Expand Down
3 changes: 1 addition & 2 deletions app/client/ui/AdminLeftPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {colors, vars} from 'app/client/ui2018/cssVars';
import {IconName} from 'app/client/ui2018/IconList';
import {cssLink} from 'app/client/ui2018/links';
import {AdminPanelPage} from 'app/common/gristUrls';
import {commonUrls} from 'app/common/gristUrls';
import {getGristConfig} from "app/common/urlUtils";
import {Computed, dom, DomContents, MultiHolder, Observable, styled} from 'grainjs';

Expand Down Expand Up @@ -77,7 +76,7 @@ export function buildAdminLeftPanel(owner: MultiHolder, appModel: AppModel): Pag
buildPageEntry('docs', 'Page', adminControlsAvailable),
(adminControlsAvailable ? null :
cssPanelLink(cssLearnMoreLink(
{href: commonUrls.helpAdminControls, target: "_blank"},
{href: window.gristConfig.commonUrls.helpAdminControls, target: "_blank"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of defining app/client/lib/commonUrls.ts, to export commonUrl analogously to app/server/lib/commonUrls? Then this code wouldn't change, and more importantly, we'd encapsulate access to the global window object.

t("Learn more"), css.cssPageIcon('FieldLink'),
testId('learn-more'),
))
Expand Down
6 changes: 3 additions & 3 deletions app/client/ui/AdminPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {mediaSmall, testId, theme, vars} from 'app/client/ui2018/cssVars';
import {cssLink, makeLinks} from 'app/client/ui2018/links';
import {toggleSwitch} from 'app/client/ui2018/toggleSwitch';
import {BootProbeInfo, BootProbeResult, SandboxingBootProbeDetails} from 'app/common/BootProbe';
import {AdminPanelPage, commonUrls, getPageTitleSuffix, LatestVersionAvailable} from 'app/common/gristUrls';
import {AdminPanelPage, getPageTitleSuffix, LatestVersionAvailable} from 'app/common/gristUrls';
import {InstallAPI, InstallAPIImpl} from 'app/common/InstallAPI';
import {getGristConfig} from 'app/common/urlUtils';
import * as version from 'app/common/version';
Expand Down Expand Up @@ -274,7 +274,7 @@ Please log in as an administrator.`)),
dom(
'div',
{style: 'margin-top: 8px'},
cssLink({href: commonUrls.helpSandboxing, target: '_blank'}, t('Learn more.'))
cssLink({href: window.gristConfig.commonUrls.helpSandboxing, target: '_blank'}, t('Learn more.'))
),
];
}
Expand Down Expand Up @@ -675,7 +675,7 @@ system if you enable Grist Enterprise. {{contactUsLink}} to \
learn more.",
{
contactUsLink: cssLink(
{ href: commonUrls.contact, target: "_blank" },
{ href: window.gristConfig.commonUrls.contact, target: "_blank" },
t("Contact us")
),
}
Expand Down
5 changes: 2 additions & 3 deletions app/client/ui/AppHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {getTheme} from 'app/client/ui/CustomThemes';
import {cssLeftPane} from 'app/client/ui/PagePanels';
import {colors, theme, vars} from 'app/client/ui2018/cssVars';
import {menu, menuItem, menuItemLink, menuSubHeader} from 'app/client/ui2018/menus';
import {commonUrls} from 'app/common/gristUrls';
import {getOrgName, isTemplatesOrg, Organization} from 'app/common/UserAPI';
import {AppModel} from 'app/client/models/AppModel';
import {icon} from 'app/client/ui2018/icons';
Expand Down Expand Up @@ -131,7 +130,7 @@ export class AppHeader extends Disposable {
// When signed out and on the templates site (in SaaS Grist), link to the templates page.
return cssOrgLink(
cssOrgName(dom.text(this._appLogoOrgName), testId('orgname')),
{href: commonUrls.templates},
{href: window.gristConfig.commonUrls.templates},
testId('org'),
);
} else {
Expand Down Expand Up @@ -228,7 +227,7 @@ export class AppHeader extends Disposable {
name: t('Grist Templates'),
link: {
type: 'href',
href: commonUrls.templates,
href: window.gristConfig.commonUrls.templates,
},
};
}
Expand Down
3 changes: 1 addition & 2 deletions app/client/ui/AuditLogStreamingConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
AuditLogStreamingDestinationName,
AuditLogStreamingDestinationNameChecker,
} from "app/common/Config";
import { commonUrls } from "app/common/gristUrls";
import { Computed, Disposable, dom, makeTestId, Observable, styled } from "grainjs";

const t = makeT("AuditLogStreamingConfig");
Expand Down Expand Up @@ -42,7 +41,7 @@ security information and event management (SIEM) system like \
Splunk. {{learnMoreLink}}.",
{
learnMoreLink: cssLink(
{ href: commonUrls.helpInstallAuditLogs, target: "_blank" },
{ href: window.gristConfig.commonUrls.helpInstallAuditLogs, target: "_blank" },
t("Learn more")
),
}
Expand Down
4 changes: 2 additions & 2 deletions app/client/ui/AuditLogsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { cssBreadcrumbs, separator } from "app/client/ui2018/breadcrumbs";
import { textButton } from "app/client/ui2018/buttons";
import { theme, vars } from "app/client/ui2018/cssVars";
import { cssLink } from "app/client/ui2018/links";
import { commonUrls, getPageTitleSuffix } from "app/common/gristUrls";
import { getPageTitleSuffix } from "app/common/gristUrls";
import { getGristConfig } from "app/common/urlUtils";
import {
Computed,
Expand Down Expand Up @@ -115,7 +115,7 @@ SIEM (security information and event management) system if you \
enable Grist Enterprise. {{contactUsLink}} to learn more.",
{
contactUsLink: cssLink(
{ href: commonUrls.contact, target: "_blank" },
{ href: window.gristConfig.commonUrls.contact, target: "_blank" },
t("Contact us")
),
}
Expand Down
3 changes: 1 addition & 2 deletions app/client/ui/CustomWidgetGallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {loadingSpinner} from 'app/client/ui2018/loaders';
import {IModalControl, modal} from 'app/client/ui2018/modals';
import {AccessLevel, ICustomWidget, matchWidget, WidgetAuthor} from 'app/common/CustomWidget';
import {userTrustsCustomWidget} from 'app/client/ui/userTrustsCustomWidget';
import {commonUrls} from 'app/common/gristUrls';
import {bundleChanges, Computed, Disposable, dom, makeTestId, Observable, styled} from 'grainjs';
import escapeRegExp from 'lodash/escapeRegExp';

Expand Down Expand Up @@ -138,7 +137,7 @@ class CustomWidgetGallery extends Disposable {
cssFooter(
dom('div',
cssHelpLink(
{href: commonUrls.helpCustomWidgets, target: '_blank'},
{href: window.gristConfig.commonUrls.helpCustomWidgets, target: '_blank'},
cssHelpIcon('Question'),
t('Learn more about Custom Widgets'),
),
Expand Down
16 changes: 10 additions & 6 deletions app/client/ui/DocumentSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {confirmModal, cssModalButtons, cssModalTitle, cssSpinner, modal} from 'a
import {buildCurrencyPicker} from 'app/client/widgets/CurrencyPicker';
import {buildTZAutocomplete} from 'app/client/widgets/TZAutocomplete';
import {EngineCode} from 'app/common/DocumentSettings';
import {commonUrls, GristLoadConfig, PREFERRED_STORAGE_ANCHOR} from 'app/common/gristUrls';
import {GristLoadConfig, PREFERRED_STORAGE_ANCHOR} from 'app/common/gristUrls';
import {not, propertyCompare} from 'app/common/gutil';
import {getCurrency, locales} from 'app/common/Locales';
import {isOwner, isOwnerOrEditor} from 'app/common/roles';
Expand Down Expand Up @@ -176,7 +176,9 @@ document is first opened, or when a document responds to changes.'
expandedContent: dom('div',
cssWrap(
t('Document ID to use whenever the REST API calls for {{docId}}. See {{apiURL}}', {
apiURL: cssLink({href: commonUrls.helpAPI, target: '_blank'}, t('API documentation.')),
apiURL: cssLink(
{href: window.gristConfig.commonUrls.helpAPI, target: '_blank'}, t('API documentation.')
),
docId: dom('code', 'docId')
})
),
Expand Down Expand Up @@ -573,7 +575,9 @@ No data will be lost, except possibly currently pending actions.'
description: t('Document automatically opens in {{fiddleModeDocUrl}}. \
Anyone may edit, which will create a new unsaved copy.',
{
fiddleModeDocUrl: cssLink({href: commonUrls.helpFiddleMode, target: '_blank'}, t('fiddle mode'))
fiddleModeDocUrl: cssLink(
{href: window.gristConfig.commonUrls.helpFiddleMode, target: '_blank'}, t('fiddle mode')
)
}
),
itemTestId: testId('doctype-modal-option-template'),
Expand Down Expand Up @@ -680,13 +684,13 @@ function displayCurrentType(

const learnMore = () => t(
'[Learn more.]({{learnLink}})',
{learnLink: commonUrls.attachmentStorage}
{learnLink: window.gristConfig.commonUrls.attachmentStorage}
);

function stillExternalCopy(inProgress: Observable<boolean>, ...args: IDomArgs<HTMLSpanElement>) {
const someExternal = () => t(
'**Some existing attachments are still [external]({{externalLink}})**.',
{externalLink: commonUrls.attachmentStorage}
{externalLink: window.gristConfig.commonUrls.attachmentStorage}
);

const startToInternal = () => t(
Expand All @@ -713,7 +717,7 @@ function stillExternalCopy(inProgress: Observable<boolean>, ...args: IDomArgs<HT
function stillInternalCopy(inProgress: Observable<boolean>, ...args: IDomArgs<HTMLSpanElement>) {
const someInternal = () => t(
'**Some existing attachments are still [internal]({{internalLink}})** (stored in SQLite file).',
{internalLink: commonUrls.attachmentStorage}
{internalLink: window.gristConfig.commonUrls.attachmentStorage}
);

const startToExternal = () => t(
Expand Down
3 changes: 1 addition & 2 deletions app/client/ui/DuplicateTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {colors} from 'app/client/ui2018/cssVars';
import {icon} from 'app/client/ui2018/icons';
import {cssLink} from 'app/client/ui2018/links';
import {saveModal} from 'app/client/ui2018/modals';
import {commonUrls} from 'app/common/gristUrls';
import {Computed, Disposable, dom, input, makeTestId, Observable, styled} from 'grainjs';

const t = makeT('DuplicateTable');
Expand Down Expand Up @@ -84,7 +83,7 @@ class DuplicateTableModal extends Disposable {
cssWarning(
cssWarningIcon('Warning'),
dom('div', t("Instead of duplicating tables, it's usually better to segment data using linked views. {{link}}",
{link: cssLink({href: commonUrls.helpLinkingWidgets, target: '_blank'}, 'Read More.')}
{link: cssLink({href: window.gristConfig.commonUrls.helpLinkingWidgets, target: '_blank'}, 'Read More.')}
)),
),
cssField(
Expand Down
5 changes: 2 additions & 3 deletions app/client/ui/FormContainer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {makeT} from 'app/client/lib/localization';
import {colors, mediaSmall} from 'app/client/ui2018/cssVars';
import {icon} from 'app/client/ui2018/icons';
import {commonUrls} from 'app/common/gristUrls';
import {DomContents, DomElementArg, styled} from 'grainjs';

const t = makeT('FormContainer');
Expand All @@ -25,7 +24,7 @@ export function buildFormFooter() {
cssPoweredByGrist(
cssPoweredByGristLink(
{
href: commonUrls.forms,
href: window.gristConfig.commonUrls.forms,
target: '_blank',
'aria-label': t('Powered by Grist'),
},
Expand All @@ -35,7 +34,7 @@ export function buildFormFooter() {
),
cssBuildForm(
cssBuildFormLink(
{href: commonUrls.forms, target: '_blank'},
{href: window.gristConfig.commonUrls.forms, target: '_blank'},
t('Build your own form'),
icon('Expand'),
),
Expand Down
Loading