Refactor web interface

Reimplement the pages of the web interface in order to make them
prettier and more easily amended by plugins.
This commit is contained in:
Hornwitser committed 2020-11-06 23:08:43 +01:00
1 parent 0c0626564a
commit f67f56e6de
32 files changed
+1502 -1059

No files matched your search

+23
View File
@@ -1,5 +1,6 @@
import { notification } from "antd";
export default function notify(message, type = "info", description = undefined) {
notification[type]({
message: typeof message === "string" ? message : "ERROR: See console",
@@ -8,3 +9,25 @@ export default function notify(message, type = "info", description = undefined)
});
if (typeof message !== "string") console.error(message);
}
/**
* Promise rejection handler notifying the user
*
* Shows the error occuring in a notification card.
*
* @param {string} message -
* User facing message to give context to the error. Should say which
* operation failed.
* @returns {function(err)} function showing the error passed to it.
*/
export function notifyErrorHandler(message) {
return function handler(err) {
console.error(err);
notification.error({
message,
description: err.message,
duration: 0,
placement: "bottomRight",
});
};
}