Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions frontend/components/nodes/source-node.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import { useGlobalContext } from '@/context/GlobalContext';
import { Handle, Position } from '@xyflow/react';
import { useState } from 'react';

export default function SourceNode() {
const [isConnected, setIsConnected] = useState(false);
const { dataStreaming } = useGlobalContext();

const handleClick = () => {
setIsConnected((prev) => !prev);
};

return (
<div
onClick={handleClick}
className="relative w-[396px] h-[96px] flex bg-white rounded-[30px] border-2 border-[#D3D3D3] shadow-none p-0"
>
<div className="relative w-[396px] h-[96px] flex bg-white rounded-[30px] border-2 border-[#D3D3D3] shadow-none p-0">
{/* Status dot */}
<span
className={`absolute left-6 top-1/2 -translate-y-1/2 w-3 h-3 rounded-full ${dataStreaming && isConnected ? 'bg-[#509693]' : 'bg-[#D3D3D3]'}`}
className={`absolute left-6 top-1/2 -translate-y-1/2 w-3 h-3 rounded-full ${dataStreaming ? 'bg-[#509693]' : 'bg-[#D3D3D3]'}`}
/>

{/* Texts */}
Expand All @@ -29,15 +20,10 @@ export default function SourceNode() {
Headset_001
</span>
</div>
{/* Right circle */}
<span
className={`absolute right-6 top-1/2 -translate-y-1/2 w-6 h-6 rounded-full flex items-center justify-center border-[3px] ${isConnected ? 'border-[#000000]' : ' border-[#D3D3D3]'}`}
>
{isConnected && (
<span className="w-3 h-3 rounded-full bg-white" />
)}

{/* Right source handle */}
{/* Right circle */}
<span className="absolute right-6 top-1/2 -translate-y-1/2 w-6 h-6 rounded-full flex items-center justify-center border-[3px] border-[#000000]">
<span className="w-3 h-3 rounded-full bg-white" />
<Handle
type="source"
position={Position.Right}
Expand Down
Loading