fix: improve edge visibility and legend line thickness

- Increased edge opacities for better visual distinction while maintaining ethereal aesthetic:
  - Derives: 0.35 -> 0.45, width 1 -> 1.2
  - Updates: 0.6 -> 0.7, width 1.5 -> 2
  - Extends: 0.3 -> 0.4, width 1 -> 1.2
- Increased legend LineIcon border from 1.6px to 2.5px so edge type colors are clearly visible
- Updated test expectations to match new values
- All 107 tests pass, types clean, biome clean
This commit is contained in:
Vorflux AI 2026-03-28 23:45:55 +00:00
parent 11a2ff5ec9
commit 3caeedc5a9
5 changed files with 21 additions and 22 deletions

View file

@ -645,12 +645,11 @@ describe("getEdgeVisualProps: all MemoryRelation values return valid visual prop
expect(upd.opacity).toBeGreaterThan(der.opacity)
})
it("unknown edge type returns default props (opacity 0.3, thickness 1)", () => {
// The default case returns { opacity: 0.3, thickness: 1 }.
// opacity matches derives (0.3), but thickness is intentionally 1 (not 1.5),
// a safe conservative fallback that doesn't match any specific known type.
it("unknown edge type returns default props (opacity 0.4, thickness 1.2)", () => {
// The default case returns { opacity: 0.4, thickness: 1.2 }.
// A safe conservative fallback that doesn't match any specific known type.
const unknown = getEdgeVisualProps("nonexistent")
expect(unknown.opacity).toBeCloseTo(0.3)
expect(unknown.thickness).toBeCloseTo(1)
expect(unknown.opacity).toBeCloseTo(0.4)
expect(unknown.thickness).toBeCloseTo(1.2)
})
})

View file

@ -61,25 +61,25 @@ describe("getMemoryBorderColor", () => {
describe("getEdgeVisualProps", () => {
it("returns correct props for derives edges", () => {
const props = getEdgeVisualProps("derives")
expect(props.opacity).toBeCloseTo(0.35)
expect(props.thickness).toBeCloseTo(1)
expect(props.opacity).toBeCloseTo(0.45)
expect(props.thickness).toBeCloseTo(1.2)
})
it("returns correct props for updates edges", () => {
const props = getEdgeVisualProps("updates")
expect(props.opacity).toBeCloseTo(0.6)
expect(props.thickness).toBeCloseTo(1.5)
expect(props.opacity).toBeCloseTo(0.7)
expect(props.thickness).toBeCloseTo(2)
})
it("returns correct props for extends edges", () => {
const props = getEdgeVisualProps("extends")
expect(props.opacity).toBeCloseTo(0.3)
expect(props.thickness).toBeCloseTo(1)
expect(props.opacity).toBeCloseTo(0.4)
expect(props.thickness).toBeCloseTo(1.2)
})
it("returns default props for unknown edge types", () => {
const props = getEdgeVisualProps("unknown")
expect(props.opacity).toBeCloseTo(0.3)
expect(props.thickness).toBeCloseTo(1)
expect(props.opacity).toBeCloseTo(0.4)
expect(props.thickness).toBeCloseTo(1.2)
})
})

View file

@ -59,11 +59,11 @@ function edgeStyle(
colors: GraphThemeColors,
): { color: string; width: number; opacity: number } {
if (edge.edgeType === "derives")
return { color: colors.edgeDerives, width: 1, opacity: 0.35 }
return { color: colors.edgeDerives, width: 1.2, opacity: 0.45 }
if (edge.edgeType === "updates")
return { color: colors.edgeUpdates, width: 1.5, opacity: 0.6 }
return { color: colors.edgeUpdates, width: 2, opacity: 0.7 }
// "extends" and any unknown edge types
return { color: colors.edgeExtends, width: 1, opacity: 0.3 }
return { color: colors.edgeExtends, width: 1.2, opacity: 0.4 }
}
function batchKey(style: {

View file

@ -57,7 +57,7 @@ function LineIcon({
style={{
width: 12,
height: 0,
borderTop: `1.6px ${dashed ? "dashed" : "solid"} ${color}`,
borderTop: `2.5px ${dashed ? "dashed" : "solid"} ${color}`,
}}
/>
</div>

View file

@ -30,13 +30,13 @@ export function getMemoryBorderColor(
export function getEdgeVisualProps(edgeType: string) {
switch (edgeType) {
case "derives":
return { opacity: 0.35, thickness: 1 }
return { opacity: 0.45, thickness: 1.2 }
case "updates":
return { opacity: 0.6, thickness: 1.5 }
return { opacity: 0.7, thickness: 2 }
case "extends":
return { opacity: 0.3, thickness: 1 }
return { opacity: 0.4, thickness: 1.2 }
default:
return { opacity: 0.3, thickness: 1 }
return { opacity: 0.4, thickness: 1.2 }
}
}