Skip to content

Commit fcd8273

Browse files
Copilotmikebarkmin
andcommitted
Add icons to resources and improve book format
- Add 🌐 icon before URL resources - Add πŸ“š icon before book resources - Format book resources as: πŸ“š Label (Name, Location) - Handle empty name field properly (no comma when name is empty) Co-authored-by: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com>
1 parent 5d453ce commit fcd8273

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

β€Žpackages/learningmap/src/Drawer.tsxβ€Ž

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,22 @@ export function Drawer({ open, onClose, onUpdate, node, nodes, onNodeClick, lang
115115
<ul>
116116
{node.data?.resources.map((r: Resource, idx: number) => {
117117
if (r.type === "book") {
118+
// Format: πŸ“š Label (Name, Location)
119+
// If name is empty, no comma should be visible
120+
const bookDetails = [];
121+
if (r.bookName) bookDetails.push(r.bookName);
122+
if (r.bookLocation) bookDetails.push(r.bookLocation);
123+
const detailsText = bookDetails.length > 0 ? ` (${bookDetails.join(', ')})` : '';
124+
118125
return (
119126
<li key={idx}>
120-
<strong>{r.label}</strong>
121-
{r.bookName && <div style={{ fontSize: "0.9em", color: "#6b7280" }}>πŸ“š {r.bookName}</div>}
122-
{r.bookLocation && <div style={{ fontSize: "0.9em", color: "#6b7280" }}>πŸ“ {r.bookLocation}</div>}
127+
πŸ“š <strong>{r.label}</strong>{detailsText}
123128
</li>
124129
);
125130
}
126131
return (
127132
<li key={idx}>
128-
{r.url ? (
133+
🌐 {r.url ? (
129134
<a href={r.url} target="_blank" rel="noopener noreferrer">{r.label}</a>
130135
) : (
131136
<span>{r.label}</span>

0 commit comments

Comments
Β (0)