From 71e4ad2c71efea471923ea47f01bfda841387f81 Mon Sep 17 00:00:00 2001
From: Leonardo Bishop <me@leonardobishop.com>
Date: Sun, 10 Mar 2024 01:31:42 +0000
Subject: Use nuxt auto import magic

---
 components/editor/SidebarQuest.vue | 68 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 components/editor/SidebarQuest.vue

(limited to 'components/editor/SidebarQuest.vue')

diff --git a/components/editor/SidebarQuest.vue b/components/editor/SidebarQuest.vue
new file mode 100644
index 0000000..a7b3e3f
--- /dev/null
+++ b/components/editor/SidebarQuest.vue
@@ -0,0 +1,68 @@
+<script setup lang="ts">
+import { useSessionStore, type EditorQuest } from '@/stores/session';
+import { computed, toRefs } from 'vue';
+import { stripColorCodes } from '@/lib/util';
+
+const props = defineProps<{
+  quest: EditorQuest;
+}>();
+
+const { quest } = toRefs(props);
+
+const route = useRoute();
+
+const setSelectedQuest = () => {
+  navigateTo({ path: `/quest/${quest.value.id}` })
+};
+
+const selected = computed(() => {
+  return route.path.startsWith('/quest') && route.params.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">{{ stripColorCodes(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

