@@ -3,6 +3,11 @@ const userIcon =
33<path d="M7.48514 7.55446C8.98514 7.55446 10.1881 6.41783 10.1881 5.03169C10.1881 3.64555 8.98514 2.49506 7.48514 2.49506C5.98514 2.49506 4.78217 3.63169 4.78217 5.01783C4.78217 6.40397 5.98514 7.55446 7.48514 7.55446ZM7.48514 3.1604C8.58415 3.1604 9.47524 3.99209 9.47524 5.01783C9.47524 6.04357 8.58415 6.87525 7.48514 6.87525C6.38613 6.87525 5.49504 6.05743 5.49504 5.03169C5.49504 4.00595 6.38613 3.1604 7.48514 3.1604ZM2.79207 11.505H12.2079C12.401 11.505 12.5644 11.3525 12.5644 11.1723C12.5644 9.42575 11.0346 7.99803 9.16336 7.99803H5.83663C3.96534 7.99803 2.43564 9.42575 2.43564 11.1723C2.43564 11.3525 2.599 11.505 2.79207 11.505ZM5.83663 8.66337H9.16336C10.5297 8.66337 11.6436 9.60595 11.8218 10.8396H3.17821C3.35643 9.60595 4.47029 8.66337 5.83663 8.66337Z" fill="white"/>
44</svg>` ;
55
6+ const githubIcon =
7+ `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 32 32">
8+ <path fill="currentColor" fill-rule="evenodd" d="M16 2a14 14 0 0 0-4.43 27.28c.7.13 1-.3 1-.67v-2.38c-3.89.84-4.71-1.88-4.71-1.88a3.7 3.7 0 0 0-1.62-2.05c-1.27-.86.1-.85.1-.85a2.94 2.94 0 0 1 2.14 1.45a3 3 0 0 0 4.08 1.16a2.93 2.93 0 0 1 .88-1.87c-3.1-.36-6.37-1.56-6.37-6.92a5.4 5.4 0 0 1 1.44-3.76a5 5 0 0 1 .14-3.7s1.17-.38 3.85 1.43a13.3 13.3 0 0 1 7 0c2.67-1.81 3.84-1.43 3.84-1.43a5 5 0 0 1 .14 3.7a5.4 5.4 0 0 1 1.44 3.76c0 5.38-3.27 6.56-6.39 6.91a3.33 3.33 0 0 1 .95 2.59v3.84c0 .46.25.81 1 .67A14 14 0 0 0 16 2"/>
9+ </svg>` ;
10+
611const downloadIcon =
712 `<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
813<path d="M5.10151 8.53455C4.97826 8.65536 4.97627 8.85319 5.09705 8.97644L7.27905 11.1584C7.33757 11.2172 7.41711 11.2501 7.5 11.25C7.58289 11.2501 7.66239 11.2172 7.72095 11.1584L9.90295 8.97644C10.022 8.85494 10.022 8.66055 9.90295 8.53905C9.78214 8.41579 9.58431 8.41377 9.46106 8.53455L7.8125 10.1831V1.5625C7.8125 1.38992 7.67258 1.25 7.5 1.25C7.32742 1.25 7.1875 1.38992 7.1875 1.5625V10.1831L5.5389 8.53455C5.41744 8.41549 5.22301 8.41549 5.10151 8.53455ZM11.25 5.625H10.3125C10.1399 5.625 10 5.76492 10 5.9375C10 6.11008 10.1399 6.25 10.3125 6.25H11.25C11.94 6.25088 12.4991 6.81 12.5 7.5V11.875C12.4991 12.565 11.94 13.1241 11.25 13.125H3.75C3.06 13.1241 2.50088 12.565 2.5 11.875V7.5C2.50088 6.81 3.06 6.25088 3.75 6.25H5.3125C5.48508 6.25 5.625 6.11008 5.625 5.9375C5.625 5.76492 5.48508 5.625 5.3125 5.625H3.75C2.71492 5.62614 1.87614 6.46492 1.875 7.5V11.875C1.87614 12.9101 2.71492 13.7489 3.75 13.75H11.25C12.2851 13.7489 13.1239 12.9101 13.125 11.875V7.5C13.1239 6.46492 12.2851 5.62614 11.25 5.625Z" fill="white"/>
@@ -86,6 +91,21 @@ function parseAgents(agents) {
8691 return { agents : { } , agentsList : [ ] } ;
8792}
8893
94+ const formatGithubUrl = ( url ) => {
95+ const urlObj = new URL ( url ) ;
96+ const paths = urlObj . pathname . split ( "/" ) . filter ( Boolean ) ;
97+ const [ author , repo ] = paths . slice ( - 2 ) ;
98+ return { author, repo } ;
99+ } ;
100+
101+ function formatText ( url , maxLength ) {
102+ const { author, repo } = formatGithubUrl ( url ) ;
103+ const formattedText = `${ author } /${ repo } ` ;
104+ return formattedText . length > maxLength
105+ ? formattedText . slice ( 0 , maxLength ) + "..."
106+ : formattedText ;
107+ }
108+
89109function renderAgentsList ( _agents ) {
90110 _agents . forEach ( agent => {
91111 // Create li element
@@ -157,12 +177,12 @@ function renderAgentsList(_agents) {
157177 divRowInner . className = "inline-flex flex-row" ;
158178
159179 const spanAuthor = document . createElement ( "span" ) ;
160- spanAuthor . className = "text-xs text-gray-400 px-1 border-b border-gray-500" ;
161- spanAuthor . innerHTML = `<a target="_blank" href="https://github.com/ ${ agent . author . github_id } ">${ agent . author . github_id } </a>` ;
180+ spanAuthor . className = "text-xs text-gray-400 px-1 border-b border-gray-500 ml-1 " ;
181+ spanAuthor . innerHTML = `<a target="_blank" rel="noreferrer" href="${ agent . author . source_url } ">${ formatText ( agent . author . source_url , 20 ) } </a>` ;
162182
163183 const divAuthor = document . createElement ( "div" ) ;
164184 divAuthor . className = "inline-flex flex-row items-center w-full justify-between" ;
165- divAuthor . innerHTML = userIcon ;
185+ divAuthor . innerHTML = githubIcon ;
166186 divAuthor . appendChild ( spanAuthor ) ;
167187
168188 divRowInner . appendChild ( divAuthor ) ;
@@ -201,7 +221,7 @@ function loadOnErrorImage(agentImage) {
201221 agentImage . remove ( ) ;
202222
203223 const svgContainer = document . createElement ( "div" ) ;
204- svgContainer . innerHTML = userIcon ;
224+ svgContainer . innerHTML = githubIcon ;
205225 agentImage . parentElement . appendChild ( svgContainer ) ;
206226}
207227
0 commit comments