Amitkasar's picture
solved issue
f1c3c6d
Raw History Blame
3.13 kB
import React from 'react';
import { Circle, RefreshCw } from 'lucide-react';
export default function ContextPanel({ sessionContextVars, storedCredentials, onRefresh }) {
const regularVars = Object.entries(sessionContextVars || {}).filter(([k]) => !k.startsWith('__'));
return (
<div style={{ flex: 1, overflowY: 'auto', padding: 14, display: 'flex', flexDirection: 'column', gap: 16 }}>
<section>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 }}>
<span className="h-eyebrow">Session Variables</span>
<button onClick={onRefresh} className="ico-btn" style={{ width: 22, height: 22 }} title="Refresh">
<RefreshCw size={11}/>
</button>
</div>
<div className="panel" style={{ overflow: 'hidden' }}>
{regularVars.length === 0 ? (
<div style={{ padding: 14, textAlign: 'center' }}>
<Circle size={18} style={{ margin: '0 auto 6px', color: 'var(--fg-4)', display: 'block' }} strokeWidth={1.5}/>
<p style={{ fontSize: 11, color: 'var(--fg-3)', margin: 0, fontStyle: 'italic' }}>No variables extracted</p>
</div>
) : (
regularVars.map(([k, v]) => (
<div key={k} style={{ padding: '6px 12px', borderBottom: '1px solid var(--line-1)' }}>
<div style={{ fontSize: 10, fontWeight: 600, color: 'var(--accent)', marginBottom: 2 }}>{k}</div>
<div style={{ fontSize: 11, color: 'var(--fg-2)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{String(v)}</div>
</div>
))
)}
</div>
</section>
<section>
<div style={{ marginBottom: 8 }}>
<span className="h-eyebrow">Test Credentials</span>
</div>
<div className="panel" style={{ overflow: 'hidden' }}>
{Object.keys(storedCredentials || {}).length === 0 ? (
<div style={{ padding: 14, textAlign: 'center' }}>
<Circle size={18} style={{ margin: '0 auto 6px', color: 'var(--fg-4)', display: 'block' }} strokeWidth={1.5}/>
<p style={{ fontSize: 11, color: 'var(--fg-3)', margin: 0, fontStyle: 'italic' }}>No credentials loaded</p>
</div>
) : (
Object.entries(storedCredentials).filter(([k]) => k !== '_clear').map(([k, v]) => {
const isSensitive = k.toLowerCase().match(/(password|token|jwt|secret|bearer)/);
const display = isSensitive && v ? `${String(v).slice(0, 4)}••••` : String(v);
return (
<div key={k} style={{ padding: '6px 12px', borderBottom: '1px solid var(--line-1)' }}>
<div style={{ fontSize: 10, fontWeight: 600, color: 'var(--accent)', marginBottom: 2 }}>{k}</div>
<div style={{ fontSize: 11, color: 'var(--fg-2)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{display}</div>
</div>
);
})
)}
</div>
</section>
</div>
);
}