Fix issue #35: Dragonroll frontend: item modifications
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
@@ -26,7 +26,6 @@ const sidebarCollapsed = ref(false);
|
||||
const activeSection = ref('notes');
|
||||
const isDragOverSidebar = ref(false);
|
||||
const expandedFolderIds = ref([]);
|
||||
const expandedEntryIds = ref([]);
|
||||
const nestedNoteListRef = ref(null);
|
||||
let entryRefreshInterval;
|
||||
|
||||
@@ -287,12 +286,6 @@ function showEntryMenu(entry, entityType) {
|
||||
ShowContextMenu(menuItems);
|
||||
}
|
||||
|
||||
function toggleEntryDetails(entryId) {
|
||||
expandedEntryIds.value = expandedEntryIds.value.includes(entryId)
|
||||
? expandedEntryIds.value.filter((id) => id !== entryId)
|
||||
: [...expandedEntryIds.value, entryId];
|
||||
}
|
||||
|
||||
async function openCharacterSheet(actor) {
|
||||
const existingWindowId = GetFirstWindowId('character_sheet');
|
||||
if (existingWindowId !== undefined) {
|
||||
@@ -302,6 +295,16 @@ async function openCharacterSheet(actor) {
|
||||
CreateWindow('character_sheet', { actor });
|
||||
}
|
||||
|
||||
// Clicking an item opens its window, like a character does with its sheet.
|
||||
async function openItemSheet(item) {
|
||||
const existingWindowId = GetFirstWindowId('item_sheet');
|
||||
if (existingWindowId !== undefined) {
|
||||
ClearWindow({ id: existingWindowId });
|
||||
await nextTick();
|
||||
}
|
||||
CreateWindow('item_sheet', { item });
|
||||
}
|
||||
|
||||
// Maps are anchored on the note container instead of opening a window: the notes that were open
|
||||
// stay open, and the sidebar's notes/maps buttons switch between the two.
|
||||
function openMapViewer(map) {
|
||||
@@ -498,17 +501,12 @@ onBeforeUnmount(() => {
|
||||
<div v-if="loadingEntries" class="sidebar-state">{{ t('campaigns.states.loading') }}</div>
|
||||
<div v-else-if="entriesError" class="sidebar-state error">{{ entriesError }}</div>
|
||||
<div v-else-if="items.length === 0" class="sidebar-state">{{ t('campaigns.states.empty-items') }}</div>
|
||||
<div v-for="item in items" :key="item._id" class="entity-entry" role="button" tabindex="0" :aria-expanded="expandedEntryIds.includes(item._id)" @click="toggleEntryDetails(item._id)" @keydown.enter="toggleEntryDetails(item._id)" @keydown.space.prevent="toggleEntryDetails(item._id)" @contextmenu.prevent="showEntryMenu(item, 'item')">
|
||||
<div v-for="item in items" :key="item._id" class="entity-entry" role="button" tabindex="0" @click="openItemSheet(item)" @keydown.enter="openItemSheet(item)" @keydown.space.prevent="openItemSheet(item)" @contextmenu.prevent="showEntryMenu(item, 'item')">
|
||||
<span class="entity-entry-name-row">
|
||||
<span class="entity-entry-name">{{ item.name }}</span>
|
||||
<span v-if="item.foundryItemId" class="entity-entry-sync">{{ t('campaigns.synced') }}</span>
|
||||
</span>
|
||||
<span class="entity-entry-meta">{{ itemSummary(item) }}</span>
|
||||
<template v-if="expandedEntryIds.includes(item._id)">
|
||||
<span v-if="item.weight !== undefined" class="entity-entry-description">{{ item.weight }} lb</span>
|
||||
<span v-if="item.properties" class="entity-entry-description">{{ item.properties }}</span>
|
||||
<span v-if="item.description" class="entity-entry-description">{{ item.description }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user