Skip to content

Commit aedc70d

Browse files
authored
fix(UI): improve dependency graph node rendering (#937)
Fixes #915
1 parent e4f2d55 commit aedc70d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

frontend/routes/package/(_islands)/DependencyGraph.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function renderDependency(
236236
content = `${tooltip}\n${
237237
dependency.entrypoints.map((entrypoint) => {
238238
if (entrypoint == ".") {
239-
return "<I>default entrypoint</I>";
239+
return "<i>default entrypoint</i>";
240240
} else {
241241
return entrypoint;
242242
}
@@ -262,11 +262,22 @@ function renderDependency(
262262
break;
263263
}
264264

265+
const renderAttributeValue = (content?: string) => {
266+
if (!content) return content;
267+
268+
const hasHTMLTag = /<i>(.+?)<\/i>/.test(content);
269+
if (hasHTMLTag) {
270+
const htmlContent = content.replace(/\n/g, "<br/>");
271+
return `<${htmlContent}>`;
272+
}
273+
return `"${content}"`;
274+
};
275+
265276
return `[${
266277
Object
267278
.entries({ href, tooltip, label: content, color })
268279
.filter(([_, v]) => v)
269-
.map(([k, v]) => `${k}="${v}"`)
280+
.map(([k, v]) => `${k}=${renderAttributeValue(v)}`)
270281
.join(", ")
271282
}]`;
272283
}

0 commit comments

Comments
 (0)