From 2aca4247c5d0c7061a300517178dd31316b65fab Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Thu, 15 Feb 2024 14:01:30 +0000
Subject: Initial commit

---
 src/components/Editor/EditorSidebarQuest.vue | 68 ++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 src/components/Editor/EditorSidebarQuest.vue

(limited to 'src/components/Editor/EditorSidebarQuest.vue')

diff --git a/src/components/Editor/EditorSidebarQuest.vue b/src/components/Editor/EditorSidebarQuest.vue
new file mode 100644
index 0000000..08f1625
--- /dev/null
+++ b/src/components/Editor/EditorSidebarQuest.vue
@@ -0,0 +1,68 @@
+<script setup lang="ts">
+import { useSessionStore, type EditorQuest } from '@/stores/session';
+import { computed, toRefs } from 'vue';
+import { stripColourCodes } from '@/lib/util';
+
+const props = defineProps<{
+  quest: EditorQuest;
+}>();
+
+const { quest } = toRefs(props);
+
+const sessionStore = useSessionStore();
+
+const setSelectedQuest = () => {
+  sessionStore.setEditorSelected('Quest', quest.value.id);
+};
+
+const selected = computed(() => {
+  return sessionStore.editor.selected.type === 'Quest' && sessionStore.editor.selected.id === quest.value.id;
+});
+</script>
+
+<template>
+  <div id="quest-container" @click.stop="setSelectedQuest" :class="{selected: selected}">
+    <span id="quest-title">
+      <font-awesome-icon class="quest-icon" :icon="['far', 'fa-compass']"/> 
+      <span id="quest-name">
+        <span id="quest-display-name">{{ stripColourCodes(quest.display.name) }}</span> 
+        <code id="quest-display-id">{{ quest.id }}</code> 
+      </span>
+    </span>
+  </div>
+</template>
+
+<style scoped>
+#quest-container {
+  cursor: pointer;
+  padding: 0.3rem 1rem;
+  transition: background-color 0.3s;
+
+  #quest-title {
+    display: flex;
+    align-items: center;
+    margin: 0;
+    gap: 0.5rem;
+    font-size: 0.8rem;
+    
+    #quest-name {
+      display: flex;
+      flex-direction: column;
+      align-items: left;
+      
+      #quest-display-id {
+        font-size: 0.6rem;
+        color: var(--color-text-mute);
+      }
+    }
+  }
+}
+
+.selected {
+  background-color: var(--color-primary-mute) !important;
+}
+
+#quest-container:hover {
+  background-color: var(--color-hover);
+}
+</style>
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

