Spaces:
Sleeping
Sleeping
Commit
·
836f1d8
1
Parent(s):
dd2d5de
add
Browse files
frontend/src/components/shared/FloatingActionWidget.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import { api } from "@/lib/api";
|
|
| 36 |
|
| 37 |
// Disable jittery animations/motion for the floating widget in HF build
|
| 38 |
const DISABLE_FLOATING_WIDGET_JITTER = true;
|
|
|
|
| 39 |
|
| 40 |
// Add custom glow animation styles
|
| 41 |
const glowStyle = `
|
|
@@ -142,7 +143,7 @@ export function FloatingActionWidget() {
|
|
| 142 |
|
| 143 |
const [isExpanded, setIsExpanded] = useState(false);
|
| 144 |
const [isDragging, setIsDragging] = useState(false);
|
| 145 |
-
const [showTooltip, setShowTooltip] = useState(
|
| 146 |
const [hasMoved, setHasMoved] = useState(false);
|
| 147 |
const [currentMood, setCurrentMood] = useState<PetMood>("curious");
|
| 148 |
const [currentMessage, setCurrentMessage] = useState<PetMessage>({
|
|
@@ -327,10 +328,10 @@ export function FloatingActionWidget() {
|
|
| 327 |
// Hide tooltip after 6 seconds or when expanded
|
| 328 |
useEffect(() => {
|
| 329 |
const timer = setTimeout(() => {
|
| 330 |
-
setShowTooltip(false);
|
| 331 |
}, 6000);
|
| 332 |
|
| 333 |
-
if (isExpanded) {
|
| 334 |
setShowTooltip(false);
|
| 335 |
}
|
| 336 |
|
|
@@ -457,6 +458,7 @@ export function FloatingActionWidget() {
|
|
| 457 |
|
| 458 |
// Handle mouse down for dragging
|
| 459 |
const handleMouseDown = (e: React.MouseEvent) => {
|
|
|
|
| 460 |
if (!widgetRef.current) return;
|
| 461 |
|
| 462 |
e.preventDefault();
|
|
@@ -539,6 +541,12 @@ export function FloatingActionWidget() {
|
|
| 539 |
// Prevent toggle during dragging or if widget was just moved
|
| 540 |
if (isDragging || hasMoved) return;
|
| 541 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
setIsExpanded(!isExpanded);
|
| 543 |
setLastInteraction(Date.now()); // Update interaction time
|
| 544 |
};
|
|
@@ -822,12 +830,11 @@ export function FloatingActionWidget() {
|
|
| 822 |
{/* Collapsed Widget */}
|
| 823 |
<div
|
| 824 |
ref={widgetRef}
|
| 825 |
-
className={`fixed ${
|
| 826 |
-
isDragging ? "cursor-grabbing select-none" : "cursor-grab"
|
| 827 |
-
}`}
|
| 828 |
style={{
|
| 829 |
-
|
| 830 |
-
|
|
|
|
| 831 |
zIndex: 9999,
|
| 832 |
pointerEvents: "auto",
|
| 833 |
transition: isDragging ? "none" : "all 0.1s ease",
|
|
@@ -836,18 +843,20 @@ export function FloatingActionWidget() {
|
|
| 836 |
{/* Pet Widget - Always visible */}
|
| 837 |
<div className="relative">
|
| 838 |
<div
|
| 839 |
-
className={`w-14 h-14 bg-primary hover:bg-primary/90 rounded-full shadow-lg flex flex-col items-center justify-center cursor-pointer transition-all duration-200
|
| 840 |
-
|
| 841 |
-
}
|
| 842 |
-
|
|
|
|
|
|
|
| 843 |
} ${
|
| 844 |
-
isAtChartCenter
|
| 845 |
? "ring-4 ring-blue-400/50 ring-offset-4 shadow-xl shadow-blue-500/30 scale-110"
|
| 846 |
: ""
|
| 847 |
}`}
|
| 848 |
onMouseDown={handleMouseDown}
|
| 849 |
-
onMouseEnter={handleMouseEnter}
|
| 850 |
-
onMouseLeave={handleMouseLeave}
|
| 851 |
onClick={toggleExpanded}
|
| 852 |
style={{
|
| 853 |
// Disable glow animation to avoid jitter
|
|
@@ -864,7 +873,7 @@ export function FloatingActionWidget() {
|
|
| 864 |
</div>
|
| 865 |
|
| 866 |
{/* Pet tooltip with mood-based messages - only show when collapsed */}
|
| 867 |
-
{showTooltip && !isExpanded && (
|
| 868 |
<div className="absolute -top-16 -right-4 w-48 bg-black/90 text-white text-xs px-3 py-2 rounded-lg shadow-lg z-10">
|
| 869 |
<div className="text-center">{currentMessage.text}</div>
|
| 870 |
<div className="absolute top-full right-6 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-black/90"></div>
|
|
@@ -874,7 +883,7 @@ export function FloatingActionWidget() {
|
|
| 874 |
</div>
|
| 875 |
|
| 876 |
{/* Expanded Panel - Positioned Separately */}
|
| 877 |
-
{isExpanded && (
|
| 878 |
<div
|
| 879 |
className="fixed"
|
| 880 |
style={{
|
|
|
|
| 36 |
|
| 37 |
// Disable jittery animations/motion for the floating widget in HF build
|
| 38 |
const DISABLE_FLOATING_WIDGET_JITTER = true;
|
| 39 |
+
const FLOATING_WIDGET_MINIMAL = true; // fixed bottom-right, no drag/tooltip; click opens splitter
|
| 40 |
|
| 41 |
// Add custom glow animation styles
|
| 42 |
const glowStyle = `
|
|
|
|
| 143 |
|
| 144 |
const [isExpanded, setIsExpanded] = useState(false);
|
| 145 |
const [isDragging, setIsDragging] = useState(false);
|
| 146 |
+
const [showTooltip, setShowTooltip] = useState(!FLOATING_WIDGET_MINIMAL);
|
| 147 |
const [hasMoved, setHasMoved] = useState(false);
|
| 148 |
const [currentMood, setCurrentMood] = useState<PetMood>("curious");
|
| 149 |
const [currentMessage, setCurrentMessage] = useState<PetMessage>({
|
|
|
|
| 328 |
// Hide tooltip after 6 seconds or when expanded
|
| 329 |
useEffect(() => {
|
| 330 |
const timer = setTimeout(() => {
|
| 331 |
+
if (!FLOATING_WIDGET_MINIMAL) setShowTooltip(false);
|
| 332 |
}, 6000);
|
| 333 |
|
| 334 |
+
if (isExpanded && !FLOATING_WIDGET_MINIMAL) {
|
| 335 |
setShowTooltip(false);
|
| 336 |
}
|
| 337 |
|
|
|
|
| 458 |
|
| 459 |
// Handle mouse down for dragging
|
| 460 |
const handleMouseDown = (e: React.MouseEvent) => {
|
| 461 |
+
if (FLOATING_WIDGET_MINIMAL) return; // disable drag in minimal mode
|
| 462 |
if (!widgetRef.current) return;
|
| 463 |
|
| 464 |
e.preventDefault();
|
|
|
|
| 541 |
// Prevent toggle during dragging or if widget was just moved
|
| 542 |
if (isDragging || hasMoved) return;
|
| 543 |
|
| 544 |
+
if (FLOATING_WIDGET_MINIMAL) {
|
| 545 |
+
setIsSplitterModalOpen(true);
|
| 546 |
+
setLastInteraction(Date.now());
|
| 547 |
+
return;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
setIsExpanded(!isExpanded);
|
| 551 |
setLastInteraction(Date.now()); // Update interaction time
|
| 552 |
};
|
|
|
|
| 830 |
{/* Collapsed Widget */}
|
| 831 |
<div
|
| 832 |
ref={widgetRef}
|
| 833 |
+
className={`fixed ${FLOATING_WIDGET_MINIMAL ? "cursor-pointer" : isDragging ? "cursor-grabbing select-none" : "cursor-grab"}`}
|
|
|
|
|
|
|
| 834 |
style={{
|
| 835 |
+
...(FLOATING_WIDGET_MINIMAL
|
| 836 |
+
? { right: 20, bottom: 20 }
|
| 837 |
+
: { left: `${position.x}px`, top: `${position.y}px` }),
|
| 838 |
zIndex: 9999,
|
| 839 |
pointerEvents: "auto",
|
| 840 |
transition: isDragging ? "none" : "all 0.1s ease",
|
|
|
|
| 843 |
{/* Pet Widget - Always visible */}
|
| 844 |
<div className="relative">
|
| 845 |
<div
|
| 846 |
+
className={`w-14 h-14 bg-primary hover:bg-primary/90 rounded-full shadow-lg flex flex-col items-center justify-center cursor-pointer transition-all duration-200 ${
|
| 847 |
+
FLOATING_WIDGET_MINIMAL ? "" : "hover:scale-110"
|
| 848 |
+
} relative ${
|
| 849 |
+
showTooltip && !FLOATING_WIDGET_MINIMAL ? "shadow-primary/50 shadow-2xl" : ""
|
| 850 |
+
} ${isDragging && !FLOATING_WIDGET_MINIMAL ? "scale-110 shadow-2xl opacity-90" : ""} ${
|
| 851 |
+
isExpanded && !FLOATING_WIDGET_MINIMAL ? "ring-2 ring-primary/50 ring-offset-2" : ""
|
| 852 |
} ${
|
| 853 |
+
isAtChartCenter && !FLOATING_WIDGET_MINIMAL
|
| 854 |
? "ring-4 ring-blue-400/50 ring-offset-4 shadow-xl shadow-blue-500/30 scale-110"
|
| 855 |
: ""
|
| 856 |
}`}
|
| 857 |
onMouseDown={handleMouseDown}
|
| 858 |
+
onMouseEnter={FLOATING_WIDGET_MINIMAL ? undefined : handleMouseEnter}
|
| 859 |
+
onMouseLeave={FLOATING_WIDGET_MINIMAL ? undefined : handleMouseLeave}
|
| 860 |
onClick={toggleExpanded}
|
| 861 |
style={{
|
| 862 |
// Disable glow animation to avoid jitter
|
|
|
|
| 873 |
</div>
|
| 874 |
|
| 875 |
{/* Pet tooltip with mood-based messages - only show when collapsed */}
|
| 876 |
+
{showTooltip && !isExpanded && !FLOATING_WIDGET_MINIMAL && (
|
| 877 |
<div className="absolute -top-16 -right-4 w-48 bg-black/90 text-white text-xs px-3 py-2 rounded-lg shadow-lg z-10">
|
| 878 |
<div className="text-center">{currentMessage.text}</div>
|
| 879 |
<div className="absolute top-full right-6 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-black/90"></div>
|
|
|
|
| 883 |
</div>
|
| 884 |
|
| 885 |
{/* Expanded Panel - Positioned Separately */}
|
| 886 |
+
{isExpanded && !FLOATING_WIDGET_MINIMAL && (
|
| 887 |
<div
|
| 888 |
className="fixed"
|
| 889 |
style={{
|
frontend/src/lib/cytoscape-graph-core.ts
CHANGED
|
@@ -297,7 +297,8 @@ export class CytoscapeGraphCore {
|
|
| 297 |
const mainWorkflowTopGap = Math.min(175, nodeSpacing * 1.5);
|
| 298 |
const mainWorkflowStartY = isolatedBottomY + mainWorkflowTopGap;
|
| 299 |
const centerY = mainWorkflowStartY + this.config.height * 0.2;
|
| 300 |
-
|
|
|
|
| 301 |
const agentX = this.config.width * 0.14;
|
| 302 |
const toolX = this.config.width * 0.3;
|
| 303 |
const taskX = this.config.width * 0.5;
|
|
|
|
| 297 |
const mainWorkflowTopGap = Math.min(175, nodeSpacing * 1.5);
|
| 298 |
const mainWorkflowStartY = isolatedBottomY + mainWorkflowTopGap;
|
| 299 |
const centerY = mainWorkflowStartY + this.config.height * 0.2;
|
| 300 |
+
// Keep inputs within the visible canvas with a small left margin
|
| 301 |
+
const inputX = this.config.width * 0.04;
|
| 302 |
const agentX = this.config.width * 0.14;
|
| 303 |
const toolX = this.config.width * 0.3;
|
| 304 |
const taskX = this.config.width * 0.5;
|
frontend/src/types/index.ts
CHANGED
|
@@ -439,6 +439,7 @@ export interface GraphComparisonResults {
|
|
| 439 |
creation_timestamp?: string;
|
| 440 |
trace_id?: string;
|
| 441 |
trace_title?: string;
|
|
|
|
| 442 |
};
|
| 443 |
graph2: {
|
| 444 |
id: number;
|
|
@@ -446,6 +447,7 @@ export interface GraphComparisonResults {
|
|
| 446 |
creation_timestamp?: string;
|
| 447 |
trace_id?: string;
|
| 448 |
trace_title?: string;
|
|
|
|
| 449 |
};
|
| 450 |
comparison_timestamp?: string;
|
| 451 |
similarity_threshold?: number;
|
|
@@ -463,6 +465,8 @@ export interface AvailableGraph {
|
|
| 463 |
relation_count: number;
|
| 464 |
status: string;
|
| 465 |
trace_id: string;
|
|
|
|
|
|
|
| 466 |
window_index?: number;
|
| 467 |
window_total?: number;
|
| 468 |
processing_run_id?: string;
|
|
|
|
| 439 |
creation_timestamp?: string;
|
| 440 |
trace_id?: string;
|
| 441 |
trace_title?: string;
|
| 442 |
+
system_name?: string;
|
| 443 |
};
|
| 444 |
graph2: {
|
| 445 |
id: number;
|
|
|
|
| 447 |
creation_timestamp?: string;
|
| 448 |
trace_id?: string;
|
| 449 |
trace_title?: string;
|
| 450 |
+
system_name?: string;
|
| 451 |
};
|
| 452 |
comparison_timestamp?: string;
|
| 453 |
similarity_threshold?: number;
|
|
|
|
| 465 |
relation_count: number;
|
| 466 |
status: string;
|
| 467 |
trace_id: string;
|
| 468 |
+
system_name?: string;
|
| 469 |
+
system_summary?: string;
|
| 470 |
window_index?: number;
|
| 471 |
window_total?: number;
|
| 472 |
processing_run_id?: string;
|