MCPcopy Create free account
hub / github.com/ShipSecAI/studio / ExpandableText

Function ExpandableText

frontend/src/components/timeline/AgentTracePanel.tsx:612–638  ·  view source on GitHub ↗
({
  text,
  limit = 220,
  className,
}: {
  text: string;
  limit?: number;
  className?: string;
})

Source from the content-addressed store, hash-verified

610}
611
612function ExpandableText({
613 text,
614 limit = 220,
615 className,
616}: {
617 text: string;
618 limit?: number;
619 className?: string;
620}) {
621 const [expanded, setExpanded] = useState(false);
622 const shouldTruncate = text.length > limit;
623 const displayText = expanded || !shouldTruncate ? text : `${text.slice(0, limit)}…`;
624 return (
625 <div className="space-y-1">
626 <p className={cn('whitespace-pre-wrap leading-relaxed', className)}>{displayText}</p>
627 {shouldTruncate && (
628 <button
629 type="button"
630 onClick={() => setExpanded((prev) => !prev)}
631 className="text-[11px] font-semibold text-primary hover:underline"
632 >
633 {expanded ? 'Show less' : 'Show more'}
634 </button>
635 )}
636 </div>
637 );
638}
639
640function summarizeUnknown(value: unknown): string {
641 if (typeof value === 'string') {

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected