aboutsummaryrefslogtreecommitdiffstats
path: root/components/editor/Sidebar.vue
blob: 20168df2e829f7e30a352e1d4b8a274083a80d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<script setup lang="ts">
import { useSessionStore } from '@/stores/session';
import { storeToRefs } from 'pinia';

const sessionStore = useSessionStore();

const { session } = storeToRefs(sessionStore);

const currentType = ref('quests' as 'quests' | 'items');

const setSelectedType = (type: 'quests' | 'items') => {
  currentType.value = type;
}
</script>

<template>
  <div id="sidebar-container">
    <div id="selector">
      <span class="option" @click="setSelectedType('quests')" :class="{ selected: currentType === 'quests' }">
        <span>
          <font-awesome-icon :icon="['far', 'compass']" />
          Quests
        </span>
      </span>
      <span class="option" @click="setSelectedType('items')" :class="{ selected: currentType === 'items' }">
        <span>
          <font-awesome-icon :icon="['fas', 'cube']" />
          Items
        </span>
      </span>
    </div>
    <div id="quests">
      <EditorSidebarCategory v-for="category in session.categories" :key="category.id" :category="category" />
      <EditorSidebarQuest
        v-for="quest in session.quests.filter((q) => (!session.categories.some((c) => c.id === q.options.category)))"
        :key="quest.id" :quest="quest" />
    </div>
    <div id="configuration-container">
      <EditorSidebarMainConfiguration />
    </div>
  </div>
</template>

<style scoped>
#sidebar-container {
  width: 20rem;
  border-right: 1px solid var(--color-border);
  height: calc(100vh - 73px);
  max-height: calc(100vh - 73px);
  background-color: var(--color-background);
  user-select: none;
  position: relative;

  #selector {
    display: flex;
    height: 30px;
    align-items: center;
    cursor: pointer;

    .option {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      transition: background-color 0.3s;

      &.selected {
        background-color: var(--color-background);

        span {
          font-weight: 700;
        }
      }

      &:not(.selected) {
        background-color: var(--color-background-mute);
        color: var(--color-text-mute);
        transition: color 0.3s;

        &:hover {
          color: var(--color-text)
        }
      }
    }
  }

  #quests {
    max-height: calc(100vh - 73px - 46px);
    overflow-y: scroll;
  }

  #configuration-container {
    height: 46px;
    border-top: 1px solid var(--color-border);
    position: absolute;
    bottom: 0;
    width: 100%
  }
}
</style>