MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / renderMessages

Function renderMessages

codeclash/viewer/static/js/trajectory.js:78–117  ·  view source on GitHub ↗
(
  foldout,
  messages,
  playerName,
  roundNum,
  trajectoryFilePath,
)

Source from the content-addressed store, hash-verified

76}
77
78function renderMessages(
79 foldout,
80 messages,
81 playerName,
82 roundNum,
83 trajectoryFilePath,
84) {
85 const messagesContainer = foldout.querySelector(".messages-container");
86 const headerInfo = foldout.querySelector(".trajectory-header-info");
87
88 // Clear existing content
89 messagesContainer.innerHTML = "";
90
91 // Add header info with file path and buttons
92 if (trajectoryFilePath) {
93 headerInfo.innerHTML = `
94 <div style="display: flex; gap: 0.5rem; align-items: center;">
95 <span style="color: var(--muted-text);">${messages.length} messages</span>
96 <button class="copy-path-btn-small" data-path="${trajectoryFilePath}" title="Copy trajectory file path">
97 <i class="bi bi-clipboard"></i> Copy path
98 </button>
99 <button class="download-btn-small" data-path="${trajectoryFilePath}" title="Download trajectory file">
100 <i class="bi bi-download"></i> Download
101 </button>
102 </div>
103 `;
104
105 // Re-setup copy and download buttons for these new buttons
106 setupCopyButtons();
107 setupDownloadButtons();
108 } else {
109 headerInfo.innerHTML = `<span style="color: var(--muted-text);">${messages.length} messages</span>`;
110 }
111
112 // Render each message
113 messages.forEach((message, index) => {
114 const messageBlock = createMessageElement(message, index + 1);
115 messagesContainer.appendChild(messageBlock);
116 });
117}
118
119function createMessageElement(message, index) {
120 const messageBlock = document.createElement("div");

Callers 1

loadTrajectoryDetailsFunction · 0.85

Calls 3

setupCopyButtonsFunction · 0.85
setupDownloadButtonsFunction · 0.85
createMessageElementFunction · 0.85

Tested by

no test coverage detected