@@ -376,17 +376,20 @@ const ZoTracerActivityLog = {
376
376
// Group activities by article title
377
377
const groupedByArticle = { } ;
378
378
activities . forEach ( activity => {
379
- const title = activity . articleTitle || 'Other Activities' ;
380
- if ( ! groupedByArticle [ title ] ) {
381
- groupedByArticle [ title ] = {
379
+ const articleKey = activity . articleKey || 'Other Activities' ;
380
+ const articleTitle = activity . articleTitle || 'Other Activities' ;
381
+ if ( ! groupedByArticle [ articleKey ] ) {
382
+ groupedByArticle [ articleKey ] = {
382
383
activities : [ ] ,
383
- lastModified : new Date ( 0 )
384
+ lastModified : new Date ( 0 ) ,
385
+ articleTitle
384
386
} ;
385
387
}
386
- groupedByArticle [ title ] . activities . push ( activity ) ;
388
+ groupedByArticle [ articleKey ] . activities . push ( activity ) ;
387
389
const activityDate = new Date ( activity . timestamp ) ;
388
- if ( activityDate > groupedByArticle [ title ] . lastModified ) {
389
- groupedByArticle [ title ] . lastModified = activityDate ;
390
+ if ( activityDate > groupedByArticle [ articleKey ] . lastModified ) {
391
+ groupedByArticle [ articleKey ] . lastModified = activityDate ;
392
+ groupedByArticle [ articleKey ] . articleTitle = articleTitle ;
390
393
}
391
394
} ) ;
392
395
@@ -395,7 +398,7 @@ const ZoTracerActivityLog = {
395
398
. sort ( ( [ , a ] , [ , b ] ) => b . lastModified - a . lastModified ) ;
396
399
397
400
// Create article groups
398
- sortedArticles . forEach ( ( [ title , data ] ) => {
401
+ sortedArticles . forEach ( ( [ articleKey , data ] ) => {
399
402
const articleGroup = document . createElement ( 'div' ) ;
400
403
articleGroup . className = 'article-group' ;
401
404
@@ -407,8 +410,8 @@ const ZoTracerActivityLog = {
407
410
headerContent . className = 'article-header-content' ;
408
411
409
412
const titleEl = document . createElement ( 'a' ) ;
410
- titleEl . className = 'article-title' ;
411
- titleEl . textContent = title ;
413
+ titleEl . className = 'article-title' ;
414
+ titleEl . textContent = data . articleTitle ;
412
415
titleEl . href = '#' ;
413
416
titleEl . onclick = ( event ) => {
414
417
event . preventDefault ( ) ;
@@ -491,18 +494,18 @@ const ZoTracerActivityLog = {
491
494
this . sortTimeAsc = false ;
492
495
this . sortCountAsc = false ;
493
496
494
- timeButton . textContent = `按时间排序 ${ this . sortTimeAsc ? '▲' : '▼' } ` ;
495
- countButton . textContent = `按活动数排序 ${ this . sortCountAsc ? '▲' : '▼' } ` ;
497
+ timeButton . textContent = `Order by Time ${ this . sortTimeAsc ? '▲' : '▼' } ` ;
498
+ countButton . textContent = `Order by Count ${ this . sortCountAsc ? '▲' : '▼' } ` ;
496
499
497
500
timeButton . addEventListener ( 'click' , ( ) => {
498
501
this . sortTimeAsc = ! this . sortTimeAsc ;
499
- timeButton . textContent = `按时间排序 ${ this . sortTimeAsc ? '▲' : '▼' } ` ;
502
+ timeButton . textContent = `Order by Time ${ this . sortTimeAsc ? '▲' : '▼' } ` ;
500
503
this . sortActivities ( 'time' , this . sortTimeAsc ) ;
501
504
} ) ;
502
505
503
506
countButton . addEventListener ( 'click' , ( ) => {
504
507
this . sortCountAsc = ! this . sortCountAsc ;
505
- countButton . textContent = `按活动数排序 ${ this . sortCountAsc ? '▲' : '▼' } ` ;
508
+ countButton . textContent = `Order by Count ${ this . sortCountAsc ? '▲' : '▼' } ` ;
506
509
this . sortActivities ( 'count' , this . sortCountAsc ) ;
507
510
} ) ;
508
511
} ,
@@ -543,19 +546,19 @@ const ZoTracerActivityLog = {
543
546
// Group activities by article
544
547
const groupedByArticle = { } ;
545
548
filteredActivities . forEach ( activity => {
546
- const title = activity . articleTitle || 'Other Activities' ;
547
- if ( ! groupedByArticle [ title ] ) {
548
- groupedByArticle [ title ] = [ ] ;
549
+ const articleKey = activity . articleKey || 'Other Activities' ;
550
+ if ( ! groupedByArticle [ articleKey ] ) {
551
+ groupedByArticle [ articleKey ] = [ ] ;
549
552
}
550
- groupedByArticle [ title ] . push ( activity ) ;
553
+ groupedByArticle [ articleKey ] . push ( activity ) ;
551
554
} ) ;
552
555
553
556
let flomoContent = '' ;
554
557
555
558
// Format content for each article
556
- for ( const [ title , activities ] of Object . entries ( groupedByArticle ) ) {
559
+ for ( const [ articleKey , activities ] of Object . entries ( groupedByArticle ) ) {
557
560
// Add article title as a memo title
558
- flomoContent += `# 📖 ${ title } \n\n` ;
561
+ flomoContent += `# 📖 ${ activities [ 0 ] . articleTitle } \n\n` ;
559
562
560
563
for ( const activity of activities ) {
561
564
// Get activity type and determine icon
@@ -888,10 +891,10 @@ const ZoTracerActivityLog = {
888
891
}
889
892
} ) ;
890
893
891
- // Sort collections by activity count and get top 4
894
+ // Sort collections by activity count and get top n
892
895
const topCollections = Array . from ( collectionStats . entries ( ) )
893
896
. sort ( ( a , b ) => b [ 1 ] - a [ 1 ] )
894
- . slice ( 0 , 4 ) ;
897
+ . slice ( 0 , 5 ) ;
895
898
896
899
// Get collection names
897
900
const collectionsWithNames = await Promise . all (
@@ -1008,6 +1011,7 @@ const ZoTracerActivityLog = {
1008
1011
'highlight_annotation' : 0 ,
1009
1012
'underline_annotation' : 0 ,
1010
1013
'add_note' : 0 ,
1014
+ 'select_tab' : 0 ,
1011
1015
'add_item' : 0
1012
1016
} ;
1013
1017
@@ -1027,13 +1031,15 @@ const ZoTracerActivityLog = {
1027
1031
'Highlight Annotation' ,
1028
1032
'Underline Annotation' ,
1029
1033
'Add Notes' ,
1030
- 'Add Items'
1034
+ 'Select Tab' ,
1035
+ 'Add Item'
1031
1036
] ;
1032
1037
const data = [
1033
1038
activityTypes [ 'highlight_annotation' ] ,
1034
1039
activityTypes [ 'underline_annotation' ] ,
1035
1040
activityTypes [ 'add_note' ] ,
1036
- activityTypes [ 'add_item' ]
1041
+ activityTypes [ 'select_tab' ] ,
1042
+ activityTypes [ 'add_item' ] ,
1037
1043
] ;
1038
1044
1039
1045
this . activityRadarChart = new Chart ( ctx , {
0 commit comments