diff --git a/frontend/app/components/partials/ContentSidebar.vue b/frontend/app/components/partials/ContentSidebar.vue
index c32591cc..597a53a6 100644
--- a/frontend/app/components/partials/ContentSidebar.vue
+++ b/frontend/app/components/partials/ContentSidebar.vue
@@ -7,7 +7,7 @@ import { AnchorMap, AnchoredMap, ClearAnchoredMap, SetActivePane } from '~/servi
import { emitter } from '~/services/Emitter';
import { BuildColorMenu } from '~/services/EntryColors';
import { BuildItemRows } from '~/services/ItemFolders';
-import Server from '~/services/Server';
+import Server, { getBaseUrl } from '~/services/Server';
import { ClearWindow, CreateWindow, GetFirstWindowId } from '~/services/Windows';
import { HideContextMenu, ShowContextMenu } from '~/services/ContextMenu';
import { ACTOR_DRAG_TYPE } from '~/services/MapTokens';
@@ -283,6 +283,13 @@ function itemSummary(item) {
return `${t(`campaigns.item.categories.${item.category}`)} · ${t(`campaigns.item.rarities.${item.rarity}`)} · ${t('campaigns.item.quantity-short')} ${item.quantity}`;
}
+// An item's icon in the sidebar: an uploaded filename served from /api/public, or a full URL
+// (Foundry sends its own icon as one) — the same rule the item window uses.
+function itemImageUrl(image) {
+ if (!image) return '';
+ return /^(https?:|data:|\/\/)/i.test(image) ? image : `${getBaseUrl()}/public/${image}`;
+}
+
function mapSummary(map) {
return t('campaigns.map.summary', { size: map.gridSize, scale: map.scale });
}
@@ -670,9 +677,11 @@ onBeforeUnmount(() => {
@toggle="toggleFolder(row.folder._id)"
/>
-
+
+
+
+
{{ row.item.name }}
- {{ t('campaigns.synced') }}
{{ itemSummary(row.item) }}
@@ -865,6 +874,15 @@ onBeforeUnmount(() => {
}
.entity-entry-meta, .entity-entry-description { font-size: 12px; opacity: 0.72; }
.entity-entry-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
+/* An item row leads with the item's own icon on the left of its name, standing in for the
+ "SYNCED" text it used to show (Syndria98/dragonroll#53). */
+.entity-entry-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
+.entity-entry-image {
+ flex: 0 0 30px; width: 30px; height: 30px; box-sizing: border-box;
+ display: grid; place-items: center; overflow: hidden;
+ border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-background-soft);
+}
+.entity-entry-image img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 900px) {
.notes-sidebar {
diff --git a/tests/item-entry-display.test.js b/tests/item-entry-display.test.js
new file mode 100644
index 00000000..a9e21ccc
--- /dev/null
+++ b/tests/item-entry-display.test.js
@@ -0,0 +1,69 @@
+// Tests for Syndria98/dragonroll#53: the item row in the campaign sidebar dropped its "SYNCED"
+// text badge and now leads with the item's own icon on the left of the entry.
+//
+// The repository root installs no dependencies, so these read the sidebar component the way
+// tests/sidebar-entity-entry.test.js does — the checks are about the markup and style of the row.
+//
+// Run with `npm test` from the repository root, or `node --test tests/`.
+
+const { test } = require("node:test");
+const assert = require("node:assert/strict");
+const fs = require("node:fs");
+const path = require("node:path");
+
+const source = fs.readFileSync(
+ path.join(__dirname, "..", "frontend", "app", "components", "partials", "ContentSidebar.vue"),
+ "utf8"
+);
+
+// The block that renders the item rows, from the items section down to its closing template. The
+// items section is followed by the maps section (`v-else`), so the first `` that leads
+// there ends it; the inner `v-for` close is followed by another close, not by `v-else`.
+const itemSection =
+ /([\s\S]*?)<\/template>\s*\n\s*/.exec(source)?.[1] ?? "";
+
+// `selector` is inserted verbatim, so escape the `.` of a class combination. Comments are dropped:
+// they explain a rule, they are not part of it.
+function ruleFor(selector) {
+ const rule = new RegExp(`\\.${selector}\\s*\\{([^}]*)\\}`).exec(source)?.[0];
+ return rule?.replace(/\/\*[\s\S]*?\*\//g, "");
+}
+
+test("the item entry no longer shows the SYNCED text", () => {
+ assert.ok(itemSection, "expected to find the items section of the sidebar");
+ assert.doesNotMatch(itemSection, /campaigns\.synced/, "the item row must not render the synced text");
+ assert.doesNotMatch(itemSection, /entity-entry-sync/, "the item row must not render the synced badge");
+});
+
+test("the item entry shows the item's image on the left when it has one", () => {
+ // the icon renders only for an item that carries an image, resolved through the helper...
+ assert.match(
+ itemSection,
+ / {
+ const title = ruleFor("entity-entry-title");
+ assert.ok(title, "expected a .entity-entry-title style rule");
+ assert.match(title, /display:\s*flex/, "the icon and the name sit side by side");
+
+ const image = ruleFor("entity-entry-image");
+ assert.ok(image, "expected a .entity-entry-image style rule");
+ assert.match(image, /overflow:\s*hidden/, "the icon is clipped to its box");
+});
+
+test("an item image resolves like the item window: uploads from /public, full URLs as they are", () => {
+ assert.match(source, /import Server, \{ getBaseUrl \} from ['"]~\/services\/Server['"]/);
+
+ const resolver = /function itemImageUrl\(image\)\s*\{[\s\S]*?\n\}/.exec(source)?.[0] ?? "";
+ assert.ok(resolver, "expected an itemImageUrl helper");
+ assert.match(resolver, /https\?:/, "a full http(s) URL loads as it is");
+ assert.match(resolver, /data:/, "a data URI loads as it is");
+ assert.match(resolver, /\$\{getBaseUrl\(\)\}\/public\//, "an uploaded filename resolves as a /public file");
+});