2020-10-02 15:10:00 +00:00
|
|
|
import {beaconOpenMessage, IBeaconOpenOptions} from 'app/client/lib/helpScout';
|
2022-10-28 16:11:08 +00:00
|
|
|
import {makeT} from 'app/client/lib/localization';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {AppModel} from 'app/client/models/AppModel';
|
|
|
|
import {ConnectState} from 'app/client/models/ConnectState';
|
|
|
|
import {urlState} from 'app/client/models/gristUrlState';
|
|
|
|
import {Expirable, IAppError, Notification, Notifier, NotifyAction, Progress} from 'app/client/models/NotifyModel';
|
2022-10-19 23:06:05 +00:00
|
|
|
import {hoverTooltip} from 'app/client/ui/tooltips';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {cssHoverCircle, cssTopBarBtn} from 'app/client/ui/TopBarCss';
|
2022-09-06 01:51:57 +00:00
|
|
|
import {theme, vars} from 'app/client/ui2018/cssVars';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
2021-10-01 19:38:58 +00:00
|
|
|
import {IconName} from "app/client/ui2018/IconList";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {menuCssClass} from 'app/client/ui2018/menus';
|
2022-05-27 11:03:56 +00:00
|
|
|
import {commonUrls, shouldHideUiElement} from 'app/common/gristUrls';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {dom, makeTestId, styled} from 'grainjs';
|
|
|
|
import {cssMenu, defaultMenuOptions, IOpenController, setPopupToCreateDom} from 'popweasel';
|
|
|
|
|
2022-10-28 16:11:08 +00:00
|
|
|
const t = makeT('NotifyUI');
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const testId = makeTestId('test-notifier-');
|
|
|
|
|
|
|
|
|
|
|
|
function buildAction(action: NotifyAction, item: Notification, options: IBeaconOpenOptions): HTMLElement|null {
|
|
|
|
const appModel = options.appModel;
|
|
|
|
switch (action) {
|
|
|
|
case 'upgrade':
|
2022-07-26 17:49:35 +00:00
|
|
|
if (appModel) {
|
2022-12-06 13:57:29 +00:00
|
|
|
return cssToastAction(t("Upgrade Plan"), dom.on('click', () =>
|
2022-07-26 17:49:35 +00:00
|
|
|
appModel.showUpgradeModal()));
|
|
|
|
} else {
|
2022-12-06 13:57:29 +00:00
|
|
|
return dom('a', cssToastAction.cls(''), t("Upgrade Plan"), {target: '_blank'},
|
2022-07-26 17:49:35 +00:00
|
|
|
{href: commonUrls.plans});
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
case 'renew':
|
|
|
|
// If already on the billing page, nothing to return.
|
|
|
|
if (urlState().state.get().billing === 'billing') { return null; }
|
|
|
|
// If not a billing manager, nothing to return.
|
|
|
|
if (appModel && appModel.currentOrg && appModel.currentOrg.billingAccount &&
|
|
|
|
!appModel.currentOrg.billingAccount.isManager) { return null; }
|
|
|
|
// Otherwise return a link to the billing page.
|
2022-12-06 13:57:29 +00:00
|
|
|
return dom('a', cssToastAction.cls(''), t("Renew"), {target: '_blank'},
|
2020-10-02 15:10:00 +00:00
|
|
|
{href: urlState().makeUrl({billing: 'billing'})});
|
|
|
|
|
2021-07-13 14:46:26 +00:00
|
|
|
case 'personal':
|
|
|
|
if (!appModel) { return null; }
|
2022-12-06 13:57:29 +00:00
|
|
|
return cssToastAction(t("Go to your free personal site"), dom.on('click', async () => {
|
2021-07-13 14:46:26 +00:00
|
|
|
const info = await appModel.api.getSessionAll();
|
|
|
|
const orgs = info.orgs.filter(org => org.owner && org.owner.id === appModel.currentUser?.id);
|
|
|
|
if (orgs.length !== 1) {
|
2022-12-06 13:57:29 +00:00
|
|
|
throw new Error(t("Cannot find personal site, sorry!"));
|
2021-07-13 14:46:26 +00:00
|
|
|
}
|
|
|
|
window.location.assign(urlState().makeUrl({org: orgs[0].domain || undefined}));
|
|
|
|
}));
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
case 'report-problem':
|
2022-12-06 13:57:29 +00:00
|
|
|
return cssToastAction(t("Report a problem"), testId('toast-report-problem'),
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.on('click', () => beaconOpenMessage({...options, includeAppErrors: true})));
|
|
|
|
|
|
|
|
case 'ask-for-help': {
|
|
|
|
const errors: IAppError[] = [{
|
|
|
|
error: new Error(item.options.message as string),
|
|
|
|
timestamp: item.options.timestamp,
|
|
|
|
}];
|
2022-12-06 13:57:29 +00:00
|
|
|
return cssToastAction(t("Ask for help"),
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.on('click', () => beaconOpenMessage({...options, includeAppErrors: true, errors})));
|
|
|
|
}
|
2022-10-21 10:55:01 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return cssToastAction(action.label, testId('toast-custom-action'),
|
|
|
|
dom.on('click', action.action));
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 19:38:58 +00:00
|
|
|
function notificationIcon(item: Notification) {
|
|
|
|
let iconName: IconName|null = null;
|
|
|
|
switch(item.options.level) {
|
|
|
|
case "error": iconName = "Warning"; break;
|
|
|
|
case "warning": iconName = "Warning"; break;
|
|
|
|
case "success": iconName = "TickSolid"; break;
|
|
|
|
case "info": iconName = "Info"; break;
|
|
|
|
}
|
|
|
|
return iconName ? icon(iconName, dom.cls(cssToastIcon.className)) : null;
|
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
function buildNotificationDom(item: Notification, options: IBeaconOpenOptions) {
|
2021-10-01 19:38:58 +00:00
|
|
|
const iconElement = notificationIcon(item);
|
|
|
|
const hasLeftIcon = Boolean(!item.options.title && iconElement);
|
2020-10-02 15:10:00 +00:00
|
|
|
return cssToastWrapper(testId('toast-wrapper'),
|
|
|
|
cssToastWrapper.cls(use => `-${use(item.status)}`),
|
2021-10-01 19:38:58 +00:00
|
|
|
cssToastWrapper.cls(`-${item.options.level}`),
|
2023-01-09 05:23:52 +00:00
|
|
|
cssToastWrapper.cls('-memo', item.options.memos.length > 0),
|
2021-10-01 19:38:58 +00:00
|
|
|
cssToastWrapper.cls(hasLeftIcon ? '-left-icon' : ''),
|
|
|
|
item.options.title ? null : iconElement,
|
2020-10-02 15:10:00 +00:00
|
|
|
cssToastBody(
|
2021-10-01 19:38:58 +00:00
|
|
|
item.options.title ? cssToastTitle(notificationIcon(item), cssToastTitle(item.options.title)) : null,
|
2020-10-02 15:10:00 +00:00
|
|
|
cssToastText(testId('toast-message'),
|
|
|
|
item.options.message,
|
|
|
|
),
|
|
|
|
item.options.actions.length ? cssToastActions(
|
|
|
|
item.options.actions.map((action) => buildAction(action, item, options))
|
|
|
|
) : null,
|
2021-02-15 21:36:33 +00:00
|
|
|
item.options.memos.length ? cssToastMemos(
|
2023-01-09 05:23:52 +00:00
|
|
|
item.options.memos.map(memo => cssToastMemo(
|
|
|
|
cssToastMemoIcon('Memo'),
|
|
|
|
dom('div', memo, testId('toast-memo')),
|
|
|
|
))
|
2021-02-15 21:36:33 +00:00
|
|
|
) : null,
|
2020-10-02 15:10:00 +00:00
|
|
|
),
|
|
|
|
dom.maybe(item.options.canUserClose, () =>
|
|
|
|
cssToastClose(testId('toast-close'),
|
|
|
|
'✕',
|
|
|
|
dom.on('click', () => item.dispose())
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildProgressDom(item: Progress) {
|
|
|
|
return cssToastWrapper(testId('progress-wrapper'),
|
|
|
|
cssToastBody(
|
|
|
|
cssToastText(testId('progress-message'),
|
|
|
|
dom.text(item.options.name),
|
|
|
|
dom.maybe(item.options.size, size => cssProgressBarSize(` (${size})`))
|
|
|
|
),
|
|
|
|
cssProgressBarWrapper(
|
|
|
|
cssProgressBarStatus(
|
|
|
|
dom.style('width', use => `${use(item.progress)}%`)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function buildNotifyMenuButton(notifier: Notifier, appModel: AppModel|null) {
|
|
|
|
const {connectState} = notifier.getStateForUI();
|
|
|
|
return cssHoverCircle({style: `margin: 5px;`},
|
|
|
|
dom.domComputed(connectState, (state) => buildConnectStateButton(state)),
|
|
|
|
(elem) => {
|
|
|
|
setPopupToCreateDom(elem, (ctl) => buildNotifyDropdown(ctl, notifier, appModel),
|
|
|
|
{...defaultMenuOptions, placement: 'bottom-end'});
|
|
|
|
},
|
2022-10-19 23:06:05 +00:00
|
|
|
hoverTooltip('Notifications', {key: 'topBarBtnTooltip'}),
|
2020-10-02 15:10:00 +00:00
|
|
|
testId('menu-btn'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildNotifyDropdown(ctl: IOpenController, notifier: Notifier, appModel: AppModel|null): Element {
|
|
|
|
const {connectState, disconnectMsg, dropdownItems} = notifier.getStateForUI();
|
|
|
|
|
|
|
|
return cssDropdownWrapper(
|
|
|
|
// Reuse css classes for menus (combination of popweasel classes and those from Grist menus)
|
|
|
|
dom.cls(cssMenu.className),
|
|
|
|
dom.cls(menuCssClass),
|
|
|
|
|
|
|
|
// Close on Escape.
|
|
|
|
dom.onKeyDown({Escape: () => ctl.close()}),
|
|
|
|
// Once attached, focus this element, so that it accepts keyboard events.
|
|
|
|
(elem) => { setTimeout(() => elem.focus(), 0); },
|
|
|
|
|
|
|
|
cssDropdownContent(
|
|
|
|
cssDropdownHeader(
|
2022-12-06 13:57:29 +00:00
|
|
|
cssDropdownHeaderTitle(t("Notifications")),
|
2022-05-27 11:03:56 +00:00
|
|
|
shouldHideUiElement("helpCenter") ? null :
|
2020-10-02 15:10:00 +00:00
|
|
|
cssDropdownFeedbackLink(
|
|
|
|
cssDropdownFeedbackIcon('Feedback'),
|
2022-12-06 13:57:29 +00:00
|
|
|
t("Give feedback"),
|
2021-12-07 05:37:37 +00:00
|
|
|
dom.on('click', () => beaconOpenMessage({appModel, onOpen: () => ctl.close(), route: '/ask/message/'})),
|
2020-10-02 15:10:00 +00:00
|
|
|
testId('feedback'),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
dom.maybe(disconnectMsg, (msg) =>
|
|
|
|
cssDropdownStatus(
|
|
|
|
buildConnectStateButton(connectState.get()),
|
|
|
|
dom('div', cssDropdownStatusText(msg.message), testId('disconnect-msg')),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
dom.maybe((use) => use(dropdownItems).length === 0 && !use(disconnectMsg), () =>
|
|
|
|
cssDropdownStatus(
|
2022-12-06 13:57:29 +00:00
|
|
|
dom('div', cssDropdownStatusText(t("No notifications"))),
|
2020-10-02 15:10:00 +00:00
|
|
|
)
|
|
|
|
),
|
|
|
|
dom.forEach(dropdownItems, item =>
|
|
|
|
buildNotificationDom(item, {appModel, onOpen: () => ctl.close()})),
|
|
|
|
),
|
|
|
|
testId('dropdown'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function buildSnackbarDom(notifier: Notifier, appModel: AppModel|null): Element {
|
|
|
|
const {progressItems, toasts} = notifier.getStateForUI();
|
|
|
|
return cssSnackbarWrapper(testId('snackbar-wrapper'),
|
|
|
|
dom.forEach(progressItems, item => buildProgressDom(item)),
|
|
|
|
dom.forEach(toasts, toast => buildNotificationDom(toast, {appModel})),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildConnectStateButton(state: ConnectState): Element {
|
|
|
|
switch (state) {
|
|
|
|
case ConnectState.JustDisconnected: return cssTopBarBtn('Notification', cssTopBarBtn.cls('-slate'));
|
|
|
|
case ConnectState.RecentlyDisconnected: return cssTopBarBtn('Offline', cssTopBarBtn.cls('-slate'));
|
|
|
|
case ConnectState.ReallyDisconnected: return cssTopBarBtn('Offline', cssTopBarBtn.cls('-error'));
|
|
|
|
case ConnectState.Connected:
|
|
|
|
default:
|
|
|
|
return cssTopBarBtn('Notification');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-01 19:38:58 +00:00
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const cssDropdownWrapper = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.notificationsPanelBodyBg};
|
|
|
|
border: 1px solid ${theme.notificationsPanelBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
padding: 0px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownContent = styled('div', `
|
|
|
|
min-width: 320px;
|
|
|
|
max-width: 320px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownHeader = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
padding: 24px;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.notificationsPanelHeaderBg};
|
|
|
|
outline: 1px solid ${theme.notificationsPanelBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownHeaderTitle = styled('span', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.text};
|
2020-10-02 15:10:00 +00:00
|
|
|
font-weight: bold;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownFeedbackLink = styled('div', `
|
|
|
|
display: flex;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.controlFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
&:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownFeedbackIcon = styled(icon, `
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.controlFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
margin-right: 4px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownStatus = styled('div', `
|
|
|
|
padding: 16px 48px 24px 48px;
|
|
|
|
text-align: center;
|
2022-09-06 01:51:57 +00:00
|
|
|
border-top: 1px solid ${theme.notificationsPanelBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDropdownStatusText = styled('div', `
|
|
|
|
display: inline-block;
|
|
|
|
margin: 8px 0 0 0;
|
|
|
|
text-align: left;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.lightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
2023-04-20 13:07:45 +00:00
|
|
|
// z-index below is set above other assorted children of <body>, which includes
|
|
|
|
// indexes such as 999 for modals.
|
2020-10-02 15:10:00 +00:00
|
|
|
const cssSnackbarWrapper = styled('div', `
|
|
|
|
position: fixed;
|
|
|
|
bottom: 8px;
|
|
|
|
right: 8px;
|
2023-04-20 13:07:45 +00:00
|
|
|
z-index: ${vars.notificationZIndex};
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: flex-end;
|
|
|
|
|
|
|
|
font-size: ${vars.mediumFontSize};
|
|
|
|
|
|
|
|
pointer-events: none; /* Allow mouse clicks through */
|
|
|
|
`);
|
|
|
|
|
2021-10-01 19:38:58 +00:00
|
|
|
const cssToastBody = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
flex-grow: 1;
|
|
|
|
padding: 0 12px;
|
|
|
|
overflow-wrap: anywhere;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastIcon = styled('div', `
|
|
|
|
flex-shrink: 0;
|
|
|
|
height: 18px;
|
|
|
|
width: 18px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastActions = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-end;
|
|
|
|
margin-top: 16px;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.toastControlFg};
|
2021-10-01 19:38:58 +00:00
|
|
|
`);
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const cssToastWrapper = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
min-width: 240px;
|
|
|
|
max-width: 320px;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
margin: 4px;
|
|
|
|
padding: 12px;
|
|
|
|
border-radius: 3px;
|
|
|
|
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.toastText};
|
|
|
|
background-color: ${theme.toastBg};
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
pointer-events: auto;
|
|
|
|
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity ${Expirable.fadeDelay}ms;
|
|
|
|
|
2023-01-09 05:23:52 +00:00
|
|
|
&-memo {
|
|
|
|
color: ${theme.toastMemoText};
|
|
|
|
background-color: ${theme.toastMemoBg};
|
|
|
|
}
|
2021-10-01 19:38:58 +00:00
|
|
|
&-error {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-left: 6px solid ${theme.toastErrorBg};
|
2021-10-01 19:38:58 +00:00
|
|
|
padding-left: 6px;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.toastErrorIcon};
|
2021-10-01 19:38:58 +00:00
|
|
|
}
|
|
|
|
&-success {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-left: 6px solid ${theme.toastSuccessBg};
|
2021-10-01 19:38:58 +00:00
|
|
|
padding-left: 6px;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.toastSuccessIcon};
|
2021-10-01 19:38:58 +00:00
|
|
|
}
|
|
|
|
&-warning {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-left: 6px solid ${theme.toastWarningBg};
|
2021-10-01 19:38:58 +00:00
|
|
|
padding-left: 6px;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.toastWarningIcon};
|
2021-10-01 19:38:58 +00:00
|
|
|
}
|
|
|
|
&-info {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-left: 6px solid ${theme.toastInfoBg};
|
2021-10-01 19:38:58 +00:00
|
|
|
padding-left: 6px;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.toastInfoIcon};
|
2021-10-01 19:38:58 +00:00
|
|
|
}
|
|
|
|
&-info .${cssToastActions.className} {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.toastInfoControlFg};
|
2021-10-01 19:38:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&-left-icon {
|
|
|
|
padding-left: 12px;
|
|
|
|
}
|
|
|
|
&-left-icon > .${cssToastBody.className} {
|
|
|
|
padding-left: 10px;
|
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
&-expiring, &-expired {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
2021-10-01 19:38:58 +00:00
|
|
|
.${cssDropdownContent.className} > & > .notification-icon {
|
|
|
|
display: none;
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
.${cssDropdownContent.className} > & {
|
|
|
|
background-color: unset;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.text};
|
2020-10-02 15:10:00 +00:00
|
|
|
border-radius: 0px;
|
2022-09-06 01:51:57 +00:00
|
|
|
border-top: 1px solid ${theme.notificationsPanelBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
margin: 0px;
|
|
|
|
padding: 16px 20px;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
const cssToastText = styled('div', `
|
2023-01-09 05:23:52 +00:00
|
|
|
.${cssToastWrapper.className}-memo & {
|
|
|
|
font-weight: 700;
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastTitle = styled(cssToastText, `
|
2021-10-01 19:38:58 +00:00
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
2020-10-02 15:10:00 +00:00
|
|
|
font-weight: bold;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastClose = styled('div', `
|
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
width: 16px;
|
|
|
|
height: 16px;
|
|
|
|
line-height: 16px;
|
|
|
|
text-align: center;
|
|
|
|
margin: -4px -4px -4px 4px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastAction = styled('div', `
|
|
|
|
cursor: pointer;
|
|
|
|
user-select: none;
|
|
|
|
margin-right: 24px;
|
|
|
|
&, &:hover, &:focus {
|
|
|
|
color: inherit;
|
|
|
|
}
|
|
|
|
&:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
2021-02-15 21:36:33 +00:00
|
|
|
const cssToastMemos = styled('div', `
|
2023-01-09 05:23:52 +00:00
|
|
|
margin-top: 8px;
|
2021-02-15 21:36:33 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastMemo = styled('div', `
|
2023-01-09 05:23:52 +00:00
|
|
|
display: flex;
|
|
|
|
column-gap: 8px;
|
|
|
|
align-items: center;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssToastMemoIcon = styled(icon, `
|
|
|
|
--icon-color: ${theme.toastMemoText};
|
|
|
|
flex-shrink: 0;
|
2021-02-15 21:36:33 +00:00
|
|
|
`);
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const cssProgressBarWrapper = styled('div', `
|
|
|
|
margin-top: 18px;
|
|
|
|
margin-bottom: 11px;
|
|
|
|
height: 3px;
|
|
|
|
border-radius: 3px;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.progressBarBg};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssProgressBarSize = styled('span', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.toastLightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssProgressBarStatus = styled('div', `
|
|
|
|
height: 3px;
|
|
|
|
min-width: 3px;
|
|
|
|
border-radius: 3px;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.progressBarFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|