Skip to content

Commit 6f42cb6

Browse files
committed
fix: make dismiss button always visible, remove dynamic threshold
1 parent 7c85ded commit 6f42cb6

2 files changed

Lines changed: 16 additions & 18 deletions

File tree

src/components/graph/graph-view.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -590,21 +590,23 @@ export function GraphView() {
590590
return (
591591
<div
592592
key={i}
593-
className={`rounded border px-2 py-1.5 cursor-pointer transition-colors relative group ${isActive ? "bg-blue-500/15 border-blue-500/40" : "bg-muted/30 hover:bg-muted/50"}`}
593+
className={`rounded border px-2 py-1.5 cursor-pointer transition-colors ${isActive ? "bg-blue-500/15 border-blue-500/40" : "bg-muted/30 hover:bg-muted/50"}`}
594594
onClick={() => setHighlightedNodes(isActive ? new Set() : ids)}
595595
>
596-
<button
597-
className="absolute top-1 right-1 hidden group-hover:block p-0.5 rounded hover:bg-muted"
598-
onClick={(e) => {
599-
e.stopPropagation()
600-
setDismissedInsights((prev) => new Set([...prev, conn.key]))
601-
if (isActive) setHighlightedNodes(new Set())
602-
}}
603-
>
604-
<X className="h-3 w-3 text-muted-foreground" />
605-
</button>
606-
<div className="font-medium text-foreground">
607-
{conn.source.label}{conn.target.label}
596+
<div className="flex items-start justify-between gap-1">
597+
<div className="font-medium text-foreground">
598+
{conn.source.label}{conn.target.label}
599+
</div>
600+
<button
601+
className="shrink-0 p-0.5 rounded hover:bg-destructive/20 text-muted-foreground hover:text-destructive"
602+
onClick={(e) => {
603+
e.stopPropagation()
604+
setDismissedInsights((prev) => new Set([...prev, conn.key]))
605+
if (isActive) setHighlightedNodes(new Set())
606+
}}
607+
>
608+
<X className="h-3 w-3" />
609+
</button>
608610
</div>
609611
<div className="text-muted-foreground mt-0.5">
610612
{conn.reasons.join(", ")}

src/lib/graph-insights.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ export function findSurprisingConnections(
4141
// Structural pages that link to everything — exclude from analysis
4242
const STRUCTURAL_IDS = new Set(["index", "log", "overview"])
4343

44-
// Dynamic threshold: as wiki grows, require higher score to surface
45-
const nodeCount = nodes.length
46-
const dynamicThreshold = nodeCount < 20 ? 3 : nodeCount < 50 ? 4 : 5
47-
4844
const scored: SurprisingConnection[] = []
4945

5046
for (const edge of edges) {
@@ -95,7 +91,7 @@ export function findSurprisingConnections(
9591
reasons.push("weak but present connection")
9692
}
9793

98-
if (score >= dynamicThreshold && reasons.length > 0) {
94+
if (score >= 3 && reasons.length > 0) {
9995
const key = [source.id, target.id].sort().join(":::")
10096
scored.push({ source, target, score, reasons, key })
10197
}

0 commit comments

Comments
 (0)