@@ -112,6 +112,13 @@ class ArgoViewer extends LitElement {
112112 color: #000;
113113 }
114114
115+ .status-divider {
116+ width: 100%;
117+ margin: 0.5rem 0;
118+ border: none;
119+ border-top: 1px solid #e0e0e0;
120+ }
121+
115122 img.favicon {
116123 width: var(--md-icon-size) !important;
117124 height: var(--md-icon-size) !important;
@@ -226,6 +233,23 @@ class ArgoViewer extends LitElement {
226233 return "" ;
227234 }
228235
236+ private getCurrentPage ( ) {
237+ const sameUrls = this . archiveList
238+ ?. getAllPages ( )
239+ // @ts -expect-error - TS2339 - Property 'pageUrl' does not exist on type 'ArgoViewer'.
240+ . filter ( ( p ) => p . url === this . pageUrl ) ;
241+ if ( ! sameUrls || ! sameUrls . length ) {
242+ return null ;
243+ }
244+
245+ // Sort by timestamp (newest first)
246+ return sameUrls . sort ( ( a , b ) => {
247+ const tsA = parseInt ( a . ts , 10 ) ;
248+ const tsB = parseInt ( b . ts , 10 ) ;
249+ return tsB - tsA ; // Descending order (newest first)
250+ } ) [ 0 ] ;
251+ }
252+
229253 private async onDownload ( ) {
230254 const selectedPages = this . archiveList ?. getSelectedPages ?.( ) || [ ] ;
231255 if ( ! selectedPages . length ) {
@@ -276,19 +300,33 @@ class ArgoViewer extends LitElement {
276300 console . log ( "WACZ file downloaded:" , filename ) ;
277301 }
278302
279- private async onShare ( ) {
303+ private async onShareSelected ( ) {
280304 const selectedPages = this . archiveList ?. getSelectedPages ?.( ) || [ ] ;
281305 if ( ! selectedPages . length ) {
282306 alert ( "Please select some pages to share." ) ;
283307 return ;
284308 }
285-
286309 console . log ( "Selected pages to share:" , selectedPages ) ;
310+ await this . onShare ( selectedPages ) ;
311+ }
287312
313+ private async onShareCurrent ( ) {
314+ const currentPage = this . getCurrentPage ?.( ) || null ;
315+ if ( ! currentPage ) {
316+ alert ( "No current page to share." ) ;
317+ return ;
318+ }
319+ console . log ( "Current page to share:" , currentPage ) ;
320+ await this . onShare ( [ currentPage ] ) ;
321+ }
322+
323+ // @ts -expect-error - TS7006 - Parameter 'pages' implicitly has an 'any' type.
324+ private async onShare ( pages ) {
288325 const defaultCollId = ( await getLocalOption ( "defaultCollId" ) ) || "" ;
289326 const coll = await collLoader . loadColl ( defaultCollId ) ;
290327
291- const pageTsList = selectedPages . map ( ( p ) => p . id ) ;
328+ // @ts -expect-error - TS7006 - Parameter 'p' implicitly has an 'any' type.
329+ const pageTsList = pages . map ( ( p ) => p . id ) ;
292330 const format = "wacz" ;
293331 const filename = `archive-${ Date . now ( ) } .wacz` ;
294332
@@ -654,13 +692,21 @@ class ArgoViewer extends LitElement {
654692 }
655693 ${
656694 // @ts -expect-error - TS2339 - Property 'status' does not exist on type 'ArgoViewer'. | TS2339 - Property 'status' does not exist on type 'ArgoViewer'.
657- ! this . status ?. numPending
695+ ! this . status ?. numPending && this . pageUrl
658696 ? html `< div class ="status-container ">
659- < md-icon filled style ="color: var(--md-sys-color-primary); "
660- > check_circle</ md-icon
697+ < md-icon filled style ="color: var(--md-sys-color-primary); "
698+ > check_circle</ md-icon
699+ >
700+ < span class ="status-content "> All resources archived</ span >
701+ </ div >
702+ < hr class ="status-divider " />
703+ < md-filled-button
704+ style ="color: white; border-radius: 9999px; align-self: flex-end; "
705+ @click =${ this . onShareCurrent }
661706 >
662- < span class ="status-content "> All resources archived</ span >
663- </ div > `
707+ < md-icon slot ="icon " style ="color:white "> share</ md-icon >
708+ Share Current Page
709+ </ md-filled-button > `
664710 : ""
665711 }
666712 </ div > ` ;
@@ -828,7 +874,10 @@ class ArgoViewer extends LitElement {
828874 < md-icon style ="color: gray; "> download</ md-icon >
829875 </ md-icon-button >
830876
831- < md-icon-button aria-label ="Share " @click =${ this . onShare } >
877+ < md-icon-button
878+ aria-label ="Share "
879+ @click =${ this . onShareSelected }
880+ >
832881 < md-icon style ="color: gray; "> share</ md-icon >
833882 </ md-icon-button >
834883 `
0 commit comments