Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-715]): anchor provenance popover to chip edge for right-aligned headers

Adam Eivy8a0557e432dc
diff --git a/client/src/components/DecisionLogWidget.jsx b/client/src/components/DecisionLogWidget.jsx
index 085a7c2955..9a727c5679 100644
--- a/client/src/components/DecisionLogWidget.jsx
+++ b/client/src/components/DecisionLogWidget.jsx
@@ -254,7 +254,7 @@ const DecisionLogWidget = memo(function DecisionLogWidget() {
</div>
</div>
<div className="flex items-center gap-2 shrink-0">
- <ProvenanceChip {...DECISION_PROVENANCE} />
+ <ProvenanceChip {...DECISION_PROVENANCE} align="end" />
<Link
to="/cos/learning"
className="flex items-center gap-1 text-sm text-port-accent hover:text-port-accent/80 transition-colors min-h-[40px] px-2"
diff --git a/client/src/components/ProactiveAlertsWidget.jsx b/client/src/components/ProactiveAlertsWidget.jsx
index e6703804e1..e412e071c1 100644
--- a/client/src/components/ProactiveAlertsWidget.jsx
+++ b/client/src/components/ProactiveAlertsWidget.jsx
@@ -91,7 +91,7 @@ const ProactiveAlertsWidget = memo(function ProactiveAlertsWidget() {
</div>
</div>
<div className="flex items-center gap-2 shrink-0">
- {hasAlerts && <ProvenanceChip {...ALERT_PROVENANCE} />}
+ {hasAlerts && <ProvenanceChip {...ALERT_PROVENANCE} align="end" />}
{hasAlerts && counts.total > 5 && (
<Link
to="/cos"
diff --git a/client/src/components/goals/GoalDetailPanel.jsx b/client/src/components/goals/GoalDetailPanel.jsx
index 5ee595285a..ef9ac6c910 100644
--- a/client/src/components/goals/GoalDetailPanel.jsx
+++ b/client/src/components/goals/GoalDetailPanel.jsx
@@ -77,7 +77,7 @@ export default function GoalDetailPanel({ goal, allGoals, onClose, onRefresh })
)}
</div>
<div className="flex items-center gap-1.5 shrink-0">
- {!s.editing && hasDerivedReading && <ProvenanceChip {...READING_PROVENANCE} />}
+ {!s.editing && hasDerivedReading && <ProvenanceChip {...READING_PROVENANCE} align="end" />}
<button onClick={onClose} className="p-1 text-gray-500 hover:text-white shrink-0">
<X className="w-4 h-4" />
</button>
diff --git a/client/src/components/ui/ProvenanceChip.jsx b/client/src/components/ui/ProvenanceChip.jsx
index d46082d6dd..fe43b225ae 100644
--- a/client/src/components/ui/ProvenanceChip.jsx
+++ b/client/src/components/ui/ProvenanceChip.jsx
@@ -37,6 +37,7 @@ export default function ProvenanceChip({
explainer,
whatWouldChange,
className = '',
+ align = 'start',
}) {
const meta = getProvenanceLevel(level);
const [open, setOpen] = useState(false);
@@ -78,7 +79,11 @@ export default function ProvenanceChip({
{open && (
<div
id={popId}
- className="absolute left-0 top-full z-30 mt-1.5 w-64 max-w-[calc(100vw-2rem)] rounded-lg border border-port-border bg-port-card p-3 text-left shadow-xl"
+ // `align="end"` anchors the popover to the chip's right edge (opens
+ // leftward) so a chip sitting in a right-aligned header — dashboard
+ // widget headers, the goal detail panel — doesn't push its 16rem panel
+ // off the card's right edge (dashboard cells clip with overflow-hidden).
+ className={`absolute ${align === 'end' ? 'right-0' : 'left-0'} top-full z-30 mt-1.5 w-64 max-w-[calc(100vw-2rem)] rounded-lg border border-port-border bg-port-card p-3 text-left shadow-xl`}
>
<p className="mb-1 flex items-center gap-1.5 text-xs font-semibold text-gray-200 normal-case tracking-normal">
<Icon size={12} aria-hidden="true" className={`shrink-0 ${iconTone}`} />
diff --git a/client/src/components/ui/ProvenanceChip.test.jsx b/client/src/components/ui/ProvenanceChip.test.jsx
index 371161b740..21639a498e 100644
--- a/client/src/components/ui/ProvenanceChip.test.jsx
+++ b/client/src/components/ui/ProvenanceChip.test.jsx
@@ -71,4 +71,22 @@ describe('ProvenanceChip', () => {
fireEvent.keyDown(document, { key: 'Escape' });
expect(screen.queryByText('What would change this?')).toBeNull();
});
+
+ it('anchors the popover left by default and right when align="end"', () => {
+ // Right-aligned headers (dashboard widgets, the goal detail panel) sit inside
+ // overflow-hidden cells, so a left-anchored (rightward-opening) popover would
+ // clip off the card edge. align="end" opens it leftward instead.
+ const { unmount } = render(<ProvenanceChip level="inferred" />);
+ fireEvent.click(screen.getByRole('button'));
+ let popover = screen.getByText('What would change this?').closest('div');
+ expect(popover.className).toContain('left-0');
+ expect(popover.className).not.toContain('right-0');
+ unmount();
+
+ render(<ProvenanceChip level="inferred" align="end" />);
+ fireEvent.click(screen.getByRole('button'));
+ popover = screen.getByText('What would change this?').closest('div');
+ expect(popover.className).toContain('right-0');
+ expect(popover.className).not.toContain('left-0');
+ });
});