blob: 9d5818d40bd2c27aff388de328d5398f3112a518 (
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
<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', 'cubes']" />
Items
</span>
</span>
</div>
<div id="quests" v-if="currentType === '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"
/>
<p id="count">
{{ session.quests.length }} quest{{ session.quests.length === 1 ? '' : 's' }},
{{ session.categories.length }} categor{{ session.categories.length === 1 ? 'y' : 'ies' }}
</p>
</div>
<div id="items" v-if="currentType === 'items'">
<EditorSidebarItem v-for="item in session.items" :key="item.id" :item="item" />
<p id="count">{{ session.items.length }} item{{ session.items.length === 1 ? '' : 's' }}</p>
</div>
<div id="configuration-container">
<EditorSidebarMainConfiguration />
</div>
</div>
</template>
<style scoped>
#sidebar-container {
width: 20rem;
border-right: 1px solid var(--color-border);
height: 100%;
max-height: 100%;
background-color: var(--color-background);
user-select: none;
position: relative;
z-index: 0;
box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
#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,
#items {
max-height: calc(100% - 46px - 30px);
overflow-y: auto;
}
#configuration-container {
height: 46px;
border-top: 1px solid var(--color-border);
position: absolute;
bottom: 0;
width: 100%;
}
#count {
margin: 0.5rem 0;
font-size: 0.7rem;
text-align: center;
color: var(--color-text-mute);
}
}
</style>
|