From 72dddfae43ba793cc4f4bc8461dde990256885d1 Mon Sep 17 00:00:00 2001 From: Eliasboss2006 Date: Mon, 26 Aug 2024 13:51:39 +0200 Subject: [PATCH 01/10] ADD emoji --- package.json | 1 + src/components/EventDialogue.vue | 90 +++++++++++++++++++++++++++++++- src/components/EventDisplay.vue | 5 ++ src/components/TimeEvent.vue | 1 + src/data/ZBEvent.ts | 2 + 5 files changed, 98 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 5108b40..f622bf2 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "d3": "^7.6.1", "vue": "^3.4.29", "vue-router": "^4.3.3", + "vue3-emoji-picker": "^1.1.8", "vuex": "^4.0.2" }, "devDependencies": { diff --git a/src/components/EventDialogue.vue b/src/components/EventDialogue.vue index 49af292..3ab96e2 100644 --- a/src/components/EventDialogue.vue +++ b/src/components/EventDialogue.vue @@ -138,6 +138,63 @@ +
+
+ +
+
+
+
+
+
+ {{ + tempEvent.emoji == null || tempEvent.emoji.length < 1 + ? "Noch kein Emoji gewählt" + : "Gewähltes Emoji: " + tempEvent.emoji + }} +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
@@ -200,10 +257,12 @@ import { ref, computed } from "vue"; import type { defineComponent, PropType } from "vue"; import de from "@/de"; import en from "@/en"; +import EmojiPicker from "vue3-emoji-picker" +import "vue3-emoji-picker/css"; export default { name: "EventDialogue", - components: { MonthChooser }, + components: { MonthChooser, EmojiPicker }, props: { event: { type: Object as PropType }, }, @@ -212,10 +271,28 @@ export default { [...store.state.data.dimensions].reverse().filter((dim) => dim.visible) ); const tempEvent = ref(initEvent()); + const showEmojiPicker = ref(false); + + function onSelectEmoji(emoji: any) { + tempEvent.value.emoji = emoji.i; + showEmojiPicker.value = false; + } + + function removeEmoji() { + tempEvent.value.emoji = ""; + } + + function toggleEmojiPicker() { + showEmojiPicker.value = !showEmojiPicker.value; + } return { tempEvent, dimensionOptions, + onSelectEmoji, + removeEmoji, + showEmojiPicker, + toggleEmojiPicker, }; }, computed: { @@ -305,6 +382,17 @@ export default { z-index: 10; } +.dropdown-menu { + display: none; + position: absolute; + z-index: 1000; + width: 20em; +} + +.dropdown.is-active .dropdown-menu { + display: block; +} + @media screen and (min-width: 769px), print { .field-body { flex-grow: 3; diff --git a/src/components/EventDisplay.vue b/src/components/EventDisplay.vue index a82c61b..e11219b 100644 --- a/src/components/EventDisplay.vue +++ b/src/components/EventDisplay.vue @@ -4,6 +4,7 @@

+ {{ emoji }} {{ description }}