(core) Adding colors to toast notification

Summary:
Styling toast notification. Adding colors and icons.
In Grist, changed the default style for errors (will be shown in red), and a style for
Linked copied to clipboard (will be shown in Green).
All other colors are not used currently, left for another diff.

Test Plan: manual

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3053
This commit is contained in:
Jarosław Sadziński
2021-10-01 21:38:58 +02:00
parent 43a62e7254
commit 40ddb57dfc
12 changed files with 203 additions and 22 deletions

View File

@@ -17,7 +17,7 @@ var commands = require('./commands');
var BackboneEvents = require('backbone').Events;
const {LinkingState} = require('./LinkingState');
const {ClientColumnGetters} = require('app/client/models/ClientColumnGetters');
const {reportError, UserError} = require('app/client/models/errors');
const {reportError, reportSuccess} = require('app/client/models/errors');
const {urlState} = require('app/client/models/gristUrlState');
const {SectionFilter} = require('app/client/models/SectionFilter');
const {copyToClipboard} = require('app/client/lib/copyToClipboard');
@@ -318,7 +318,7 @@ BaseView.prototype.copyLink = async function() {
const link = urlState().makeUrl({ hash: { sectionId, rowId, colRef } });
await copyToClipboard(link);
setTestState({clipboard: link});
reportError(new UserError('Link copied to clipboard', {key: 'clipboard'}));
reportSuccess('Link copied to clipboard', {key: 'clipboard'});
} catch (e) {
throw new Error('cannot copy to clipboard');
}

View File

@@ -270,7 +270,7 @@ class NotificationAdapter extends Disposable implements Notification {
}
public showUndoDiscard() {
const notifier = this._doc.app.topAppModel.notifier;
const notification = notifier.createUserError("Undo discard", {
const notification = notifier.createUserMessage("Undo discard", {
message: () =>
discardNotification(
dom.on("click", () => {