mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
1654a2681f
Summary: This moves all client code to core, and makes minimal fix-ups to get grist and grist-core to compile correctly. The client works in core, but I'm leaving clean-up around the build and bundles to follow-up. Test Plan: existing tests pass; server-dev bundle looks sane Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2627
31 lines
906 B
TypeScript
31 lines
906 B
TypeScript
// Grist client libs
|
|
import * as ModalDialog from 'app/client/components/ModalDialog';
|
|
import * as dom from 'app/client/lib/dom';
|
|
import * as kd from 'app/client/lib/koDom';
|
|
import * as kf from 'app/client/lib/koForm';
|
|
|
|
export function showConfirmDialog(title: string, btnText: string, onConfirm: () => Promise<void>,
|
|
explanation?: Element|string): void {
|
|
const body = dom('div.confirm',
|
|
explanation ? kf.row(explanation, kd.style('margin-bottom', '2rem')) : null,
|
|
kf.row(
|
|
1, kf.buttonGroup(
|
|
kf.button(() => dialog.hide(), 'Cancel')
|
|
),
|
|
1, kf.buttonGroup(
|
|
kf.accentButton(async () => {
|
|
await onConfirm();
|
|
dialog.hide();
|
|
}, btnText)
|
|
)
|
|
)
|
|
);
|
|
const dialog = ModalDialog.create({
|
|
title,
|
|
body,
|
|
width: '300px',
|
|
show: true
|
|
});
|
|
dialog.once('close', () => dialog.dispose());
|
|
}
|