File tree Expand file tree Collapse file tree 3 files changed +40
-2
lines changed
Expand file tree Collapse file tree 3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 452452 border-radius : 12px ;
453453}
454454
455+ .topic-details-header {
456+ display : flex;
457+ justify-content : space-between;
458+ align-items : center;
459+ margin-bottom : 15px ;
460+ }
461+
455462.topic-details h3 {
456463 color : var (--primary-color );
457- margin-bottom : 15px ;
464+ margin-bottom : 0 ;
465+ }
466+
467+ .close-btn {
468+ background : transparent;
469+ border : none;
470+ font-size : 1.5rem ;
471+ color : var (--text-secondary );
472+ cursor : pointer;
473+ padding : 4px 8px ;
474+ border-radius : 4px ;
475+ transition : var (--topic-transition );
476+ }
477+
478+ .close-btn : hover {
479+ color : var (--text-primary );
480+ background : var (--bg-hover );
458481}
459482
460483/* Statistics Panel */
Original file line number Diff line number Diff line change @@ -166,7 +166,10 @@ <h2>Inter-topic Distance Map (pyLDAvis-style)</h2>
166166 < p class ="subtitle "> Topic similarity in 2D space using PCA</ p >
167167 < div id ="intertopic-plot " class ="plot-container "> </ div >
168168 < div id ="topic-details " class ="topic-details ">
169- < h3 > Topic Details</ h3 >
169+ < div class ="topic-details-header ">
170+ < h3 > Topic Details</ h3 >
171+ < button id ="close-topic-details " class ="close-btn " aria-label ="Close topic details "> ×</ button >
172+ </ div >
170173 < div id ="topic-words-bars "> </ div >
171174 </ div >
172175 </ div >
@@ -250,6 +253,13 @@ <h3>Statistics</h3>
250253 // Export
251254 document . getElementById ( 'export-topics-btn' ) . addEventListener ( 'click' , exportTopics ) ;
252255 document . getElementById ( 'export-viz-btn' ) . addEventListener ( 'click' , exportVisualization ) ;
256+
257+ document . getElementById ( 'close-topic-details' ) . addEventListener ( 'click' , ( ) => {
258+ const topicDetails = document . getElementById ( 'topic-details' ) ;
259+ const barsContainer = document . getElementById ( 'topic-words-bars' ) ;
260+ barsContainer . innerHTML = '' ;
261+ topicDetails . style . display = 'none' ;
262+ } ) ;
253263 }
254264
255265 function setupRangeSlider ( sliderId , valueId ) {
Original file line number Diff line number Diff line change @@ -395,6 +395,11 @@ export class TopicVisualizer {
395395 }
396396
397397 showTopicWordBars ( topicIdx , results ) {
398+ const topicDetails = document . getElementById ( 'topic-details' ) ;
399+ if ( topicDetails ) {
400+ topicDetails . style . display = 'block' ;
401+ }
402+
398403 const topWordsCount = parseInt ( document . getElementById ( 'top-words' ) ?. value || 10 ) ;
399404 const topic = results . topics [ topicIdx ] . slice ( 0 , topWordsCount ) ;
400405
You can’t perform that action at this time.
0 commit comments