@@ -79,6 +79,20 @@ class ArchiveNow extends LitElement {
79
79
private currUrl = "" ;
80
80
private shownForUrl = false ;
81
81
82
+ @state ( )
83
+ private isEmpty = false ;
84
+
85
+ constructor ( ) {
86
+ super ( ) ;
87
+ const hash = window . location . hash . startsWith ( "#url=" ) ;
88
+ if ( ! hash ) {
89
+ this . showHint = false ;
90
+ this . showCreateDialog = true ;
91
+ this . isEmpty = true ;
92
+ this . removeLinky ( ) ;
93
+ }
94
+ }
95
+
82
96
private hintMessages : Record < Hint , TemplateResult > = {
83
97
"first-load" : html `< p class ="mb-3 ">
84
98
Browse and interact with the website like you would normally. Every link
@@ -341,15 +355,16 @@ class ArchiveNow extends LitElement {
341
355
? "shadow shadow-earth-800/10 ring-1 ring-earth-300/50"
342
356
: "shadow-lg shadow-cyan-800/10 ring-2 ring-cyan-300/50" } overflow-hidden rounded-lg bg-white transition-all [grid-area:archive] "
343
357
>
344
- ${ ! this . isFinished
358
+ ${ ! this . isEmpty ?
359
+ ! this . isFinished
345
360
? html ` < archive-web-page
346
361
proxyPrefix ="https://archive-now.webrecorder.workers.dev/proxy/ "
347
362
sandbox ="true "
348
363
coll =${ this . collId }
349
364
deepLink ="true"
350
- url=${ DEFAULT_URL }
351
365
> </ archive-web-page > `
352
- : html ` < replay-web-page coll =${ this . collId } > </ replay-web-page > ` }
366
+ : html ` < replay-web-page coll =${ this . collId } > </ replay-web-page > `
367
+ : html `` }
353
368
</ div >
354
369
< div
355
370
class ="-mb-4 -mt-4 overflow-auto pb-4 pt-4 [grid-area:detail] lg:mr-0 lg:px-4 2xl:px-6 "
@@ -360,7 +375,8 @@ class ArchiveNow extends LitElement {
360
375
? "translate-x-0"
361
376
: "lg:-translate-x-4" } inline-flex h-8 items-center gap-1.5 rounded-full text-brand-green transition-transform "
362
377
>
363
- ${ this . isFinished
378
+ ${ ! this . isEmpty ?
379
+ this . isFinished
364
380
? html `
365
381
🎉
366
382
< span class ="text-sm "> Archiving finished! </ span >
@@ -374,7 +390,7 @@ class ArchiveNow extends LitElement {
374
390
Click < strong class ="font-semibold "> Finish</ strong > to
375
391
finalize your archive
376
392
</ span >
377
- ` }
393
+ ` : `` }
378
394
</ div >
379
395
</ div >
380
396
<!-- FOR LINKY
@@ -391,7 +407,7 @@ class ArchiveNow extends LitElement {
391
407
< div
392
408
class ="pointer-events-none absolute bottom-0 right-0 size-32 opacity-50 transition-opacity delay-75 [background:radial-gradient(farthest-side_at_bottom_right,white,transparent)] "
393
409
> </ div >
394
- ${ this . renderLinky ( ) } ${ this . renderUrlDialog ( ) }
410
+ ${ ! this . isEmpty ? this . renderLinky ( ) : "" } ${ this . renderUrlDialog ( ) }
395
411
` ;
396
412
}
397
413
@@ -487,7 +503,7 @@ class ArchiveNow extends LitElement {
487
503
"Browsertrix" ,
488
504
html `
489
505
< p >
490
- Fully automated archiving of entire websites on a set schedule .
506
+ Automated browser-based crawling at scale .
491
507
</ p >
492
508
` ,
493
509
{
@@ -635,12 +651,19 @@ class ArchiveNow extends LitElement {
635
651
` ;
636
652
}
637
653
654
+ private onUrlDialogRequestClose ( event : Event ) {
655
+ if ( this . isEmpty ) {
656
+ event . preventDefault ( ) ;
657
+ }
658
+ }
659
+
638
660
private renderUrlDialog ( ) {
639
661
return html `
640
662
< sl-dialog
641
663
label ="Create New Archive "
642
664
class ="[--header-spacing:theme(spacing.3)] [--width:70ch] "
643
665
?open =${ this . showCreateDialog }
666
+ @sl-request-close =${ this . onUrlDialogRequestClose }
644
667
@sl-hide=${ ( ) => ( this . showCreateDialog = false ) }
645
668
>
646
669
< form
@@ -659,24 +682,37 @@ class ArchiveNow extends LitElement {
659
682
input . value = "" ;
660
683
this . showCreateDialog = false ;
661
684
662
- this . hint = "page-load" ;
685
+ if ( this . isEmpty ) {
686
+ this . isEmpty = false ;
687
+ this . showHint = true ;
688
+ this . hint = "first-load" ;
689
+ } else {
690
+ this . hint = "page-load" ;
691
+ }
663
692
this . addLinky ( ) ;
664
693
} }
665
694
>
695
+ < div class ="flex flex-col ">
666
696
< div class ="flex items-end gap-3 px-3 pb-3 ">
667
697
< sl-input
668
698
name ="url "
669
699
class ="flex-1 "
670
700
label ="Enter a URL "
671
701
placeholder =${ DEFAULT_URL . replace ( / \/ $ / , "" ) }
672
- type ="url"
673
- autocomplete="off"
702
+ type ="text"
703
+ autocomplete="url"
704
+ inputmode="url"
705
+ spellcheck="false"
674
706
required
675
707
> </ sl-input >
676
708
< sl-button type ="submit " variant ="primary "
677
709
> Start Archiving</ sl-button
678
710
>
679
711
</ div >
712
+ ${ ! this . isEmpty ? html `
713
+ < div class ="px-3 pb-2 text-sm "> Note: Your previous archive will be cleared out. Be sure to download it if you want to keep it!</ div >
714
+ ` : `` }
715
+ </ div >
680
716
</ form >
681
717
</ sl-dialog >
682
718
` ;
0 commit comments