backend-events + code-cleanup (#395)

* additional server events

* sort 'recent recipes' by updated

* remove duplicate code

* fixes #396

* set color

* consolidate tag/category pages

* set colors

* list unorganized recipes

* cleanup old code

* remove flash message, switch to global snackbar

* cancel to close

* cleanup

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-05-07 14:33:20 -08:00
committed by GitHub
parent 96919319b1
commit 466997febc
31 changed files with 1604 additions and 686 deletions

View File

@@ -1,14 +1,7 @@
import { vueApp } from "../main";
import { recipe } from "@/utils/recipe";
import { store } from "@/store";
// TODO: Migrate to Mixins
const notifyHelpers = {
baseCSS: "notify-base",
error: "notify-error-color",
warning: "notify-warning-color",
success: "notify-success-color",
info: "notify-info-color",
};
export const utils = {
recipe: recipe,
@@ -27,27 +20,37 @@ export const utils = {
return `${year}-${month}-${day}`;
},
notify: {
show: function(text, type = "info", title = null) {
vueApp.flashMessage.show({
status: type,
info: function(text, title = null) {
store.commit("setSnackbar", {
open: true,
title: title,
message: text,
time: 3000,
blockClass: `${notifyHelpers.baseCSS} ${notifyHelpers[type]}`,
contentClass: `${notifyHelpers.baseCSS} ${notifyHelpers[type]}`,
text: text,
color: "info",
});
},
info: function(text, title = null) {
this.show(text, "info", title);
},
success: function(text, title = null) {
this.show(text, "success", title);
store.commit("setSnackbar", {
open: true,
title: title,
text: text,
color: "success",
});
},
error: function(text, title = null) {
this.show(text, "error", title);
store.commit("setSnackbar", {
open: true,
title: title,
text: text,
color: "error",
});
},
warning: function(text, title = null) {
this.show(text, "warning", title);
store.commit("setSnackbar", {
open: true,
title: title,
text: text,
color: "warning",
});
},
},
};